c++ - hashmaps maps, unordered maps, with classes as keys -
this question has answer here:
- std::maps user-defined types key 5 answers
i many different issues trying use stl maps, discouraging
so got many questions:
first had problem " < operator not defined", did not need ordering in maps(why need default anyway) found unordered_map have use c++11 or something, don't know means , not sure idea, standard c? portable ?
then got weird error:
/usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type ‘struct std::hash< folvariable>’
so why template intrusive? mean should act container, not minding object nor inside of it
anyone can me out error?
thanks
first had problem " < operator not defined", did not need ordering in maps(why need default anyway)
from documentation:
std::map sorted associative container contains key-value pairs unique keys. keys sorted using comparison function compare.
emphasis mine. default, comparison function operator <
.
so found unordered_map have use c++11 or something, don't know means , not sure idea, standard c? portable ?
c++11 name of latest c++ standard. modern compilers support major features of standard now. if compiler supports it, it's idea use features require. it's not standard c, standard c++.
then got weird error:
/usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type ‘struct std::hash< folvariable>’
std::unordered_map
hash table. default, hashing function used std::unordered_map<key, value>
specialization of std::hash<key>
. error because no such specialization exists type folvariable
.
Comments
Post a Comment