중첩 세트가 있지만 중첩 세트에 요소를 삽입 할 수 없습니다.중첩 된 stl 세트에 요소를 삽입 할 수 없습니다
std::set<std::set<int> > centre_as_set = bitset_to_set(centre->second->bit_partitions);
std::set<std::set<int> >::iterator set_itr;
for (set_itr = centre_as_set.begin(); set_itr != centre_as_set.end(); ++set_itr) {
set_itr->insert(4);
std::set<int>::iterator node_itr;
for (node_itr = set_itr->begin(); node_itr != set_itr->end(); ++node_itr) {
std::cout << *node_itr;
}
}
}
오류가 나는 확실히 그 템플릿 오류, 감사 어떤 도움을 해독 할 수
Partition_standalone.cpp:612: error: passing ‘const std::set, std::allocator >’ as ‘this’ argument of ‘std::pair, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const _Key&) [with _Key = int, _Compare = std::less, _Alloc = std::allocator]’ discards qualifiers
입니다.
'연산자'가 있습니다. [여기] (http://www.cplusplus.com/reference/stl/set/operators/). –
런타임 오류가 아니며 컴파일 오류이므로 문제가됩니다. – SoapBox
틀린 게시물을 삭제할만한 가치가 있습니까? –