Why can't I call a non-const member function on an element in an std::set?
问题 I hve the next code: set<Item> temp_items; set < Item >::iterator it; temp_items = user->second.get_items(); for (it = temp_items.begin(); it != temp_items.end(); it++) { if (counter == (choice - 1)) { it->get_count(); } } The item function i trying to call is: int Item::get_count() { return _count; } I don't have in here any const type that should prevent me from accessing the item object, and still, I get the next message: the object has type qualifiers that are not compatible with the