|
Boost Users : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-03-23 13:12:29
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
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