|
Boost : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-04-16 01:23:47
Daniel Wallin wrote:
>>>The second problem is that I need to create a type for 'keywords'
>>>(derived
>>>from 'keywords<...>' and use it for passing arguments). The docs suggest
>>>to create a number of forwarding functions, but given that a number of
>>>vertex properties can be rather large (and is actually unbounded), this
>>>does not seem good.
>
> Isn't the number of properties bounded by the graph type? Couldn't you
> create some metafunction to generate the keywords<> type from the graph
Yes, I think it could be possible.
> and use Boost.PP to generate overloads on this form (please ignore all
> the BGL related errors here):
>
> template<class G, class A0, .., class AN>
> typename enable_if_graph<
> G
> , typename graph_traits<G>::edge_descriptor
> >::type
> add_edge(
> typename graph_traits<G>::vertex_descriptor u
> , typename graph_traits<G>::vertex_descriptor v
> , A0 const& a0
> , ...
> , AN const& an
> , G& g)
> {
> typename keywords_for_graph<G>::type kw;
> return add_edge_impl(u, v, g, kw(a0, ..., an));
Should there be kw()(a0...) ? It seems the syntax that works for me.
> }
I did not consider overloading 'add_edge'. In fact, it's still not so good
idea. You'd also need to provide similiar overloads for at least
'add_vertex' and 'put' and maybe something else, which makes the
implementation more complex. I though I can only provide new constructor
for boost::proprty and have everything work.
I wonder what's the reason to require conversion/construction of keywords<>?
Couldn't (color = 10, name = "foo") already create a type with proper
operator[])?
- Volodya
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk