Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2008-06-23 11:12:37


On Jun 22, 2008, at 9:18 PM, David Abrahams wrote:

> Niels Dekker - mail address until 2008-12-31 wrote:
>>>> Would it be okay to you if we would add support for array types to
>>>> the Boost.Swap utility that is located in the sandbox?
>>
>> David Abrahams wrote:
>>> Whether or not this is a good idea depends on whether you think swap
>>> is fundamentally an O(1) and/or nonthrowing operation.
>>
>> The array support I would like to add to boost::swap is non-
>> throwing, as
>> long as the array element type has a non-throwing swap.
>
> Sure, but it is not O(1) no matter what the element type does.

O(1) is not as important as fast. For std::pair, std::tuple,
std::array, and now built-in arrays, having a custom swap is
considerably faster than using the default std::swap definition (which
also is not O(1)).

-Howard


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