About 112,000 results
Open links in new tab
  1. c++ - Storing std map in map - Stack Overflow

    @Oxsnarder: What is the cost of creating a default string and then assigning a char const* to it ? The default std::string probably performance no memory allocation (if yours does, shoot off …

  2. What is a Map and how would I use one in C++? - Stack Overflow

    Jun 22, 2009 · Map is collection type end it is implemented in C++ in the STL (Standard Template Library) end here is the official explanation from the library documentation. Map is a Sorted …

  3. c++ - How do you loop through a std::map? - Stack Overflow

    Take into account that value_type for std::map is defined the following way. typedef pair<const Key, T> value_type Thus in my example p is a const reference to the value_type where Key is …

  4. Initializing a static std::map<int, int> in C++ - Stack Overflow

    Jul 21, 2019 · Using C++11 initializer list {{},{},...}. The order of the initialized elements does not matter. The map will do the ordering by the key for you.

  5. c++ - When I should use std::map::at to retrieve map element

    Oct 20, 2015 · I have read different articles on web and questions at stackoverflow, but for me it is not clear is there any exclusive case when it is better to use std::map::at to retrieve map …

  6. c++ - How to retrieve all keys (or values) from a std::map and put …

    Sep 21, 2008 · C++ treats std::map<T,U> as a container of pairs. In Python, a dict acts like its keys when iterated over, but lets you say d.items() to get the C++ behavior. Python also …

  7. c++ - stl map performance? - Stack Overflow

    Apr 16, 2012 · A std::map is a balanced binary tree, lookup will take O( log N ) operations, each of which is a comparison of the keys plus some extra that you can ignore in most cases (pointer …

  8. insert vs emplace vs operator [] in c++ map - Stack Overflow

    Because std::map does not allow for duplicates if there is an existing element it will not insert anything. The first difference between the two is that operator[] needs to be able to construct a …

  9. c++ - Sorting std::map using value - Stack Overflow

    Feb 20, 2011 · Generic Associative Source (requires C++11) If you're using an alternate to std::map for the source associative container (such as std::unordered_map), you could code a …

  10. c++ - How to find whether an element exists in std::map ... - Stack ...

    This makes exists_in work with any standard container via std::find and use a special version for std::map since it offers a more efficient searching alternative. You could add additional …

Refresh