$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Brook Milligan (brook_at_[hidden])
Date: 2007-02-22 13:41:37
I am trying to specify the requirement that types cover the
PropertyGraphConcept of the BGL. The following code illustrates a
simple test case.
#include <boost/graph/adjacency_list.hpp>
struct VertexProperties
{
typedef VertexProperties kind;
int distance;
};
struct EdgeProperties
{
typedef EdgeProperties kind;
int weight;
};
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
VertexProperties, EdgeProperties> graph_type;
int
main()
{
boost::function_requires< boost::PropertyGraphConcept<graph_type,
int, int VertexProperties::*> >();
return 0;
}
However, with Boost v1.33.1, the concept check yields the following
error:
/usr/pkg/include/boost/property_map.hpp:158: error: assignment of read-only
data-member `
boost::ReadablePropertyMapConcept<boost::bundle_property_map<const
graph_type, size_t, VertexProperties, const int>, int>::val'
The location of that error is associated with the indicated line
clipped out of property_map.hpp:
// property_map.hpp
template <class PMap, class Key>
struct ReadablePropertyMapConcept
{
typedef typename property_traits<PMap>::key_type key_type;
typedef typename property_traits<PMap>::reference reference;
typedef typename property_traits<PMap>::category Category;
typedef boost::readable_property_map_tag ReadableTag;
void constraints() {
function_requires< ConvertibleConcept<Category, ReadableTag> >();
val = get(pmap, k); // <== read-only assignment error
}
PMap pmap;
Key k;
typename property_traits<PMap>::value_type val;
};
Perhaps the template arguments in the concept checking are wrong; I
have found the documentation unclear on how to really use these. Any
help on how to make this work correctly is greatly appreciated.
Thanks alot.
Cheers,
Brook