Boost logo

Boost :

From: Ronald Garcia (garcia_at_[hidden])
Date: 2003-12-06 14:59:56


Douglas Gregor wrote:

>On Saturday 06 December 2003 11:32 am, garcia wrote:
>
>
>>Douglas Gregor wrote:
>>
>>
>>>
>>>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.
>
>
>
Got it. I don't think that's a good idea. My reasoning is this: The
property-map interface allows for a great deal of flexibility in the
implementation of property maps. That is, a model of the Readable (or
Writeable) Property Map concepts need not provide any member functions.

This is important especially when adapting a non-BGL graph type to
use BGL algorithms (take it from one who's been there ;) ). Under those
circumstances, it is very *good* to be able to construct a property map
interface by simply adding traits classes and overloads of put() and/or
get().

I guess I could almost see adding operator() to LValuePropertyMap, but
then the property-map-as-function-object idiom would only work for that
special case of property map.

So, given these issues, I think that it would be better to provide a
means to easily wrap property maps into a function objects.

Cheers,

ron


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