I am creating a graph by BGL, and would like to combine bundled properties with vertex_index_t as the VertexProperty of the graph is listS.
I used the method from BGL dijkstra_shortest_path algorithm method does not accept my color map exterior property , however, I end up with specialization of template in different namespace error.
#include <boost/graph/adjacency_list.hpp>
namespace MyNameSpace {
using namespace boost;
struct VertexP {
    std::string name;
    unsigned int id;
};
typedef adjacency_list<vecS, listS, bidirectionalS, VertexP> Graph;
class VertexIndexMap {
public:
    typedef boost::readable_property_map_tag category;
    typedef size_t  value_type;
    typedef value_type reference;
    typedef Graph::vertex_descriptor key_type;
    VertexIndexMap(const Graph& g): _g(&g) {}
    const Graph * _g;
};
template<>
struct property_map<Graph, vertex_index_t > {
    typedef VertexIndexMap const_type;
};
}
I tried the following code, but not work.
namespace MyNameSpace {
namespace boost {
template<>
struct property_map<Graph, vertex_index_t > {
    typedef VertexIndexMap const_type;
};
}
}
Please help me out.
EDIT
Below is my current solution, don't know if it's correct.
#include <boost/graph/adjacency_list.hpp>
namespace MyNameSpace {
using namespace boost;
struct VertexP {
    std::string name;
    unsigned int id;
};
typedef adjacency_list<vecS, listS, bidirectionalS, VertexP> Graph;
class VertexIndexMap {
public:
    typedef boost::readable_property_map_tag category;
    typedef size_t  value_type;
    typedef value_type reference;
    typedef Graph::vertex_descriptor key_type;
    VertexIndexMap(const Graph& g): _g(&g) {}
    const Graph * _g;
};
}
namespace boost {
template<>
struct property_map<Graph, vertex_index_t > {
    typedef VertexIndexMap const_type;
};
}
namespace MyNameSpace {
  // the remaining code in namespace MyNameSpace
}