From 86b069ad0e6dd4ebcc3f16037851201a335039f6 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Sat, 23 May 2009 06:00:42 +0000 Subject: [PATCH] Merge [53104] and [53105] from the trunk [SVN r53198] --- include/boost/array.hpp | 14 ++++++++------ test/array3.cpp | 2 +- test/array5.cpp | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/boost/array.hpp b/include/boost/array.hpp index 52218aa..8ef73c4 100644 --- a/include/boost/array.hpp +++ b/include/boost/array.hpp @@ -27,6 +27,7 @@ #include #include #include +#include // Handles broken standard libraries better than #include @@ -131,7 +132,8 @@ namespace boost { // swap (note: linear complexity) void swap (array& y) { - std::swap_ranges(begin(),end(),y.begin()); + for (size_type i = 0; i < N; ++i) + boost::swap(elems[i],y.elems[i]); } // direct access to data (read-only) @@ -209,19 +211,19 @@ namespace boost { } // operator[] - reference operator[](size_type i) + reference operator[](size_type /*i*/) { return failed_rangecheck(); } - const_reference operator[](size_type i) const + const_reference operator[](size_type /*i*/) const { return failed_rangecheck(); } // at() with range check - reference at(size_type i) { return failed_rangecheck(); } - const_reference at(size_type i) const { return failed_rangecheck(); } + reference at(size_type /*i*/) { return failed_rangecheck(); } + const_reference at(size_type /*i*/) const { return failed_rangecheck(); } // front() and back() reference front() @@ -250,7 +252,7 @@ namespace boost { static size_type max_size() { return 0; } enum { static_size = 0 }; - void swap (array& y) { + void swap (array& /*y*/) { } // direct access to data (read-only) diff --git a/test/array3.cpp b/test/array3.cpp index a4eac5d..b815fe7 100644 --- a/test/array3.cpp +++ b/test/array3.cpp @@ -21,7 +21,7 @@ int main() // copy and change order boost::array seasons_orig = seasons; - for (unsigned i=seasons.size()-1; i>0; --i) { + for (std::size_t i=seasons.size()-1; i>0; --i) { std::swap(seasons.at(i),seasons.at((i+1)%seasons.size())); } diff --git a/test/array5.cpp b/test/array5.cpp index d6c472a..23156b9 100644 --- a/test/array5.cpp +++ b/test/array5.cpp @@ -27,7 +27,7 @@ int main() typedef boost::array Array; // create and initialize an array - const Array a = { { 42.42 } }; + const Array a = { { 42.42f } }; // use some common STL container operations std::cout << "static_size: " << a.size() << std::endl;