After using the same map key value pair, I wanted to clear the existing contents of sourcePoints and transfer all contents from halflambdaResolution into sourcePoints, but I am getting a compile time error in visual studio that I can't understand. Any help will be appreciated.
1 2 3 4 5 6 7
|
struct SourcePointsValue{
int sourcePoint;
int neighborCount;
} ;
map<int,SourcePointsValue> sourcePoints, halflambdaResolution;
sourcePoints.clear();
sourcePoints.insert(halflambdaResolution.begin(), halflambdaResolution.end());
|
ERROR
ompiling...
Geodesic_Aug7_validation_branchpoints_extraterminationcondition_multiresolution.cpp
F:\WD_Windows_Tools\C\James_tsai_documents\test_geodesic\Geodesic_Aug7_validation_branchpoints_extraterminationcondition_multiresolution.cpp(307) : error C2664: 'class std::_Tree<int,struct std::pair<int const ,struct SourcePointsValue>,struct std::
map<int,struct SourcePointsValue,struct std::less<int>,class std::allocator<struct SourcePointsValue> >::_Kfn,struct std::less<int>,class std::allocator<struct SourcePointsValue> >::iterator __thiscall std::map<int,struct SourcePointsValue,struct st
d::less<int>,class std::allocator<struct SourcePointsValue> >::insert(class std::_Tree<int,struct std::pair<int const ,struct SourcePointsValue>,struct std::map<int,struct SourcePointsValue,struct std::less<int>,class std::allocator<struct SourcePoi
ntsValue> >::_Kfn,struct std::less<int>,class std::allocator<struct SourcePointsValue> >::iterator,const struct std::pair<int const ,struct SourcePointsValue> &)' : cannot convert parameter 2 from 'class std::_Tree<int,struct std::pair<int const ,st
ruct SourcePointsValue>,struct std::map<int,struct SourcePointsValue,struct std::less<int>,class std::allocator<struct SourcePointsValue> >::_Kfn,struct std::less<int>,class std::allocator<struct SourcePointsValue> >::iterator' to 'const struct std:
:pair<int const ,struct SourcePointsValue> &'
Reason: cannot convert from 'class std::_Tree<int,struct std::pair<int const ,struct SourcePointsValue>,struct std::map<int,struct SourcePointsValue,struct std::less<int>,class std::allocator<struct SourcePointsValue> >::_Kfn,struct std::les
s<int>,class std::allocator<struct SourcePointsValue> >::iterator' to 'const struct std::pair<int const ,struct SourcePointsValue>'
No constructor could take the source type, or constructor overload resolution was ambiguous