Ticket #2753: array_swap_by_boost_swap.patch

File array_swap_by_boost_swap.patch, 683 bytes (added by niels_dekker, 14 years ago)
  • array.hpp

     
    2727#include <cstddef>
    2828#include <stdexcept>
    2929#include <boost/assert.hpp>
     30#include <boost/swap.hpp>
    3031
    3132// Handles broken standard libraries better than <iterator>
    3233#include <boost/detail/iterator.hpp>
     
    131132
    132133        // swap (note: linear complexity)
    133134        void swap (array<T,N>& y) {
    134             std::swap_ranges(begin(),end(),y.begin());
     135            for (size_type i = 0; i < N; ++i)
     136                boost::swap(elems[i],y.elems[i]);
    135137        }
    136138
    137139        // direct access to data (read-only)