Hi Guys, I have three interesting questions in regard to graph properties. Please assume Boost 1_29_0. I'm a little slow in upgrading ... ;-) 1. If I define: MyGraph_t const myGraph; Why cannot I get a property map to access my property: typedef boost::property_map<MyGraph_t, MyPropTag_t>::type MyPropMap_t; MyPropMap_t myPropMap = get(MyPropTag_t(), myGraph); Instead I need to use for each access: get(MyPropTag_t(), myGraph, *i) I have noticed that gcc 3.2 complains in regard to conversion to a non-scalar type being similar to that of myGraph without const-ness of the nested property type. What can I do to get normal map access? 2. Why not use a copy constructor if it exists when copying graph elements? Is the existence of a copy constructor a hard-yard to verfiy with MPL? 3. I noticed that remove_edge(...) complains in regard to a missing default constructor of a property object. Don't get me wrong; this happened during an editing mishap and I know that we need regular types here. Why is this required if you are removing an element? Thanks for the pointers/opinions! :-) Matt
On Friday 21 March 2003 09:55 pm, dmatt001 wrote:
Hi Guys,
I have three interesting questions in regard to graph properties. Please assume Boost 1_29_0. I'm a little slow in upgrading ... ;-)
1. If I define:
MyGraph_t const myGraph;
Why cannot I get a property map to access my property:
typedef boost::property_map<MyGraph_t, MyPropTag_t>::type MyPropMap_t; MyPropMap_t myPropMap = get(MyPropTag_t(), myGraph);
You want: typedef boost::property_map<MyGraph_t, MyPropTag_t>::const_type MyPropMap_t;
2. Why not use a copy constructor if it exists when copying graph elements? Is the existence of a copy constructor a hard-yard to verfiy with MPL?
I don't know the rationale behind the decision, but I do know that it is _very_ hard to determine if there is a copy constructor in C++ because they are implicitly generated. The question isn't "is there a copy constructor" but "is there an _accessible_ copy constructor" and, unfortunately, we can't test accessibility in a metaprogram :(.
3. I noticed that remove_edge(...) complains in regard to a missing default constructor of a property object. Don't get me wrong; this happened during an editing mishap and I know that we need regular types here. Why is this required if you are removing an element?
The answer is probably linked to the answer to #2: if copy constructors aren't used, then edges (along with their internal properties) are copied by defalut-constructing the target then calling a function to perform the copy. Doug
participants (2)
-
dmatt001
-
Douglas Gregor