|
|
const std::vector<std::string> stringVector{ "@", "#", "&", "*"};| cppreference wrote: |
|---|
| Type requirements - InputIt must meet the requirements of LegacyInputIterator. - ForwardIt must meet the requirements of LegacyForwardIterator. - UnaryPredicate must meet the requirements of Predicate. |
std::find can be used with other containers. Look up the reference for each container you want to use, and see what the definitions are for its iterators.std::end ? |
|
| but the code I used below can be pretty much interchanged with any STL container right? |
| Complexity: Linear. However, if InputIt additionally meets the requirements of LegacyRandomAccessIterator, complexity is constant. https://en.cppreference.com/w/cpp/iterator/distance |
|
|
| What if i just want to print the key "Health Pack" and not the value associated with it? |
|
|
cout << myMap["Health Pack"] << '\n'; |
|