Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#2753 closed Patches (fixed)

Please let array::swap call boost::swap, instead of std::swap_ranges

Reported by: niels_dekker Owned by: No-Maintainer
Milestone: Boost 1.39.0 Component: array
Version: Boost 1.38.0 Severity: Optimization
Keywords: Cc: niels_dekker

Description

The swap member function of boost::array is implemented by calling std::swap_ranges. Now I've looked into various STL implementations, and some of them have swap_ranges doing element-wise copying, even when the the element type has a custom swap function. So it appears be preferable to have array::swap call boost::swap instead, for each of its elements.

The boost::swap utility, provided by Joseph Gauterin, takes care of calling the appropriate custom swap, whenever found by argument-dependent lookup (ADL). Moreover, it also supports swapping built-in arrays.

So please consider applying the attached patch.

Attachments (1)

array_swap_by_boost_swap.patch (683 bytes ) - added by niels_dekker 14 years ago.

Download all attachments as: .zip

Change History (3)

by niels_dekker, 14 years ago

comment:1 by Steven Watanabe, 13 years ago

Resolution: fixed
Status: newclosed

Fixed in [53104].

comment:2 by niels_dekker, 13 years ago

Hi Steven, Thank you for fixing the issue!

Note: See TracTickets for help on using tickets.