Boost logo

Boost :

Subject: Re: [boost] [BGL] [PropertyMap] Key param is passed by value in put function
From: Jeffrey Bosboom (jbosboom_at_[hidden])
Date: 2009-11-18 23:12:38

Andrew Sutton wrote:
>> I've noticed that the put function that takes a generic put_get_helper map,
>>> takes a key param. The question is: why the key param is passed by value? Is
>>> any reason for this? The key value is not modified setting the property map.
> The original application of keys for property maps only covered some fairly
> trivial data types (ints, pointers, and pairs thereof). Passing by value is
> perfectly acceptable in these cases.

Leaving aside whether copy elision is performed or not, isn't this what
call_traits<T>::param_type is for, passing built-in types and pointers
as T and user-defined types as const T&? (On the other hand,
std::pair<int, int> is probably best passed by value, but param_type
would be a const reference.)

--Jeffrey Bosboom

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