Boost logo

Boost Users :

From: Ambichl Christoph (christoph_at_[hidden])
Date: 2004-08-06 18:29:27


Hello,
I am trying to implement an edge-property map with three properties,
but it does not work as I expected it. Below is the source code and
the compiler error message.

Thanks for your help!

Christoph

*** Source Code ***

#include <boost/property_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>

using namespace boost;

enum edge_type_t { edge_type };
enum edge_cplex_x_t { edge_cplex_x };

namespace boost {
BOOST_INSTALL_PROPERTY(edge, type);
BOOST_INSTALL_PROPERTY(edge, cplex_x);
}

// first try
typedef property<edge_type_t, int,
          property<edge_weight_t, int,
          property<edge_cplex_x_t, float> > > EdgeProperty;

// second try
typedef property<edge_type_t, int> EdgeType;
typedef property<edge_weight_t, int> EdgeWeight;
typedef property<edge_cplex_x_t, int> EdgeX;
typedef property< EdgeType, EdgeWeight, EdgeX > EdgeProperty2;

typedef adjacency_list<vecS, vecS, directedS,
                no_property, EdgeProperty> Eag;

typedef graph_traits<Eag>::vertex_descriptor vertex_descriptor;
typedef graph_traits<Eag>::edge_descriptor edge_descriptor;
typedef pair<int,int> Edge;

int main() {

   Eag eag(5);
   property_map<Eag,edge_type_t>::type e_type = get(edge_type,eag);
   property_map<Eag,edge_weight_t>::type e_weight = get(edge_weight,eag);
   property_map<Eag,edge_cplex_x_t>::type e_x = get(edge_cplex_x,eag);

   add_edge(vertex(0,eag), vertex(1,eag), EdgeProperty(0,3,1.0), eag);

   return 0;
}

*** Error Message ***

propertymap.cpp: In function `int main()':
propertymap.cpp:44: error: no matching function for call to `
    boost::property<edge_type_t, int,
boost::property<boost::edge_weight_t, int,
    boost::property<edge_cplex_x_t, float, boost::no_property> >
>::property(
    int, int, double)'
/usr/local/include/boost/pending/property.hpp:16: error: candidates are:
    boost::property<edge_type_t, int,
boost::property<boost::edge_weight_t, int,
    boost::property<edge_cplex_x_t, float, boost::no_property> >
>::property(const boost::property<edge_type_t, int,
    boost::property<boost::edge_weight_t, int,
boost::property<edge_cplex_x_t,
    float, boost::no_property> > >&)
/usr/local/include/boost/pending/property.hpp:22: error:
    boost::property<Tag, T, Base>::property(const T&, const Base&) [with
Tag =
    edge_type_t, T = int, Base = boost::property<boost::edge_weight_t, int,
    boost::property<edge_cplex_x_t, float, boost::no_property> >]
/usr/local/include/boost/pending/property.hpp:21: error:
    boost::property<Tag, T, Base>::property(const T&) [with Tag =
edge_type_t, T
    = int, Base = boost::property<boost::edge_weight_t, int,
    boost::property<edge_cplex_x_t, float, boost::no_property> >]
/usr/local/include/boost/pending/property.hpp:20: error:
    boost::property<Tag, T, Base>::property() [with Tag = edge_type_t, T
= int,
    Base = boost::property<boost::edge_weight_t, int,
    boost::property<edge_cplex_x_t, float, boost::no_property> >]


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