Boost logo

Boost Users :

Subject: [Boost-users] [BGL] Dynamic property map containing pointers to custom object
From: Leonardo Ciman (leonardo.ciman_at_[hidden])
Date: 2009-05-29 08:45:04


Hi,
i tried to build a property map using the associative_property_map and
putting a poiter to a pure virtual class as value type but i had some
error i can't understand.
I also tried with a normal class pointer and i had the same problem.

/usr/include/boost/dynamic_property_map.hpp:202: error: no match for
‘operator<<’ in'
out << boost::get ...

I'm new to boost and c++, it's likely that i've done some stupid
errors.

I hope somebody can help me.

That's a test that reproduce the problem:

f#include <boost/graph/adjacency_list.hpp>
#include <boost/dynamic_property_map.hpp>
#include <boost/property_map.hpp>
#include <map>
#include <iostream>

typedef
boost::adjacency_list<boost::vecS,boost::vecS,boost::undirectedS>Graph;
typedef boost::graph_traits<Graph>::vertex_descriptor
vertex_descriptor;

class Interface
{
        virtual void test()=0;
};

class Implement : Interface
{
        void test(){std::cout << "ok" <<std::endl;}
};

int main()
{
        std::map<vertex_descriptor,Interface&>* testmap = new
std::map<vertex_descriptor, Interface&>;
        
boost::associative_property_map<std::map<vertex_descriptor,Interface&>
> test_map(*testmap);
        boost::dynamic_properties dp;
        dp.property("test", test_map); //that's the line that cause the
problem
        Implement i;
        put("test", dp, 0, i);
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net