begin iterator of map not working c++ -
we have map:
std::map<double, colorref> colorset; here provide part of function returns colorref value
colorref getcolour(double value) const { ... for(std::map<double, colorref>::iterator ii=colorset.begin(); ii!=colorset.end(); ++ii) { std::cout << (*ii).first << ": " << (*ii).second << std::endl; } ... return defaultcolor; } but, compiler gives error telling nonexistance of converting tree_const_iteratortotree_iterator in colorset.begin().
if delete const term function ok, must declare function const.
why error appearing? or can provide alternate way iterate though map?
use const_iterator:
for(std::map<double, colorref>::const_iterator ii=colorset.begin(); ii!=colorset.end(); ++ii) ps
i use ii->first etc
Comments
Post a Comment