Compare commits

..

4 Commits

Author SHA1 Message Date
47ef0218de Create branches/filesystem-v3 for v2 removal
[SVN r77385]
2012-03-18 20:54:17 +00:00
992299f2bf Use BOOST_ASSERT_MSG instead of naked BOOST_ASSERT
[SVN r77135]
2012-02-28 18:47:28 +00:00
e6a44cf529 Removed tabs
[SVN r70442]
2011-03-22 23:55:20 +00:00
111e93aa4c qualify array to avoid conflict with std::array; Refs #5233
[SVN r69291]
2011-02-26 01:35:48 +00:00
3 changed files with 18 additions and 19 deletions

View File

@ -118,13 +118,13 @@ namespace boost {
// operator[] // operator[]
reference operator[](size_type i) reference operator[](size_type i)
{ {
BOOST_ASSERT( i < N && "out of range" ); BOOST_ASSERT_MSG( i < N, "out of range" );
return elems[i]; return elems[i];
} }
const_reference operator[](size_type i) const const_reference operator[](size_type i) const
{ {
BOOST_ASSERT( i < N && "out of range" ); BOOST_ASSERT_MSG( i < N, "out of range" );
return elems[i]; return elems[i];
} }
@ -368,17 +368,17 @@ namespace boost {
} }
#if defined(__SUNPRO_CC) #if defined(__SUNPRO_CC)
// Trac ticket #4757; the Sun Solaris compiler can't handle // Trac ticket #4757; the Sun Solaris compiler can't handle
// syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]' // syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]'
// //
// We can't just use this for all compilers, because the // We can't just use this for all compilers, because the
// borland compilers can't handle this form. // borland compilers can't handle this form.
namespace detail { namespace detail {
template <typename T, std::size_t N> struct c_array template <typename T, std::size_t N> struct c_array
{ {
typedef T type[N]; typedef T type[N];
}; };
} }
// Specific for boost::array: simply returns its elems data member. // Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N> template <typename T, std::size_t N>
@ -408,7 +408,7 @@ namespace boost {
return arg.elems; return arg.elems;
} }
#endif #endif
#if 0 #if 0
// Overload for std::array, assuming that std::array will have // Overload for std::array, assuming that std::array will have
// explicit conversion functions as discussed at the WG21 meeting // explicit conversion functions as discussed at the WG21 meeting

View File

@ -15,12 +15,11 @@
#include <boost/array.hpp> #include <boost/array.hpp>
#include "print.hpp" #include "print.hpp"
using namespace std; using namespace std;
using namespace boost;
int main() int main()
{ {
// create and initialize array // create and initialize array
array<int,10> a = { { 1, 2, 3, 4, 5 } }; boost::array<int,10> a = { { 1, 2, 3, 4, 5 } };
print_elements(a); print_elements(a);

View File

@ -26,13 +26,13 @@ void RunTests()
test_type test_case; // = { 1, 1, 2, 3, 5 }; test_type test_case; // = { 1, 1, 2, 3, 5 };
arr &aRef = get_c_array ( test_case ); arr &aRef = get_c_array ( test_case );
if ( &*test_case.begin () != &aRef[0] ) if ( &*test_case.begin () != &aRef[0] )
fail_test ( "Array6: Same thing not equal?(1)" ); fail_test ( "Array6: Same thing not equal?(1)" );
const arr &caRef = get_c_array ( test_case ); const arr &caRef = get_c_array ( test_case );
typename test_type::const_iterator iter = test_case.begin (); typename test_type::const_iterator iter = test_case.begin ();
if ( &*iter != &caRef[0] ) if ( &*iter != &caRef[0] )
fail_test ( "Array6: Same thing not equal?(2)" ); fail_test ( "Array6: Same thing not equal?(2)" );
} }
} }