If we have
std::set<int > a;
std::vector<std::unordered_set<int>> b;
And we went to insert a
inside b
Method 1: we can do:
std::set<int > a;
std::vector<std::unordered_set<int>> b (a.begin(), a.end());
Method 2, we cannot do this?
std::set<int > a;
std::vector<std::unordered_set<int>> b;
b.insert(a.begin(), a.end());
What does this error means?
error C2664: 'std::_Vector_iterator,std::equal_to<_Kty>,std::allocator<_Kty>>>>> std::vector,std::equal_to<_Kty>,std::allocator<_Kty>>,std::allocator<_Ty>>::insert(std::_Vector_const_iterator,std::equal_to<_Kty>,std::allocator<_Kty>>>>>,unsigned int,const _Ty &)' : cannot convert argument 1 from 'std::_Tree_const_iterator>>' to 'std::_Vector_const_iterator,std::equal_to<_Kty>,std::allocator<_Kty>>>>>' IntelliSense: no instance of overloaded function "std::vector<_Ty, _Alloc>::insert [with _Ty=std::unordered_set, std::equal_to, std::allocator>, _Alloc=std::allocator, std::equal_to, std::allocator>>]" matches the argument list argument types are: (std::_Tree_const_iterator>>, std::_Tree_const_iterator>>) object type is: std::vector, std::equal_to, std::allocator>, std::allocator, std::equal_to, std::allocator>>>
What is the solution if we need to deal with b
as global unordered_set
?