
On Mon, May 2, 2011 at 22:04, Craig Longman
I'm using VS v9, just in case that matters in this case.
unordered_map< string, uint32_t > xrf1; unordered_map< string, uint32_t >::const_iterator& iter = xrf1.find( "hello" );
This is something I've used many times with the other containers (well, std::map at least), but here I'm getting a conversion error.
VS is letting you do something not standards-compliant. You're trying
to bind a temporary to a reference-to-nonconst, which is illegal.
Try to do the same thing in a non-VS compiler with std::map and you'll
see it fail:
#include <map>
#include <string>
using namespace std;
int main() {
map< string, int > xrf1;
map< string, int >::const_iterator& iter = xrf1.find( "hello" );
}
In function 'int main()':
Line 7: error: invalid initialization of non-const reference of type
'__gnu_debug::_Safe_iterator , int> >, __gnu_debug_def::map ~ Scott