Compare commits

..

37 Commits

Author SHA1 Message Date
Beman Dawes 55d9023d91 Branch for 2nd try at V2 removal
[SVN r77497]
2012-03-23 12:04:44 +00:00
Marshall Clow 992299f2bf Use BOOST_ASSERT_MSG instead of naked BOOST_ASSERT
[SVN r77135]
2012-02-28 18:47:28 +00:00
Marshall Clow e6a44cf529 Removed tabs
[SVN r70442]
2011-03-22 23:55:20 +00:00
Marshall Clow 111e93aa4c qualify array to avoid conflict with std::array; Refs #5233
[SVN r69291]
2011-02-26 01:35:48 +00:00
Bryce Adelstein-Lelbach 5072c551ec Pathscale-4.0 configuration code/workarounds.
[SVN r68142]
2011-01-14 02:59:34 +00:00
Marshall Clow 97e912e82e Added crbegin and crend to Boost.Array; refs #4761. Will close ticket when merged to release branch
[SVN r67481]
2010-12-28 19:14:23 +00:00
Marshall Clow 05aa660128 Added cbegin and cend to Boost.Array; refs #4761. Will close ticket when merged to release branch
[SVN r67478]
2010-12-28 18:39:14 +00:00
Marshall Clow 7256882760 Fix? for borland
[SVN r66781]
2010-11-26 20:16:34 +00:00
Marshall Clow 5329bd6f1c Slight tweak of get_c_array
[SVN r66712]
2010-11-24 16:13:12 +00:00
Marshall Clow 80fa50df2e SunPro workaround; references #4757
[SVN r66651]
2010-11-20 00:48:33 +00:00
Marshall Clow 6fbc8ee741 Added a test for 'get_c_array'
[SVN r66294]
2010-10-31 02:25:04 +00:00
Marshall Clow 38217688e1 Fix elems for Sun compilers
[SVN r66154]
2010-10-23 19:11:16 +00:00
Marshall Clow 2595eda739 Removed tabs
[SVN r62803]
2010-06-11 14:46:31 +00:00
Marshall Clow 64e5394540 Added get_c_array to Boost.Array
[SVN r62487]
2010-06-06 16:05:13 +00:00
Marshall Clow c37498364e Detab array.hpp
[SVN r61415]
2010-04-19 21:41:21 +00:00
Marshall Clow 5e81100035 Added support for SunCC and 'fill' operation; tickets #3893 and #3168 respectively
[SVN r60436]
2010-03-10 18:03:30 +00:00
Marshall Clow 79cadb97d7 Changed exception throwing to use boost::throw_exception
[SVN r60417]
2010-03-10 14:23:49 +00:00
Marshall Clow 9609395af0 Applied patches to fix #2886
[SVN r59476]
2010-02-04 18:22:13 +00:00
John Maddock fb72e72640 MSVC warning suppression - fixes #3599.
[SVN r59439]
2010-02-03 12:10:56 +00:00
Troy D. Straszheim e875287d55 rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
Troy D. Straszheim 100b5d687b Copyrights on CMakeLists.txt to keep them from clogging up the inspect
reports.  This is essentially the same commit as r55095 on the release
branch.



[SVN r55159]
2009-07-26 00:49:56 +00:00
Thorsten Jørgen Ottosen 7fb9412ea8 removed warning on vc++ for using std::equal
[SVN r54541]
2009-06-30 20:04:45 +00:00
Steven Watanabe 471bc9bf06 Supress warnings in array
[SVN r53105]
2009-05-19 03:00:53 +00:00
Steven Watanabe 9cf5e0c9a1 Use boost::swap instead of std::swap_ranges to enable ADL. Fixes #2753.
[SVN r53104]
2009-05-19 02:37:04 +00:00
Michael A. Jackson d2910e195a Updating dependency information for modularized libraries.
[SVN r49628]
2008-11-07 17:05:27 +00:00
Michael A. Jackson b3ace9fb6e Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use.
[SVN r49627]
2008-11-07 17:02:56 +00:00
Michael A. Jackson a6b531b5b1 Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor
[SVN r49510]
2008-11-01 13:15:41 +00:00
Rene Rivera 9804292dad Move array test into canonical test subdir structure.
[SVN r44376]
2008-04-13 22:12:12 +00:00
Beman Dawes 069b5e2ca1 Throw out_of_range rather than range_error. See 21.1.1 paragraph 13.
[SVN r36304]
2006-12-08 16:54:30 +00:00
Beman Dawes 526953fc5e Test for out_of_range rather than range_error. See 21.1.1 paragraph 13.
[SVN r36303]
2006-12-08 16:53:49 +00:00
Andreas Huber b06f12b0b7 Fixed license & copyright issues.
[SVN r36224]
2006-12-01 10:29:49 +00:00
Beman Dawes f0bbb8b211 Add copyright, license
[SVN r35905]
2006-11-07 19:11:57 +00:00
Gennaro Prota d7a5408143 http://www.josuttis.com/ hasn't the latest version any more
[SVN r34855]
2006-08-08 18:49:30 +00:00
John Maddock 564e4029d0 Simplified code.
[SVN r34384]
2006-06-24 11:31:19 +00:00
John Maddock 0dc11c2f23 Fix compiler errors resulting from missing return values.
[SVN r34259]
2006-06-09 11:40:07 +00:00
Alisdair Meredith 7da1c4b310 Remove size zero support for old compilers that do not support partial template specialization
[SVN r34161]
2006-06-04 11:01:59 +00:00
Alisdair Meredith 8f10fdf27e Support for zero length arrays
[SVN r34154]
2006-06-03 12:51:13 +00:00
6 changed files with 70 additions and 99 deletions
-5
View File
@@ -70,11 +70,6 @@
Technical Report, which will extend the C++ Standard (see
<ulink url="http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1548.htm">http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1548.htm</ulink>).</para>
<para>Update: <code>std::array</code> is (as of C++11) part of the C++ standard.
The differences between <code>boost::array</code> and <code>std::array</code> are minimal.
If you are using C++11, you should consider using <code>std::array</code> instead of <code>boost::array</code>.
</para>
<para>Class <code><classname>array</classname></code> fulfills most
but not all of the requirements of "reversible containers" (see
Section 23.1, [lib.container.requirements] of the C++
-9
View File
@@ -13,7 +13,6 @@
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* 14 Apr 2012 - (mtc) Added support for boost::hash
* 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility.
* 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group.
* See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
@@ -47,7 +46,6 @@
// Handles broken standard libraries better than <iterator>
#include <boost/detail/iterator.hpp>
#include <boost/throw_exception.hpp>
#include <boost/functional/hash_fwd.hpp>
#include <algorithm>
// FIXES for broken compilers
@@ -429,13 +427,6 @@ namespace boost {
}
#endif
template<class T, std::size_t N>
std::size_t hash_value(const array<T,N>& arr)
{
return boost::hash_range(arr.begin(), arr.end());
}
} /* namespace boost */
+2 -8
View File
@@ -4,18 +4,12 @@
import testing ;
alias unit_test_framework
: # sources
/boost//unit_test_framework
;
test-suite array :
[ run array0.cpp unit_test_framework : : : : array0 ]
[ run array0.cpp ]
[ run array1.cpp ]
[ run array2.cpp ]
[ run array3.cpp ]
[ run array4.cpp ]
[ run array5.cpp ]
[ run array6.cpp unit_test_framework : : : : array6 ]
[ run array_hash.cpp unit_test_framework : : : : array_hash ]
[ run array6.cpp ]
;
+42 -16
View File
@@ -9,15 +9,18 @@
#include <iostream>
#include <boost/array.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
namespace {
unsigned int failed_tests = 0;
void fail_test( const char * reason ) {
++failed_tests;
std::cerr << "Test failure " << failed_tests << ": " << reason << std::endl;
}
template< class T >
void BadValue( const T & )
{
BOOST_CHECK ( false );
fail_test( "Unexpected value" );
}
template< class T >
@@ -33,24 +36,46 @@ void RunTests()
// front/back and operator[] must compile, but calling them is undefined
// Likewise, all tests below should evaluate to false, avoiding undefined behaviour
BOOST_CHECK ( test_case.empty());
BOOST_CHECK ( const_test_case.empty());
if( !test_case.empty() ) {
BadValue( test_case.front() );
}
BOOST_CHECK ( test_case.size() == 0 );
BOOST_CHECK ( const_test_case.size() == 0 );
if( !const_test_case.empty() ) {
BadValue( const_test_case.back() );
}
if( test_case.size() > 0 ) {
BadValue( test_case[ 0 ] );
}
if( const_test_case.max_size() > 0 ) {
BadValue( const_test_case[ 0 ] );
}
// Assert requirements of TR1 6.2.2.4
BOOST_CHECK ( test_case.begin() == test_case.end());
BOOST_CHECK ( test_case.cbegin() == test_case.cend());
BOOST_CHECK ( const_test_case.begin() == const_test_case.end());
BOOST_CHECK ( const_test_case.cbegin() == const_test_case.cend());
if( test_case.begin() != test_case.end() ) {
fail_test( "Not an empty range" );
}
if( test_case.cbegin() != test_case.cend() ) {
fail_test( "Not an empty range" );
}
if( const_test_case.begin() != const_test_case.end() ) {
fail_test( "Not an empty range" );
}
if( const_test_case.cbegin() != const_test_case.cend() ) {
fail_test( "Not an empty range" );
}
if( test_case.begin() == const_test_case.begin() ) {
fail_test( "iterators for different containers are not distinct" );
}
BOOST_CHECK ( test_case.begin() != const_test_case.begin() );
if( test_case.data() == const_test_case.data() ) {
// Value of data is unspecified in TR1, so no requirement this test pass or fail
// However, it must compile!
}
// Check can safely use all iterator types with std algorithms
std::for_each( test_case.begin(), test_case.end(), BadValue< T > );
std::for_each( test_case.rbegin(), test_case.rend(), BadValue< T > );
@@ -62,12 +87,12 @@ void RunTests()
// Check swap is well formed
std::swap( test_case, test_case );
// Check assignment operator and overloads are well formed
// Check assigment operator and overloads are well formed
test_case = const_test_case;
// Confirm at() throws the std lib defined exception
try {
BadValue( test_case.at( 0 ));
BadValue( test_case.at( 0 ) );
} catch ( const std::out_of_range & ) {
}
@@ -79,11 +104,12 @@ void RunTests()
}
BOOST_AUTO_TEST_CASE( test_main )
int main()
{
RunTests< bool >();
RunTests< void * >();
RunTests< long double >();
RunTests< std::string >();
return failed_tests;
}
+26 -18
View File
@@ -10,31 +10,39 @@
#include <boost/array.hpp>
#include <algorithm>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
namespace {
template< class T >
void RunTests()
{
typedef boost::array< T, 5 > test_type;
typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 };
arr &aRef = get_c_array ( test_case );
BOOST_CHECK ( &*test_case.begin () == &aRef[0] );
const arr &caRef = get_c_array ( test_case );
typename test_type::const_iterator iter = test_case.begin ();
BOOST_CHECK ( &*iter == &caRef[0] );
}
unsigned int failed_tests = 0;
void fail_test( const char * reason ) {
++failed_tests;
std::cerr << "Test failure " << failed_tests << ": " << reason << std::endl;
}
BOOST_AUTO_TEST_CASE( test_main )
template< class T >
void RunTests()
{
typedef boost::array< T, 5 > test_type;
typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 };
arr &aRef = get_c_array ( test_case );
if ( &*test_case.begin () != &aRef[0] )
fail_test ( "Array6: Same thing not equal?(1)" );
const arr &caRef = get_c_array ( test_case );
typename test_type::const_iterator iter = test_case.begin ();
if ( &*iter != &caRef[0] )
fail_test ( "Array6: Same thing not equal?(2)" );
}
}
int main()
{
RunTests< bool >();
RunTests< void * >();
RunTests< long double >();
RunTests< std::string >();
return failed_tests;
}
-43
View File
@@ -1,43 +0,0 @@
/* tests for using boost::hash with boost::array
* (C) Copyright Marshall Clow 2012
* 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)
*/
#include <string>
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
#include <boost/functional/hash.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
namespace {
template< class T >
void RunTests()
{
// std::size_t hash0 = boost::hash<boost::array<T,0> > () ( boost::array<T, 0> ());
// std::size_t hash1 = boost::hash<boost::array<T,1> > () ( boost::array<T, 1> ());
typedef boost::array< T, 5 > barr;
typedef T arr[5];
barr test_barr = {{ 1, 1, 2, 3, 5 }};
arr test_arr = { 1, 1, 2, 3, 5 };
std::size_t bhash = boost::hash<barr> () ( test_barr );
std::size_t ahash = boost::hash<arr> () ( test_arr );
BOOST_CHECK ( ahash == bhash );
}
}
BOOST_AUTO_TEST_CASE( test_main )
{
RunTests< int >();
RunTests< long >();
RunTests< long double >();
}