forked from boostorg/array
Compare commits
10 Commits
boost-1.42
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
bcbf9de9ed | |||
069b5e2ca1 | |||
526953fc5e | |||
b06f12b0b7 | |||
f0bbb8b211 | |||
d7a5408143 | |||
564e4029d0 | |||
0dc11c2f23 | |||
7da1c4b310 | |||
8f10fdf27e |
@ -21,7 +21,7 @@ int main()
|
||||
|
||||
// copy and change order
|
||||
boost::array<std::string,4> seasons_orig = seasons;
|
||||
for (std::size_t i=seasons.size()-1; i>0; --i) {
|
||||
for (unsigned i=seasons.size()-1; i>0; --i) {
|
||||
std::swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ int main()
|
||||
typedef boost::array<float,6> Array;
|
||||
|
||||
// create and initialize an array
|
||||
const Array a = { { 42.42f } };
|
||||
const Array a = { { 42.42 } };
|
||||
|
||||
// use some common STL container operations
|
||||
std::cout << "static_size: " << a.size() << std::endl;
|
@ -24,17 +24,9 @@
|
||||
#ifndef BOOST_ARRAY_HPP
|
||||
#define BOOST_ARRAY_HPP
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
// Handles broken standard libraries better than <iterator>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
@ -139,8 +131,7 @@ namespace boost {
|
||||
|
||||
// swap (note: linear complexity)
|
||||
void swap (array<T,N>& y) {
|
||||
for (size_type i = 0; i < N; ++i)
|
||||
boost::swap(elems[i],y.elems[i]);
|
||||
std::swap_ranges(begin(),end(),y.begin());
|
||||
}
|
||||
|
||||
// direct access to data (read-only)
|
||||
@ -218,19 +209,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()
|
||||
@ -259,7 +250,7 @@ namespace boost {
|
||||
static size_type max_size() { return 0; }
|
||||
enum { static_size = 0 };
|
||||
|
||||
void swap (array<T,0>& /*y*/) {
|
||||
void swap (array<T,0>& y) {
|
||||
}
|
||||
|
||||
// direct access to data (read-only)
|
||||
@ -327,9 +318,4 @@ namespace boost {
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif /*BOOST_ARRAY_HPP*/
|
||||
|
@ -1,14 +0,0 @@
|
||||
#~ Copyright Rene Rivera 2008
|
||||
#~ Distributed under the Boost Software License, Version 1.0.
|
||||
#~ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import testing ;
|
||||
|
||||
test-suite array :
|
||||
[ run array0.cpp ]
|
||||
[ run array1.cpp ]
|
||||
[ run array2.cpp ]
|
||||
[ run array3.cpp ]
|
||||
[ run array4.cpp ]
|
||||
[ run array5.cpp ]
|
||||
;
|
Reference in New Issue
Block a user