H
Hicham Mouline
Hello,
I have a std::map<std::string, boost::shared_ptr<my_type_t>>.
I often lookup based on the key (std::string)
I have a use case where I want to iterate over all the map except for keys
that begin with "RF".
I could iterate and check if iterator->first.find("RF")==0, then ignore it.
typedef std::map<std::string, boost::shared_ptr<my_type_t>> my_container_t;
my_container_t my_container;
for (my_container_t::const_iterator i=my_container.begin();
i!=my_container.end(); ++i)
if (i->first.first.find("RF")!=0)
//proceed
Is there a better way ? perhaps a smarter iterator that knows to jump over
the RF... entries?
rds,
I have a std::map<std::string, boost::shared_ptr<my_type_t>>.
I often lookup based on the key (std::string)
I have a use case where I want to iterate over all the map except for keys
that begin with "RF".
I could iterate and check if iterator->first.find("RF")==0, then ignore it.
typedef std::map<std::string, boost::shared_ptr<my_type_t>> my_container_t;
my_container_t my_container;
for (my_container_t::const_iterator i=my_container.begin();
i!=my_container.end(); ++i)
if (i->first.first.find("RF")!=0)
//proceed
Is there a better way ? perhaps a smarter iterator that knows to jump over
the RF... entries?
rds,