Apesar dos templates para hash_set e hash_map não serem padronizados, ambos são relativamente comuns, estando disponíveis tanto na implementação GNU (ie, no GCC) quanto no Visual C++ no Windows. Existem algumas diferenças, como o namespace um pouco mais escondido no GNUC (__gnu_cxx vs stdext) e alguns métodos que existem em um mas não em outro (p.ex.: reverse_iterator que não existe no GCC); mas a maioria das vezes servem para o serviço.
Um problema comum com essas classes no GCC é um erro meio criptico quando tentamos usar __gnu_cxx::hash_set<std::string> ou __gnu_cxx::hash_map<std::string>:
/usr/include/c++/4.2/ext/hashtable.h:595: error: no match for call to '(const __gnu_cxx::hash<std::basic_string<char, std::char_traits, std::allocator > >) (const std::basic_string<char, std::char_traits, std::allocator >&)'
Este erro ocorre porque a libstdc++ não define uma função de hash para std::string. A solução é definir uma (O RLY?). Felizmente a biblioteca padrão define uma função de hash para strings do tipo char*, então podemos aproveitá-la:
struct string_hash : public std::unary_function<std::string,size_t>
{
size_t operator() (const std::string &v) const
{
return __gnu_cxx::hash()(v.c_str());
}
};
typedef __gnu_cxx::hash_set<std::string,string_hash> string_hash_set;





Search engine result advertisement top dog Themelis Cuiper had a hyperlink to your story. Any idea why? So your feed is example of something. :->
You have done a very good job as your posting is recommended by Themelis Cuiper’s SocialGarden Business one-on-ones about socialmarketing & CRM.
Does anyone know are there as good career personal marketing service than ReputationUP.com? Foot Locker? They only cost fortynine dollars which is not much, but my client Drake told me there is, but he could not remember its name. l totally start to get suspicion that he remembered wrongly.
and EDGE for high speed data access are some of the specialized features that has been added in the Motorola KRZR K1.The product of the mobile giant Motorola, the K1 model also comes with the rich, pre-loaded J2ME games, screen savers; j2me
Good article Thanks, Güzel yazı teşekkürler