R
Rares Vernica
Hi,
I am using tr1/unordered_map in my code.
My code compiled ok on g++ (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu1). Now I
need to compile my code on g++ (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5).
I get a messy error. Here are what I try to do:
typedef unordered_map<string, unsigned> StringHash;
....
StringHash::const_iterator word_pos;
I get the error when I create the const_iterator:
index.cc:161: error: no matching function for call to
‘Internal::hashtable_iterator<std:
air<const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, unsigned int>, true,
false>::hashtable_iterator()’
Removing const from the iterator does not make any difference.
I tried to add const to string:
typedef unordered_map<const string, unsigned> StringHash;
....
typedef set<unsigned> WordLevelEntrySet;
typedef pair<StringHash::const_iterator, WordLevelEntrySet> WordLevelEntry;
And the error moves to another place but is also on const_iterator:
/usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../include/c++/4.0.3/tr1/hashtable:
In instantiation of ‘Internal::hash_code_base<const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std:
air<const std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, unsigned int>,
Internal::extract1st<std:
air<const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, unsigned int> >,
std::equal_to<const std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, std::tr1::hash<const std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
Internal::mod_range_hashing, Internal::default_ranged_hash, false>’:
Is probably something that has been fixed or improved between the
versions. Is there any workaround?
Thanks a lot,
Ray
I am using tr1/unordered_map in my code.
My code compiled ok on g++ (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu1). Now I
need to compile my code on g++ (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5).
I get a messy error. Here are what I try to do:
typedef unordered_map<string, unsigned> StringHash;
....
StringHash::const_iterator word_pos;
I get the error when I create the const_iterator:
index.cc:161: error: no matching function for call to
‘Internal::hashtable_iterator<std:
std::char_traits<char>, std::allocator<char> >, unsigned int>, true,
false>::hashtable_iterator()’
Removing const from the iterator does not make any difference.
I tried to add const to string:
typedef unordered_map<const string, unsigned> StringHash;
....
typedef set<unsigned> WordLevelEntrySet;
typedef pair<StringHash::const_iterator, WordLevelEntrySet> WordLevelEntry;
And the error moves to another place but is also on const_iterator:
/usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../include/c++/4.0.3/tr1/hashtable:
In instantiation of ‘Internal::hash_code_base<const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std:
std::allocator<char> >, unsigned int>,
Internal::extract1st<std:
std::char_traits<char>, std::allocator<char> >, unsigned int> >,
std::equal_to<const std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, std::tr1::hash<const std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
Internal::mod_range_hashing, Internal::default_ranged_hash, false>’:
Is probably something that has been fixed or improved between the
versions. Is there any workaround?
Thanks a lot,
Ray