この質問StackoVerflow529831を参照すると、これは提案されたアプローチの1つでした
template<typename Map> typename Map::const_iterator
greatest_less(Map const& m, typename Map::key_type const& k) {
//How to print K and Map m
typename Map::const_iterator it = m.lower_bound(k);
if(it != m.begin()) {
return --it;
}
return m.end();
}
キーKとマップmの印刷に興味があります。これについてはどうでしょうか。