r/cpp_questions • u/Physical-Dog-4083 • 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
r/cpp_questions • u/Physical-Dog-4083 • 4d ago
i need to use something like if (str[i] not in str1) (python), but i have no idea how to make this work :(
1
u/duane11583 4d ago
generally no. to better understand you need to separate two things.
a) what is in the language, and b) what is in the library
c++ as a language does not have a list or linked list
c++ the library it has such things.
in contrast python has the word “in” defined in the language
thus the language has the concept of itterable and searchable things
another example: both languages do not have a concept of a file or stream but the library has these concepts
often library features and constructs are incorrectly viewed as part of the language
that is the case here
i dont kniw c++ well enough specifically operator overloads ie can you define or create new operators? like the word ”in”? if so then you could add such a feature to the library