Reputation: 5029
I'm using boost::bimap
to map integers to strings:
typedef boost::bimap<int, std::string> ParamIDStrings;
typedef ParamIDStrings::value_type id_pair;
extern const ParamIDStrings paramIDStrings;
I'm trying to create reference variables so I can write code like:
paramIDStringsByID.at(5);
// Instead of having to remember which side is which:
paramIDStrings.left.at(5);
But I'm having a hard time interpreting the Boost documentation, to understand of what type bimap::left
is.
I tried:
// Compiler throws error: invalid use of template-name 'boost::bimaps::bimap' without an argument list
boost::bimaps::bimap::left ¶mIDStringsByID = paramIDStrings.left;
// Compiler throws error: 'paramIDStrings' does not name a type
paramIDStrings::left_map ¶mIDStringsByID = paramIDStrings.left;
// Compiler throws error: invalid initialization of reference of type boost::bimaps::bimap<int, std::__cxx11::basic_string<char> >::left_map
boost::bimaps::bimap<int,std::string>::left_map &cParamIDStringsByID = cParamIDStrings.left;
Upvotes: 0
Views: 366
Reputation: 5029
boost/bimap/bimap.hpp
has a typedef for this: left_map
and right_map
. So you can do:
paramIDStrings::left_map ¶mIDStringsByID = paramIDStrings.left;
Upvotes: 0