![](/img/trans.png)
[英]error C2663: 'std::_Hash<_Traits>::insert' : 3 overloads have no legal conversion for 'this' pointer
[英]C2663: 'std::_Tree>::insert': 5 overloads have no legal conversion for 'this' pointer
#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個重載沒有合法轉換為“ this”指針。
i.second
被編譯器const
限定為合格,因此禁止插入。
如果不是錯誤,我該如何處理?
如果不是錯誤,我該如何處理?
您無法更改已排序的std::set
中已插入的值,因為對數據進行了排序,並且修改會使該變量無效。 您要么需要刪除/修改/重新插入,要么使用不同於std::set
容器
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.