About 19,900,000 results
Open links in new tab
  1. Map like structure in C: use int and struct to determine a value

    59 You'll probably have to make your own structure. The C Programming Language by Kernighan and Ritchie has an example of making an associate map in c, and what I'll detail below is …

  2. Porting std::map to C? - Stack Overflow

    Many C implementations support tsearch (3) or hsearch (3). tsearch (3) is a binary tree and you can provide a comparator callback. I think that's about as close as you're going to get to a …

  3. hashmap - C map data structure - Stack Overflow

    Jan 16, 2017 · I want to implement a key value pair data structure in C. Any idea?

  4. How do you loop through a std::map? - Stack Overflow

    I want to iterate through each element in the map<string, int> without knowing any of its string-int values or keys. What I have so far: void output(map<string, int> table) { m...

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

    Feb 20, 2011 · I need to sort an std::map by value rather than by key. Is there an easy way to do it? I got one solution from the follwing thread: std::map sort by data? Is there a better solution? …

  6. In plain C, how to do you make the equivalent of a "map"?

    Apr 27, 2015 · Map * map_create(void); void map_insert(Map * map, char key, int value); int map_find(Map * map, char key); void map_destroy(Map * map); Then you'd be able to do …

  7. How to choose between map and unordered_map? - Stack Overflow

    Dec 10, 2012 · Suppose I wanted to map data with a string as the key. What container should I have chosen, map or unordered_map? unordered_map takes up more memory so let's …

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

    362 In the particular case of a map, the old options were only two: operator[] and insert (different flavors of insert). So, I will start explaining those. The operator[] is a find-or-add operator. It will …

  9. How to find if a given key exists in a std::map - Stack Overflow

    To those who are looking for speed: count and find are nearly identical in speed when using maps that require unique keys. (1) If you don't need the elements to maintain a specific order, use …

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

    What is the right way of initializing a static map? Do we need a static function that will initialize it?