Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-04-15 15:24:01


David Abrahams wrote:
> Vladimir Prus <ghost_at_[hidden]> writes:
>
>
>>I've just made an attempt to use the named parameters library (currently in
>>review queue, and available at
>>http://groups.yahoo.com/group/boost/files/named_params.zip) to simply
>>properties in BGL.
>>
>>
>>I've tried to implement this idea, but run into the problems. First issue is
>>documentation: it gives
>>
>> foo_impl(foo_keywords(a0));
>>
>>as example, while the code uses:
>>
>> return f_impl(f_keywords()(t, name_));
>>
>>Which has extra '()' after f_keywords.
>
>
> Uh, yeah. I think I need to let Daniel answer for that problem.

Yeah I'll take care of it.. Thanks.

>>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
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));
   }

-- 
Daniel Wallin

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