Using boost :: associative property map with boost :: BIMAP interface

I cannot implement the boost property map associative interface for binary enhancement.

I have a bimap as follows, and I'm trying to define a boost :: associative property map for it. I want to use the Put and Get helper functions for my bimak .. the code is as follows:

 typedef boost::bimaps::bimap< vertex_descriptor_t, size_t >       vd_idx_bimap_t;
 typedef boost::associative_property_map< vd_idx_bimap_t >         asso_vd_idx_bimap_t;

 // define bimap
 vd_idx_bimap_t        my_bimap;
 asso_vd_idx_bimap_t   my_asso_bimap(my_bimap);

I get a compilation error like

  error: no type named âsecond_typeâ in âboost::bimaps::container_adaptor::container_adaptor<boost::multi_index::detail::ordered_index<boost::m.... goes on long list. 

I know bimaps are supported through property maps. see here for documentation. It's just interesting how I can use an associative property map for it. If I can define a left or right bimap for my associative properties map, that would be fine too. please suggest.

+2
1

, :

typedef boost::associative_property_map<vd_idx_bimap_t::left_map> asso_vd_idx_bimap_t;
// OR
typedef boost::associative_property_map<vd_idx_bimap_t::right_map> asso_vd_idx_bimap_t;

, Live on Coliru

#include <boost/bimap.hpp> 
#include <boost/property_map/property_map.hpp> 
#include <iostream> 

using namespace boost; 

int main() 
{
    typedef int vertex_descriptor_t;
    typedef boost::bimaps::bimap< vertex_descriptor_t, size_t > vd_idx_bimap_t;
    typedef boost::associative_property_map<vd_idx_bimap_t::left_map>   asso_vd_idx_bimap_t;

    // define bimap
    vd_idx_bimap_t        my_bimap;
    asso_vd_idx_bimap_t   my_asso_bimap(my_bimap.left);
} 
+2

Source: https://habr.com/ru/post/1526072/


All Articles