hi guys thanks for the replies,after reading the link above,
what do you mean by
you can't have a non-const reference of a temporary object. |
because even if I make the reference a const
const map<string,string> &entries = readFromDiary();
I still get an error
edit*****
hi guys it seems that the error now has gone away BUT now I am getting a new error with my iterator,
anyway two questions
how come it the reference has to be const in order for this to work?
and also why am I getting an error with my iterator?
conversion from 'std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >}' to non-scalar type 'std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::iterator {aka std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >}' requested
thanks
thanks