Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-16 14:43:39


I have written the following graph declaration:

namespace boost {
namespace
{
  enum edge_cast_t { edge_cast = 8010 };
}

// Install properties
BOOST_INSTALL_PROPERTY(edge, cast);

namespace
{
  typedef void*(*cast_function)(void*);

  //
  // Here we put together the low-level data structures of the
  // casting graph representation.
  //
  typedef python::converter::undecorated_type_id_t class_id;

  // represents a graph of available casts
  struct cast_graph
      : adjacency_list<vecS,vecS, bidirectionalS, no_property

      // edge index property allows us to look up edges in the connectivity
matrix
      , property<edge_index_t,std::size_t

                 // The function which casts a void* from the edge's source
type
                 // to its destination type.
                 , property<edge_cast_t,cast_function> > >
  {};
}

Now I have a R/W property edge_cast property map. Suppose I write a
function:

void foo(cast_graph const& g)
{

      typedef property_map<cast_graph,edge_cast_t>::type cast_map;
      cast_map casts = get(edge_cast, g);
---------------------^

Error!

src/object/inheritance.cpp:261: conversion from
   `boost::adj_list_edge_property_map<boost::bidirectional_tag,
   void*(*)(void*), void*(* const&)(void*), size_t, const
   boost::property<boost::edge_index_t, size_t,
   boost::property<boost::<unnamed>::edge_cast_t, void*(*)(void*),
   boost::no_property> >, boost::<unnamed>::edge_cast_t>' to non-scalar type
   `boost::adj_list_edge_property_map<boost::bidirectional_tag,
   void*(*)(void*), void*(*&)(void*), size_t,
   boost::property<boost::edge_index_t, size_t,
   boost::property<boost::<unnamed>::edge_cast_t, void*(*)(void*),
   boost::no_property> >, boost::<unnamed>::edge_cast_t>' requested

There should be a const_property_map<G,D>::type generator for this purpose.
Is there?

-Dave

===================================================
  David Abrahams, C++ library designer for hire
 resume: http://users.rcn.com/abrahams/resume.html

        C++ Booster (http://www.boost.org)
          email: david.abrahams_at_[hidden]
===================================================


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk