#include <map>
#include <set>
using namespace std;
map <string, set<pair<int, set<int>>>> dictonary;
int s()
{
for (auto & i : dictonary["abc"])
{
i.second.insert(2); //error C2663
}
}
C2663: 'std::_Tree>::insert': 5 overloads have no legal conversion for 'this' pointer.
i.second
is considered by the compiler const
qualified so that insertion is forbidden.
If it is not a bug, how can I manipulate it?
You cannot change value that is already inserted into
std::set
in place as data is ordered and modification would invalidate the invariant. You either need to remove/modify/reinsert or use different container thanstd::set