How to check if an element is contained in std::set in C++?
Hello everyone! I recently started learning C++ and encountered a problem: I need to check if a certain value is in the `std::set` container. I know that `std::set` stores unique elements in sorted order, but I can't figure out how to properly check for the presence of an element.
For example, I have this code:
```cpp
#include
#include
int main() {
std::set numbers = {10, 20, 30, 40, 50};
int value = 30;
// How to check if value is in numbers?
// I tried numbers.contains(value), but the compiler complains.
return 0;
}
```
I heard that in C++20 there is a `contains` method, but my compiler doesn't support it (I'm using C++17). I tried using `find`, but I don't quite understand how to compare the iterator. Maybe