mirror of
https://github.com/boostorg/array.git
synced 2025-06-27 13:01:43 +02:00
Compare commits
17 Commits
svn-branch
...
boost-1.40
Author | SHA1 | Date | |
---|---|---|---|
7238e9787e | |||
5661b8cd63 | |||
86b069ad0e | |||
3d20bb1310 | |||
e7122b3f20 | |||
4dd2cf1b64 | |||
2e88dc228d | |||
0a4d7e81ef | |||
96d4c5f737 | |||
5a23b06a83 | |||
e85feee293 | |||
b6522b3f60 | |||
3044ab376c | |||
69188c998f | |||
4c5212f5e4 | |||
276cd991f3 | |||
1f8298fb08 |
27
CMakeLists.txt
Normal file
27
CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#
|
||||||
|
# Copyright Troy D. Straszheim
|
||||||
|
#
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# See http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# This file was automatically generated from the original CMakeLists.txt file
|
||||||
|
# Add a variable to hold the headers for the library
|
||||||
|
set (lib_headers
|
||||||
|
array.hpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add a library target to the build system
|
||||||
|
boost_library_project(
|
||||||
|
array
|
||||||
|
# SRCDIRS
|
||||||
|
TESTDIRS test
|
||||||
|
HEADERS ${lib_headers}
|
||||||
|
# DOCDIRS
|
||||||
|
DESCRIPTION "STL compliant container wrapper for arrays of constant size."
|
||||||
|
MODULARIZED
|
||||||
|
AUTHORS "Nicolai Josuttis"
|
||||||
|
# MAINTAINERS
|
||||||
|
)
|
||||||
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
#include <boost/swap.hpp>
|
||||||
|
|
||||||
// Handles broken standard libraries better than <iterator>
|
// Handles broken standard libraries better than <iterator>
|
||||||
#include <boost/detail/iterator.hpp>
|
#include <boost/detail/iterator.hpp>
|
||||||
@ -131,7 +132,8 @@ namespace boost {
|
|||||||
|
|
||||||
// swap (note: linear complexity)
|
// swap (note: linear complexity)
|
||||||
void swap (array<T,N>& y) {
|
void swap (array<T,N>& 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)
|
// direct access to data (read-only)
|
||||||
@ -209,19 +211,19 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// operator[]
|
// operator[]
|
||||||
reference operator[](size_type i)
|
reference operator[](size_type /*i*/)
|
||||||
{
|
{
|
||||||
return failed_rangecheck();
|
return failed_rangecheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
const_reference operator[](size_type i) const
|
const_reference operator[](size_type /*i*/) const
|
||||||
{
|
{
|
||||||
return failed_rangecheck();
|
return failed_rangecheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
// at() with range check
|
// at() with range check
|
||||||
reference at(size_type i) { return failed_rangecheck(); }
|
reference at(size_type /*i*/) { return failed_rangecheck(); }
|
||||||
const_reference at(size_type i) const { return failed_rangecheck(); }
|
const_reference at(size_type /*i*/) const { return failed_rangecheck(); }
|
||||||
|
|
||||||
// front() and back()
|
// front() and back()
|
||||||
reference front()
|
reference front()
|
||||||
@ -250,7 +252,7 @@ namespace boost {
|
|||||||
static size_type max_size() { return 0; }
|
static size_type max_size() { return 0; }
|
||||||
enum { static_size = 0 };
|
enum { static_size = 0 };
|
||||||
|
|
||||||
void swap (array<T,0>& y) {
|
void swap (array<T,0>& /*y*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// direct access to data (read-only)
|
// direct access to data (read-only)
|
||||||
|
1
module.cmake
Normal file
1
module.cmake
Normal file
@ -0,0 +1 @@
|
|||||||
|
boost_module(array DEPENDS utility)
|
14
test/CMakeLists.txt
Normal file
14
test/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Copyright Troy D. Straszheim
|
||||||
|
#
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# See http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
#
|
||||||
|
boost_additional_test_dependencies(array BOOST_DEPENDS test)
|
||||||
|
|
||||||
|
boost_test_run(array0 array0.cpp)
|
||||||
|
boost_test_run(array1 array1.cpp)
|
||||||
|
boost_test_run(array2 array2.cpp)
|
||||||
|
boost_test_run(array3 array3.cpp)
|
||||||
|
boost_test_run(array4 array4.cpp)
|
||||||
|
boost_test_run(array5 array5.cpp)
|
14
test/Jamfile.v2
Normal file
14
test/Jamfile.v2
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#~ 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 ]
|
||||||
|
;
|
@ -21,7 +21,7 @@ int main()
|
|||||||
|
|
||||||
// copy and change order
|
// copy and change order
|
||||||
boost::array<std::string,4> seasons_orig = seasons;
|
boost::array<std::string,4> 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()));
|
std::swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
|
||||||
}
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ int main()
|
|||||||
typedef boost::array<float,6> Array;
|
typedef boost::array<float,6> Array;
|
||||||
|
|
||||||
// create and initialize an array
|
// create and initialize an array
|
||||||
const Array a = { { 42.42 } };
|
const Array a = { { 42.42f } };
|
||||||
|
|
||||||
// use some common STL container operations
|
// use some common STL container operations
|
||||||
std::cout << "static_size: " << a.size() << std::endl;
|
std::cout << "static_size: " << a.size() << std::endl;
|
Reference in New Issue
Block a user