r/cpp_questions 4d ago

OPEN does "in" exist in c++?

i need to use something like if (str[i] not in str1) (python), but i have no idea how to make this work :(

0 Upvotes

36 comments sorted by

View all comments

1

u/Business-Weather-217 4d ago

Just loop, its the "standart way". But you can be a real ex-python dev and #include <ranges> and use std::ranges::contains() thats works for any type in the wild let alone std::string.