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

旧巷老猫 提交于 2019-12-02 01:47:54

You need to tell it which side of the bimap to use:

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;

So, see it 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);
} 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!