0

In Python, I can use the 'not' and 'in' operators to do something like

lisst = ['a', 'b', 'c']

if fuuuuu not in lisst:
    do_something()

Is there an equivalent in C++, for like simple vectors and arrarys and whatnot?

Shidouuu
  • 368
  • 4
  • 14
  • For `std::vector`: https://stackoverflow.com/questions/571394/how-to-find-out-if-an-item-is-present-in-a-stdvector – wohlstad May 01 '22 at 16:25
  • 1
    Note: `std::find` works with any standard container, not only vectors. It can also work with C-style arrays if you provide pointers to beginning and one-past-the-end element. – Yksisarvinen May 01 '22 at 16:26
  • Something like [std::none_of](https://en.cppreference.com/w/cpp/algorithm/all_any_none_of) maybe? – Galik May 01 '22 at 16:40

0 Answers0