Compare commits

..

3 Commits

Author SHA1 Message Date
ecfb5d1a45 really screwy merge trancking behavior, starting over
[SVN r44394]
2008-04-14 05:45:24 +00:00
ccdabc52a2 Merged revisions 44111-44378 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r44114 | emildotchevski | 2008-04-08 14:29:37 -0700 (Tue, 08 Apr 2008) | 1 line
  
  fixed compile errors, removed tabs as required.
........
  r44118 | djowel | 2008-04-08 18:29:12 -0700 (Tue, 08 Apr 2008) | 7 lines
  
  In preparation for spirit2:
  * flat includes
  * home directory
  * forwarding headers
  * classic spirit
........
  r44119 | djowel | 2008-04-08 18:51:47 -0700 (Tue, 08 Apr 2008) | 7 lines
  
  In preparation for spirit2:
  * flat includes
  * home directory
  * forwarding headers
  * classic spirit
........
  r44120 | hkaiser | 2008-04-08 19:17:53 -0700 (Tue, 08 Apr 2008) | 1 line
  
  Fixed one more include path
........
  r44121 | johnmaddock | 2008-04-09 04:34:20 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Run config_info and config_test in both single and multi-thread modes.
........
  r44122 | johnmaddock | 2008-04-09 04:34:45 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Run config_info and config_test in both single and multi-thread modes.
........
  r44123 | johnmaddock | 2008-04-09 04:35:36 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Added needed #includes.
........
  r44124 | johnmaddock | 2008-04-09 04:45:15 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Added improved SVG support.
........
  r44125 | hkaiser | 2008-04-09 06:50:03 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Fixed #pragma message directives and a couple of forwarding headers.
........
  r44126 | johnmaddock | 2008-04-09 08:21:03 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Fix bug report #1797.
........
  r44127 | johnmaddock | 2008-04-09 08:31:33 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Update for bug report #1790.
........
  r44128 | johnmaddock | 2008-04-09 08:32:08 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Fix for bug #1790.
........
  r44130 | danieljames | 2008-04-09 10:26:31 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Fix a typo.
........
  r44131 | danieljames | 2008-04-09 10:27:08 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Rebuild the function types documentation.
........
  r44132 | pdimov | 2008-04-09 10:49:20 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Proper try_lock semantics.
........
  r44134 | emildotchevski | 2008-04-09 11:48:39 -0700 (Wed, 09 Apr 2008) | 1 line
  
  missing include
........
  r44136 | anthonyw | 2008-04-09 12:33:06 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Added test for trac ticket #1803: condition_variable::notify_one may fail to wake a waiting thread on win32
........
  r44137 | pdimov | 2008-04-09 12:58:54 -0700 (Wed, 09 Apr 2008) | 1 line
  
  sp_counted_base_spin.hpp added, enabled by BOOST_SP_USE_SPINLOCK.
........
  r44138 | pdimov | 2008-04-09 14:08:39 -0700 (Wed, 09 Apr 2008) | 1 line
  
  spinlock_gcc_arm.hpp added.
........
  r44139 | grafik | 2008-04-09 14:20:28 -0700 (Wed, 09 Apr 2008) | 1 line
  
  Add ARM architecture/instrustion-set.
........
  r44140 | pdimov | 2008-04-09 16:19:22 -0700 (Wed, 09 Apr 2008) | 1 line
  
  ARM assembly fix.
........
  r44145 | johnmaddock | 2008-04-10 05:46:41 -0700 (Thu, 10 Apr 2008) | 2 lines
  
  Doh! Changes to code should actually compile!
  A fix for the last change.
........
  r44146 | anthonyw | 2008-04-10 06:14:43 -0700 (Thu, 10 Apr 2008) | 1 line
  
  fix for notify problem in trac ticket #1803
........
  r44147 | anthonyw | 2008-04-10 06:27:44 -0700 (Thu, 10 Apr 2008) | 1 line
  
  fix for trac ticket #1804
........
  r44148 | anthonyw | 2008-04-10 06:35:07 -0700 (Thu, 10 Apr 2008) | 1 line
  
  Added native_handle to thread on posix platforms
........
  r44149 | anthonyw | 2008-04-10 07:07:39 -0700 (Thu, 10 Apr 2008) | 1 line
  
  added overloads of timed_lock_shared with a relative timeout to shared_mutex
........
  r44150 | anthonyw | 2008-04-10 07:15:26 -0700 (Thu, 10 Apr 2008) | 1 line
  
  added tests for plain timed_lock on shared_mutex
........
  r44151 | daniel_frey | 2008-04-10 07:38:14 -0700 (Thu, 10 Apr 2008) | 1 line
  
  Added test and fix for "convertible to bool" requirement
........
  r44152 | anthonyw | 2008-04-10 08:52:01 -0700 (Thu, 10 Apr 2008) | 1 line
  
  Added native_handle to condition_variable on pthreads
........
  r44153 | anthonyw | 2008-04-10 11:34:42 -0700 (Thu, 10 Apr 2008) | 1 line
  
  Updated thread.hpp as catch-all header
........
  r44160 | dgregor | 2008-04-10 14:05:14 -0700 (Thu, 10 Apr 2008) | 1 line
  
  Refactor mpi_datatype_cache to fix problems on VC9
........
  r44161 | danieljames | 2008-04-10 14:06:48 -0700 (Thu, 10 Apr 2008) | 2 lines
  
  Try to fix Herve's name in a couple of places.
........
  r44163 | djowel | 2008-04-10 16:51:31 -0700 (Thu, 10 Apr 2008) | 1 line
  
  moving stuff to classic spirit
........
  r44164 | emildotchevski | 2008-04-10 20:51:06 -0700 (Thu, 10 Apr 2008) | 1 line
  
  to_string fixes
........
  r44165 | grafik | 2008-04-10 22:34:00 -0700 (Thu, 10 Apr 2008) | 1 line
  
  Use local sorted() function to support Python < 2.4.
........
  r44166 | grafik | 2008-04-10 22:36:28 -0700 (Thu, 10 Apr 2008) | 1 line
  
  Add support for toolset requirements at the definition level.
........
  r44167 | grafik | 2008-04-11 00:50:47 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Initial support for cross-compiling to ARM architecture.
........
  r44168 | anthonyw | 2008-04-11 01:52:09 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Added test and fix for win32 condition_variable broadcast bug similar to #1803
........
  r44169 | johnmaddock | 2008-04-11 01:53:54 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Fix doc typo from issue #1794.
........
  r44170 | johnmaddock | 2008-04-11 02:21:08 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Beefed up pthreads test cases.
........
  r44171 | johnmaddock | 2008-04-11 02:22:31 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Hopefully fix gcc/solaris single threading mode.
........
  r44172 | jurko | 2008-04-11 03:51:43 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Comment typo correction.
........
  r44175 | dgregor | 2008-04-11 08:39:41 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Fix some header-inclusion and header-ordering issues to get the MPI library compiling again.
........
  r44186 | johnmaddock | 2008-04-11 10:54:47 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Disable long double tests on unsupported platforms.
........
  r44187 | johnmaddock | 2008-04-11 10:57:58 -0700 (Fri, 11 Apr 2008) | 1 line
  
  We don't need duplicate using declarations.
........
  r44188 | johnmaddock | 2008-04-11 11:08:59 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Update error levels for real_concept tests.
........
  r44189 | johnmaddock | 2008-04-11 11:12:02 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Update tolerance used for skewness test.
........
  r44190 | hkaiser | 2008-04-11 11:19:46 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Fixed reference to Spirit classic test suite
........
  r44192 | emildotchevski | 2008-04-11 11:34:46 -0700 (Fri, 11 Apr 2008) | 1 line
  
  to_string adjustments
........
  r44195 | jurko | 2008-04-11 14:03:06 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Implemented a patch contributed by Igor Nazarenko reimplementing the list_sort() function to use a C qsort() function instead of a hand-crafted merge-sort algorithm. Makes some list sortings (e.g. 1,2,1,2,1,2,1,2,...) extremely faster, in turn significantly speeding up some project builds.
........
  r44196 | hkaiser | 2008-04-11 15:01:55 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Changed SpiritV1 header files to have a classic_ prefix
........
  r44197 | hkaiser | 2008-04-11 15:05:25 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Renamed a SpiritV1 header file I missed before
........
  r44198 | hkaiser | 2008-04-11 19:35:34 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Renamed PhoenixV1 files.
........
  r44203 | hkaiser | 2008-04-11 20:00:17 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Fixed an ambiguity.
........
  r44206 | hkaiser | 2008-04-11 20:02:34 -0700 (Fri, 11 Apr 2008) | 1 line
  
  Fixed more SpiritV1 header references after renaming
........
  r44246 | emildotchevski | 2008-04-11 20:27:57 -0700 (Fri, 11 Apr 2008) | 1 line
  
  removed tabs. what's wrong with tabs anyway?
........
  r44342 | emildotchevski | 2008-04-11 23:08:10 -0700 (Fri, 11 Apr 2008) | 1 line
  
  documentation cleanup
........
  r44343 | speedsnail | 2008-04-12 04:02:35 -0700 (Sat, 12 Apr 2008) | 2 lines
  
  Fixed a bug in for seldom used argument <property:/property-name/> in rule format-name.
  Added /property-name/ may be a regex.
........
  r44344 | pdimov | 2008-04-12 07:27:22 -0700 (Sat, 12 Apr 2008) | 1 line
  
  shared_ptr::lock no longer requires exceptions.
........
  r44346 | johnmaddock | 2008-04-12 09:01:16 -0700 (Sat, 12 Apr 2008) | 1 line
  
  Remove references to Boost.Test from the config_test target.
........
  r44347 | johnmaddock | 2008-04-12 09:02:24 -0700 (Sat, 12 Apr 2008) | 1 line
  
  When -lrt is needed, it's needed in *both* single and multi-threaded builds.
........
  r44350 | johnmaddock | 2008-04-12 09:27:11 -0700 (Sat, 12 Apr 2008) | 2 lines
  
  Add non central distro's to fwd.hpp.
  Added needed #include to bessel_ik.hpp.
........
  r44351 | johnmaddock | 2008-04-12 09:28:57 -0700 (Sat, 12 Apr 2008) | 3 lines
  
  Fix declaration order in dist_nc_beta_incl_test.cpp test.
  Fix long long usage in sf_modf_incl_test.cpp.
  Adjust failure rates in test_zeta.cpp to cope with HP aCC and 128-bit long doubles.
........
  r44352 | johnmaddock | 2008-04-12 09:42:28 -0700 (Sat, 12 Apr 2008) | 1 line
  
  Remove test row that causes problems for VC-7.1 due to a compiler bug.
........
  r44353 | pdimov | 2008-04-12 11:22:18 -0700 (Sat, 12 Apr 2008) | 1 line
  
  sp_accept_owner added.
........
  r44354 | grafik | 2008-04-12 12:44:47 -0700 (Sat, 12 Apr 2008) | 1 line
  
  Add multiple requirements for toolset subconditions instead of one composite as they are not supported for conditional requirements. Thanks to Roland for finding the problem.
........
  r44355 | hkaiser | 2008-04-12 16:58:29 -0700 (Sat, 12 Apr 2008) | 1 line
  
  Changed copyright, started to apply changes for switching namespaces.
........
  r44356 | djowel | 2008-04-12 17:15:11 -0700 (Sat, 12 Apr 2008) | 1 line
  
  added flat forwarding headers
........
  r44357 | djowel | 2008-04-12 17:39:00 -0700 (Sat, 12 Apr 2008) | 1 line
  
  added flat forwarding headers
........
  r44358 | djowel | 2008-04-12 17:54:10 -0700 (Sat, 12 Apr 2008) | 1 line
  
  adding spirit2
........
  r44359 | djowel | 2008-04-12 18:52:31 -0700 (Sat, 12 Apr 2008) | 1 line
  
  spirit2 ! :)
........
  r44360 | djowel | 2008-04-12 20:02:30 -0700 (Sat, 12 Apr 2008) | 1 line
  
  spirit2 ! :)
........
  r44361 | djowel | 2008-04-12 20:17:57 -0700 (Sat, 12 Apr 2008) | 1 line
  
  spirit2 ! :)
........
  r44367 | andreas_huber69 | 2008-04-13 06:57:42 -0700 (Sun, 13 Apr 2008) | 1 line
  
  Changed the PingPong example to demonstrate how the inner workings of an asynchronous_state_machine<> subclass can be hidden.
........
  r44369 | pdimov | 2008-04-13 08:35:40 -0700 (Sun, 13 Apr 2008) | 1 line
  
  Honor BOOST_DISABLE_THREADS; route GCC/ARM to the spinlock implementation; fall back to the spinlock implementation instead of using pthread_mutex.
........
  r44370 | anthonyw | 2008-04-13 08:50:08 -0700 (Sun, 13 Apr 2008) | 1 line
  
  Added extended adopt/defer/try constructors to upgrade_lock
........
  r44371 | hkaiser | 2008-04-13 09:28:27 -0700 (Sun, 13 Apr 2008) | 1 line
  
  Fixed Spirit Classic namespace switching.
........
  r44372 | emildotchevski | 2008-04-13 10:07:26 -0700 (Sun, 13 Apr 2008) | 1 line
  
  minor compile error fix
........
  r44374 | hkaiser | 2008-04-13 15:00:04 -0700 (Sun, 13 Apr 2008) | 1 line
  
  Added SpiritV2 test suite to regression tests.
........
  r44376 | grafik | 2008-04-13 15:12:12 -0700 (Sun, 13 Apr 2008) | 1 line
  
  Move array test into canonical test subdir structure.
........
  r44377 | grafik | 2008-04-13 15:24:41 -0700 (Sun, 13 Apr 2008) | 1 line
  
  Move crc test into canonical test subdir structure.
........


[SVN r44393]
2008-04-14 05:18:26 +00:00
55ec1cb631 post-review proto version
[SVN r44061]
2008-04-05 18:00:00 +00:00
7 changed files with 25 additions and 209 deletions

View File

@ -13,11 +13,6 @@
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* 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
* Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow)
* 10 Mar 2010 - added workaround for SUNCC and !STLPort [trac #3893] (Marshall Clow)
* 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis)
* 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
* 05 Aug 2001 - minor update (Nico Josuttis)
@ -29,19 +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
# pragma warning(disable:4510) // boost::array<T,N>' : default constructor could not be generated
# pragma warning(disable:4610) // warning C4610: class 'boost::array<T,N>' can never be instantiated - user defined constructor required
#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>
@ -70,13 +55,10 @@ namespace boost {
typedef std::ptrdiff_t difference_type;
// iterator support
iterator begin() { return elems; }
const_iterator begin() const { return elems; }
const_iterator cbegin() const { return elems; }
iterator end() { return elems+N; }
const_iterator end() const { return elems+N; }
const_iterator cend() const { return elems+N; }
iterator begin() { return elems; }
const_iterator begin() const { return elems; }
iterator end() { return elems+N; }
const_iterator end() const { return elems+N; }
// reverse iterator support
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
@ -88,11 +70,6 @@ namespace boost {
reference, iterator, reference> > reverse_iterator;
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
const_reference, iterator, reference> > const_reverse_iterator;
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
value_type, reference, iterator, difference_type> reverse_iterator;
typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
#else
// workaround for broken reverse_iterator implementations
typedef std::reverse_iterator<iterator,T> reverse_iterator;
@ -103,28 +80,21 @@ namespace boost {
const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
}
const_reverse_iterator crbegin() const {
return const_reverse_iterator(end());
}
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
const_reverse_iterator crend() const {
return const_reverse_iterator(begin());
}
// operator[]
reference operator[](size_type i)
{
BOOST_ASSERT_MSG( i < N, "out of range" );
BOOST_ASSERT( i < N && "out of range" );
return elems[i];
}
const_reference operator[](size_type i) const
{
BOOST_ASSERT_MSG( i < N, "out of range" );
BOOST_ASSERT( i < N && "out of range" );
return elems[i];
}
@ -161,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)
@ -180,8 +149,7 @@ namespace boost {
}
// assign one value to all elements
void assign (const T& value) { fill ( value ); } // A synonym for fill
void fill (const T& value)
void assign (const T& value)
{
std::fill_n(begin(),size(),value);
}
@ -189,8 +157,7 @@ namespace boost {
// check range (may be private because it is static)
static void rangecheck (size_type i) {
if (i >= size()) {
std::out_of_range e("array<>: index out of range");
boost::throw_exception(e);
throw std::out_of_range("array<>: index out of range");
}
}
@ -211,13 +178,10 @@ namespace boost {
typedef std::ptrdiff_t difference_type;
// iterator support
iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); }
const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
const_iterator cbegin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
iterator end() { return begin(); }
const_iterator end() const { return begin(); }
const_iterator cend() const { return cbegin(); }
iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); }
const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
iterator end() { return begin(); }
const_iterator end() const { return begin(); }
// reverse iterator support
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
@ -229,11 +193,6 @@ namespace boost {
reference, iterator, reference> > reverse_iterator;
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
const_reference, iterator, reference> > const_reverse_iterator;
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
value_type, reference, iterator, difference_type> reverse_iterator;
typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
#else
// workaround for broken reverse_iterator implementations
typedef std::reverse_iterator<iterator,T> reverse_iterator;
@ -244,32 +203,25 @@ namespace boost {
const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
}
const_reverse_iterator crbegin() const {
return const_reverse_iterator(end());
}
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
const_reverse_iterator crend() const {
return const_reverse_iterator(begin());
}
// 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()
@ -298,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)
@ -315,14 +267,12 @@ namespace boost {
}
// assign one value to all elements
void assign (const T& value) { fill ( value ); }
void fill (const T& ) {}
void assign (const T& ) { }
// check range (may be private because it is static)
static reference failed_rangecheck () {
std::out_of_range e("attempt to access element of an empty array");
boost::throw_exception(e);
#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__))
//
// We need to return something here to keep
// some compilers happy: however we will never
@ -330,7 +280,6 @@ namespace boost {
//
static T placeholder;
return placeholder;
#endif
}
};
#endif
@ -367,71 +316,6 @@ namespace boost {
x.swap(y);
}
#if defined(__SUNPRO_CC)
// Trac ticket #4757; the Sun Solaris compiler can't handle
// syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]'
//
// We can't just use this for all compilers, because the
// borland compilers can't handle this form.
namespace detail {
template <typename T, std::size_t N> struct c_array
{
typedef T type[N];
};
}
// Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N>
typename detail::c_array<T,N>::type& get_c_array(boost::array<T,N>& arg)
{
return arg.elems;
}
// Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N>
typename const detail::c_array<T,N>::type& get_c_array(const boost::array<T,N>& arg)
{
return arg.elems;
}
#else
// Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N>
T(&get_c_array(boost::array<T,N>& arg))[N]
{
return arg.elems;
}
// Const version.
template <typename T, std::size_t N>
const T(&get_c_array(const boost::array<T,N>& arg))[N]
{
return arg.elems;
}
#endif
#if 0
// Overload for std::array, assuming that std::array will have
// explicit conversion functions as discussed at the WG21 meeting
// in Summit, March 2009.
template <typename T, std::size_t N>
T(&get_c_array(std::array<T,N>& arg))[N]
{
return static_cast<T(&)[N]>(arg);
}
// Const version.
template <typename T, std::size_t N>
const T(&get_c_array(const std::array<T,N>& arg))[N]
{
return static_cast<T(&)[N]>(arg);
}
#endif
} /* namespace boost */
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(pop)
#endif
#endif /*BOOST_ARRAY_HPP*/

View File

@ -11,5 +11,4 @@ test-suite array :
[ run array3.cpp ]
[ run array4.cpp ]
[ run array5.cpp ]
[ run array6.cpp ]
;

View File

@ -32,7 +32,7 @@ void RunTests()
test_type test_case = {};
const boost::array< T, 0 > const_test_case = test_type();
test_case.fill ( T() );
test_case.assign( T() );
// front/back and operator[] must compile, but calling them is undefined
// Likewise, all tests below should evaluate to false, avoiding undefined behaviour
@ -56,15 +56,9 @@ void RunTests()
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" );
@ -79,10 +73,8 @@ void RunTests()
// 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 > );
std::for_each( test_case.cbegin(), test_case.cend(), BadValue< T > );
std::for_each( const_test_case.begin(), const_test_case.end(), BadValue< T > );
std::for_each( const_test_case.rbegin(), const_test_case.rend(), BadValue< T > );
std::for_each( const_test_case.cbegin(), const_test_case.cend(), BadValue< T > );
// Check swap is well formed
std::swap( test_case, test_case );

View File

@ -5,21 +5,17 @@
* http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef _SCL_SECURE_NO_WARNINGS
// Suppress warnings from the std lib:
# define _SCL_SECURE_NO_WARNINGS
#endif
#include <algorithm>
#include <functional>
#include <boost/array.hpp>
#include "print.hpp"
using namespace std;
using namespace boost;
int main()
{
// create and initialize array
boost::array<int,10> a = { { 1, 2, 3, 4, 5 } };
array<int,10> a = { { 1, 2, 3, 4, 5 } };
print_elements(a);

View File

@ -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()));
}
@ -39,13 +39,6 @@ int main()
=seasons.rbegin(); pos<seasons.rend(); ++pos) {
std::cout << " " << *pos;
}
// try constant reverse iterators
std::cout << "reverse: ";
for (boost::array<std::string,4>::const_reverse_iterator pos
=seasons.crbegin(); pos<seasons.crend(); ++pos) {
std::cout << " " << *pos;
}
std::cout << std::endl;
return 0; // makes Visual-C++ compiler happy

View File

@ -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;

View File

@ -1,48 +0,0 @@
/* tests for using class array<> specialization for size 0
* (C) Copyright Alisdair Meredith 2006.
* 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>
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 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;
}