Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-12-06 14:32:03


On Saturday 06 December 2003 11:32 am, garcia wrote:
> Douglas Gregor wrote:
> >Today I (again) ran into an instance where I had a property map but really
> >wanted a function object. The code I wanted to write was:
> >
> > std::vector<vertex_descriptor> reversed_order(num_vertices(rdg));
> > depth_first_search(rdg,
> > boost::visitor(
> > make_dfsnum_visitor(reversed_order.begin())));
> > return transform(reverse_order.rbegin(), reverse_order.rend(),
> > out, get(symbol_tag(), rdg));
> >
> >get(symbol_tag(), rdg) returns a property map now, so this code is
> > ill-formed. At the moment I either have to wrap the property map (yuck)
> > or just fall back to a hand-coded loop (also yuck).
> >
> >Would anyone object if I made property maps into function objects? Any
> >downsides?
>
> Are you suggesting changing the interface specified by the concepts in
> the property map library, specifically, the LValuePropertyMap?

Yep. Essentially adding pmap(key) as a synonym for pmap[key]. Granted, I'd
like pmap(key) to return an lvalue for an lvalue property map, a
convertible-to-T for a readable property map, and an assignable-from-T from a
writable property map, just so it can be consistently used.

        Doug


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