Link to home
Start Free TrialLog in
Avatar of asmyatt
asmyatt

asked on

Problem reading iterator values from a set

I am porting some windows C++ code to solaris. The following line of code compiles and works on the windows maching, but not the solaris machine.

I get the following error message:
error: invalid initialization of reference of type 'std::set<std::wstring, std::less<std::wstring>, std::allocator<std::wstring> >&' from expression of type 'const std::set<std::wstring, std::less<std::wstring>, std::allocator<std::wstring> >'

Can anyone shed some light on this? I don't see what the problem is.



set< pair< long,set<wstring> > >::iterator itSet1;
set<wstring> &tempSet = (*itSet1).second;

Open in new window

Avatar of jkr
jkr
Flag of Germany image

Make that

const set<wstring> &tempSet = (*itSet1).second;

and you should be fine (according to the error message).
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial