I tried it out, and at least for me, its not working.
loaded the wordlist and did the following...
1 2
|
pair<set<string>::iterator, set<string>::iterator> word;
word = wordList.equal_range(board_letter);
|
I get the following error... feel free to take a crack at decoding the error message :)
from what I gather, equal range doesnt like that i am using a char instead of a string and of course, it wont let me cast it.
error C2664: 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::equal_range(const std::basic_string<_Elem,std::char_traits<char>,_Ax> &)' : cannot convert parameter 1 from 'char' to 'const std::basic_string<_Elem,_Traits,_Ax> &'
1> with
1> [
1> _Ty1=std::_Tree<std::_Tset_traits<std::string,std::less<std::string>,std::allocator<std::string>,false>>::iterator,
1> _Ty2=std::_Tree<std::_Tset_traits<std::string,std::less<std::string>,std::allocator<std::string>,false>>::iterator,
1> _Traits=std::_Tset_traits<std::string,std::less<std::string>,std::allocator<std::string>,false>,
1> _Elem=char,
1> _Ax=std::allocator<char>
1> ]
1> and
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> Reason: cannot convert from 'char' to 'const std::basic_string<_Elem,_Traits,_Ax>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> No constructor could take the source type, or constructor overload resolution was ambiguous
I might just take the hit to memory and stay with my multimap instead of recoding everything to make a set work.
Now back to my question... does anyone know the proper syntax to do:
wordlist.insert( istream_iterator <string> ( f ), istream_iterator <string> () );
but in a multimap:
wordlist.insert(pair<x,y> ( istream......[first letter], istream....(word) ) ?