Have in C++ analog IDictionary.ContainsKey (TKey) or List.Contains (T) from C# ?
For example I have array of elements and need to know have this array some value or not ? What is best way or best practics - without "foreach" for each element ! It will be good if it's will from std library for example.
UPD 1: In std lib have many containers, but I want to find a best way - faster, little code, less complicated and so on ...
Lookind that better desigion is std::unordered_set
if going on this logic
#include <unordered_set>
std::unordered_set<std::string> NamesOfValues = {
"one",
"two",
"Date",
"Time"
};
// and now check is value exists in set
if(NamesOfValues.count(value))
{
// value exists
}