我有一个bimap。我想检查密钥是否存在于我的bimap中。我怎么能做到这一点。这是我的bimap:
namespace bimap
{
struct Name{};
struct ID{};
typedef
boost::bimaps::bimap<
boost::bimaps::set_of<
boost::bimaps::tagged<
unsigned short
, ID
>
>,
boost::bimaps::set_of<
boost::bimaps::tagged<
std::string
, Name
>
>
>
name_index_bimap;
}我想检查'Name‘是否存在。
发布于 2012-04-05 14:53:27
这一点在this example中解释得相当清楚。在您的示例中,它应该如下所示:
name_index_map your_map;
name_index_map::right_const_iterator it = your_map.by<Name>().find("some name");
if(it == your_map.right.end()) {
// name does not exists
}https://stackoverflow.com/questions/10023802
复制相似问题