Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-04-15 08:49:05

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
> to simply
> properties in BGL.
> Currently, to initialize all properties one has to do:
> edge_descriptor e = add_edge(....);
> put(e, g, vertex_color, 10);
> put(e, g, vertex_name, "foo");
> I hope that with the named parameters library it will be possible to do:
> add_edge(v1, v2, (vertex_color = 10, vertex_name = "foo"), g);

What are these for? That's not part of how the library works, at
least today... oh, I see you're trying to deal with the "unbounded
number of vertex properties" problem. Probably the library should be
modified a bit to help with that sort of situation. We really
envisioned that it could help the graph library by just making the
interfaces to the algorithms, which have lots of default arguments,
much easier.

> 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.

> 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.
> So, now can do:
> vertex_property p = prop_keywords()(color = 10, name = "foo");
> but I'd rather like:
> vertex_property p((color = 10, name = "foo"));
> So, the operator, will be overloaded to create something I can index with 'tag
> type' and get a value. In fact, this will allow to avoid declaring
> 'pop_keywords' -- since again, user can declare it's own keywords so it's not
> clear how to define that class.
> The example I've played with is at:
> Comments are appreciated.

I think we can whip something together for you.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at