how to use map properly when passing through method inside class in c++ -
i can't make map
work class, what's wrong here? can't figure out, please help:
#include <map> #include <iterator> class base { public: bool delete_lowest(map<char, double> &frequencies) { double min=1; char del ; box b1; (iterator itr = frequencies.begin(); itr != frequencies.end(); ++itr) { if(itr->second < min) { min= itr->second ; del= itr->first ; } } frequencies.erase(del) ; return true; }
i getting errors "map not declared" , on. think way code not proper way. how proceed? thanks
map
in std
namespace. try
bool delete_lowest(std::map<char, double> &frequencies)
Comments
Post a Comment