The problem is on the "MyIter = " line:

class OrientedPoint
{
.... class variables ...
std::map<std::string, double> DoubleValues;
 
.....

bool OrientedPoint::getDoubleValue(const std::string &ValueName, double &Value) const
{
std::map<std::string, double>::iterator MyIter;
MyIter = DoubleValues.find(ValueName);

The error produced is:

In member function 'bool OrientedPoint::getDoubleValue(const std::string&, double&) const':
error: no match for 'operator=' in 'MyIter = ((const OrientedPoint*)this)->OrientedPoint::DoubleValues.std::map<_Key, _Tp, _Compare, _Alloc>::find [with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = double, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, _Alloc = std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, double> >](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::string*)ValueName)))'

note: candidates are: std::_Rb_tree_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, double> >& std::_Rb_tree_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, double> >::operator=(const std::_Rb_tree_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, double> >&)

I setup an identical situation in a demo project and it seems to compile fine... does anyone see that there would be a problem with this? I just can't decypher the stl error as usual... haha

Thanks,
Dave

The method is marked as const, so calling find on DoubleValues will use the overload that returns a const_iterator. You can't assign a const_iterator to an iterator, but because the method is const, it should be safe enough to change the iterator like this:

bool OrientedPoint::getDoubleValue(const std::string &ValueName, double &Value) const
{
    std::map<std::string, double>::const_iterator MyIter;
    MyIter = DoubleValues.find(ValueName);

By the way, it's cleaner and usually more efficient to initialize objects in the constructor instead of through assignment:

bool OrientedPoint::getDoubleValue(const std::string &ValueName, double &Value) const
{
    std::map<std::string, double>::const_iterator MyIter = DoubleValues.find(ValueName);
This question has already been answered. Start a new discussion instead.