Compare commits

..

6 Commits

Author SHA1 Message Date
b2d616d789 Merge.
[SVN r43270]
2008-02-16 09:50:01 +00:00
2321b5c2fe Merge from trunk.
[SVN r43211]
2008-02-10 15:26:54 +00:00
b4b13ae470 Merge.
[SVN r43162]
2008-02-07 18:54:14 +00:00
fbde78a968 Merge.
[SVN r42905]
2008-01-21 20:15:02 +00:00
c1aea25e44 Merge from trunk, finally.
[SVN r41817]
2007-12-07 01:12:02 +00:00
b148e2fee6 Create a branch to fix links on.
[SVN r41573]
2007-12-02 10:07:42 +00:00
78 changed files with 62 additions and 74 deletions

0
doc/examples.html Normal file → Executable file
View File

0
doc/faq.html Normal file → Executable file
View File

0
doc/headers.html Normal file → Executable file
View File

0
doc/history_ack.html Normal file → Executable file
View File

2
doc/intro.html Normal file → Executable file
View File

@ -24,7 +24,7 @@
to a somewhat clumsy use of the algorithms with redundant specification to a somewhat clumsy use of the algorithms with redundant specification
of container names. Therefore we would like to raise the abstraction level of container names. Therefore we would like to raise the abstraction level
for algorithms so they specify their interface in terms of <a for algorithms so they specify their interface in terms of <a
href="range.html">Ranges</a> as much as possible. href=range.html>Ranges</a> as much as possible.
</p> </p>
<p> <p>

0
doc/portability.html Normal file → Executable file
View File

0
doc/range.html Normal file → Executable file
View File

0
doc/style.css Normal file → Executable file
View File

2
doc/style.html Normal file → Executable file
View File

@ -53,7 +53,7 @@
<a href="range.html#bidirectional_range">Bidirectional Range</a> <li> <a href="range.html#bidirectional_range">Bidirectional Range</a> <li>
<a href="range.html#random_access_range">Random Access Range</a> </ul> <a href="range.html#random_access_range">Random Access Range</a> </ul>
</ul> </ul>
Notice how we have used the categories from the <a href="../../iterator/doc/new-iter-concepts.html">new Notice how we have used the categories from the <a href=../../iterator/doc/new-iter-concepts.html>new
style iterators</a>. style iterators</a>.
<p> <p>

View File

@ -27,9 +27,9 @@
<ul> <ul>
<li> <li>
Class <a href="#iter_range"><code>iterator_range</code></a> Class <a href=#iter_range><code>iterator_range</code></a>
<li> <li>
Class <a href="#sub_range"><code>sub_range</code></a> Class <a href=#sub_range><code>sub_range</code></a>
</ul> </ul>
</ul> </ul>
@ -329,7 +329,7 @@ class can propagate constness since it knows what a corresponding
<span class=keyword>const </span><span class=identifier>value_type</span><span class=special>&amp; </span><span class=keyword>operator</span><span class=special>[]( </span><span class=identifier>difference_type </span><span class=identifier>at </span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span> <span class=keyword>const </span><span class=identifier>value_type</span><span class=special>&amp; </span><span class=keyword>operator</span><span class=special>[]( </span><span class=identifier>difference_type </span><span class=identifier>at </span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span>
<span class=keyword>public</span><span class=special>: <span class=keyword>public</span><span class=special>:
</span><span class=comment>// rest of interface inherited from <a href="#iter_range"><code>iterator_range</code></a> </span><span class=comment>// rest of interface inherited from <a href=#iter_range><code>iterator_range</code></a>
</span><span class=special>}; </span><span class=special>};
</span> </span>
<span class=special>} </span><span class=comment>// namespace 'boost'</span> <span class=special>} </span><span class=comment>// namespace 'boost'</span>

0
include/boost/range.hpp Normal file → Executable file
View File

0
include/boost/range/as_array.hpp Normal file → Executable file
View File

24
include/boost/range/as_literal.hpp Normal file → Executable file
View File

@ -8,8 +8,8 @@
// For more information, see http://www.boost.org/libs/range/ // For more information, see http://www.boost.org/libs/range/
// //
#ifndef BOOST_RANGE_AS_LITERAL_HPP #ifndef BOOST_RANGE_DETAIL_AS_LITERAL_HPP
#define BOOST_RANGE_AS_LITERAL_HPP #define BOOST_RANGE_DETAIL_AS_LITERAL_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200) #if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once # pragma once
@ -25,9 +25,7 @@
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#include <cstring> #include <cstring>
#ifndef BOOST_NO_CWCHAR
#include <cwchar> #include <cwchar>
#endif
namespace boost namespace boost
{ {
@ -38,12 +36,10 @@ namespace boost
return strlen( s ); return strlen( s );
} }
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
inline std::size_t length( const wchar_t* s ) inline std::size_t length( const wchar_t* s )
{ {
return wcslen( s ); return wcslen( s );
} }
#endif
// //
// Remark: the compiler cannot choose between T* and T[sz] // Remark: the compiler cannot choose between T* and T[sz]
@ -61,7 +57,7 @@ namespace boost
return true; return true;
} }
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
inline bool is_char_ptr( wchar_t* ) inline bool is_char_ptr( wchar_t* )
{ {
return true; return true;
@ -71,7 +67,6 @@ namespace boost
{ {
return true; return true;
} }
#endif
template< class T > template< class T >
inline long is_char_ptr( T /* r */ ) inline long is_char_ptr( T /* r */ )
@ -112,13 +107,22 @@ namespace boost
template< class Char, std::size_t sz > template< class Char, std::size_t sz >
inline iterator_range<Char*> as_literal( Char (&arr)[sz] ) inline iterator_range<Char*> as_literal( Char (&arr)[sz] )
{ {
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) ); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590
return boost::make_iterator_range<Char*>( arr, arr + sz - 1 );
#else
return boost::make_iterator_range( arr, arr + sz - 1 );
#endif
} }
template< class Char, std::size_t sz > template< class Char, std::size_t sz >
inline iterator_range<const Char*> as_literal( const Char (&arr)[sz] ) inline iterator_range<const Char*> as_literal( const Char (&arr)[sz] )
{ {
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) ); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590
return boost::make_iterator_range<const Char*>( arr, arr + sz - 1 );
#else
return boost::make_iterator_range( arr, arr + sz - 1 );
#endif
} }
} }

8
include/boost/range/begin.hpp Normal file → Executable file
View File

@ -73,15 +73,15 @@ namespace range_detail
// May this be discarded? Or is it needed for bad compilers? // May this be discarded? Or is it needed for bad compilers?
// //
template< typename T, std::size_t sz > template< typename T, std::size_t sz >
inline const T* range_begin( const T (&a)[sz] ) inline const T* range_begin( const T (&array)[sz] )
{ {
return a; return array;
} }
template< typename T, std::size_t sz > template< typename T, std::size_t sz >
inline T* range_begin( T (&a)[sz] ) inline T* range_begin( T (&array)[sz] )
{ {
return a; return array;
} }

0
include/boost/range/category.hpp Normal file → Executable file
View File

0
include/boost/range/concepts.hpp Normal file → Executable file
View File

0
include/boost/range/config.hpp Normal file → Executable file
View File

0
include/boost/range/const_iterator.hpp Normal file → Executable file
View File

0
include/boost/range/const_reverse_iterator.hpp Normal file → Executable file
View File

4
include/boost/range/detail/as_literal.hpp Normal file → Executable file
View File

@ -8,8 +8,8 @@
// For more information, see http://www.boost.org/libs/range/ // For more information, see http://www.boost.org/libs/range/
// //
#ifndef BOOST_RANGE_DETAIL_AS_LITERAL_HPP #ifndef BOOST_RANGE_AS_LITERAL_HPP
#define BOOST_RANGE_DETAIL_AS_LITERAL_HPP #define BOOST_RANGE_AS_LITERAL_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200) #if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once # pragma once

0
include/boost/range/detail/begin.hpp Normal file → Executable file
View File

0
include/boost/range/detail/collection_traits.hpp Normal file → Executable file
View File

View File

0
include/boost/range/detail/common.hpp Normal file → Executable file
View File

0
include/boost/range/detail/const_iterator.hpp Normal file → Executable file
View File

0
include/boost/range/detail/detail_str.hpp Normal file → Executable file
View File

0
include/boost/range/detail/difference_type.hpp Normal file → Executable file
View File

0
include/boost/range/detail/empty.hpp Normal file → Executable file
View File

0
include/boost/range/detail/end.hpp Normal file → Executable file
View File

0
include/boost/range/detail/implementation_help.hpp Normal file → Executable file
View File

0
include/boost/range/detail/iterator.hpp Normal file → Executable file
View File

0
include/boost/range/detail/remove_extent.hpp Normal file → Executable file
View File

0
include/boost/range/detail/sfinae.hpp Normal file → Executable file
View File

0
include/boost/range/detail/size.hpp Normal file → Executable file
View File

0
include/boost/range/detail/size_type.hpp Normal file → Executable file
View File

0
include/boost/range/detail/sizer.hpp Normal file → Executable file
View File

0
include/boost/range/detail/str_types.hpp Normal file → Executable file
View File

0
include/boost/range/detail/value_type.hpp Normal file → Executable file
View File

0
include/boost/range/detail/vc6/end.hpp Normal file → Executable file
View File

0
include/boost/range/detail/vc6/size.hpp Normal file → Executable file
View File

0
include/boost/range/difference_type.hpp Normal file → Executable file
View File

0
include/boost/range/distance.hpp Normal file → Executable file
View File

0
include/boost/range/empty.hpp Normal file → Executable file
View File

8
include/boost/range/end.hpp Normal file → Executable file
View File

@ -71,15 +71,15 @@ namespace range_detail
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
template< typename T, std::size_t sz > template< typename T, std::size_t sz >
inline const T* range_end( const T (&a)[sz] ) inline const T* range_end( const T (&array)[sz] )
{ {
return range_detail::array_end<T,sz>( a ); return range_detail::array_end<T,sz>( array );
} }
template< typename T, std::size_t sz > template< typename T, std::size_t sz >
inline T* range_end( T (&a)[sz] ) inline T* range_end( T (&array)[sz] )
{ {
return range_detail::array_end<T,sz>( a ); return range_detail::array_end<T,sz>( array );
} }
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \

0
include/boost/range/functions.hpp Normal file → Executable file
View File

0
include/boost/range/iterator.hpp Normal file → Executable file
View File

20
include/boost/range/iterator_range.hpp Normal file → Executable file
View File

@ -28,13 +28,11 @@
# endif # endif
#endif // #ifndef BOOST_OLD_IOSTREAMS #endif // #ifndef BOOST_OLD_IOSTREAMS
#include <boost/assert.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/type_traits/is_abstract.hpp>
#include <boost/range/functions.hpp> #include <boost/range/functions.hpp>
#include <boost/range/iterator.hpp> #include <boost/range/iterator.hpp>
#include <boost/range/difference_type.hpp> #include <boost/range/difference_type.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/iterator/iterator_traits.hpp>
#include <boost/assert.hpp>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
#ifndef _STLP_NO_IOSTREAMS #ifndef _STLP_NO_IOSTREAMS
@ -167,12 +165,6 @@ namespace boost
//! iterator type //! iterator type
typedef IteratorT iterator; typedef IteratorT iterator;
private: // for return value of operator()()
typedef BOOST_DEDUCED_TYPENAME
boost::mpl::if_< boost::is_abstract<value_type>,
reference, value_type >::type abstract_value_type;
public:
iterator_range() : m_Begin( iterator() ), m_End( iterator() ) iterator_range() : m_Begin( iterator() ), m_End( iterator() )
#ifndef NDEBUG #ifndef NDEBUG
, singular( true ) , singular( true )
@ -361,7 +353,7 @@ namespace boost
// fails because it returns by reference. Therefore // fails because it returns by reference. Therefore
// operator()() is provided for these cases. // operator()() is provided for these cases.
// //
abstract_value_type operator()( difference_type at ) const value_type operator()( difference_type at ) const
{ {
BOOST_ASSERT( at >= 0 && at < size() ); BOOST_ASSERT( at >= 0 && at < size() );
return m_Begin[at]; return m_Begin[at];
@ -390,15 +382,13 @@ namespace boost
bool singular; bool singular;
#endif #endif
#ifndef NDEBUG
public: public:
bool is_singular() const bool is_singular() const
{ {
#ifndef NDEBUG
return singular; return singular;
#else
return false;
#endif
} }
#endif
protected: protected:
// //

0
include/boost/range/metafunctions.hpp Normal file → Executable file
View File

0
include/boost/range/mutable_iterator.hpp Normal file → Executable file
View File

0
include/boost/range/pointer.hpp Normal file → Executable file
View File

0
include/boost/range/rbegin.hpp Normal file → Executable file
View File

0
include/boost/range/reference.hpp Normal file → Executable file
View File

0
include/boost/range/rend.hpp Normal file → Executable file
View File

0
include/boost/range/result_iterator.hpp Normal file → Executable file
View File

0
include/boost/range/reverse_iterator.hpp Normal file → Executable file
View File

0
include/boost/range/reverse_result_iterator.hpp Normal file → Executable file
View File

0
include/boost/range/size.hpp Normal file → Executable file
View File

0
include/boost/range/size_type.hpp Normal file → Executable file
View File

14
include/boost/range/sub_range.hpp Normal file → Executable file
View File

@ -23,8 +23,6 @@
#include <boost/range/size_type.hpp> #include <boost/range/size_type.hpp>
#include <boost/range/difference_type.hpp> #include <boost/range/difference_type.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost namespace boost
{ {
@ -44,12 +42,6 @@ namespace boost
typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type; typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type;
typedef BOOST_DEDUCED_TYPENAME base::reference reference; typedef BOOST_DEDUCED_TYPENAME base::reference reference;
public: // for return value of front/back
typedef BOOST_DEDUCED_TYPENAME
boost::mpl::if_< boost::is_reference<reference>,
const BOOST_DEDUCED_TYPENAME boost::remove_reference<reference>::type&,
reference >::type const_reference;
public: public:
sub_range() : base() sub_range() : base()
{ } { }
@ -120,7 +112,7 @@ namespace boost
return base::front(); return base::front();
} }
const_reference front() const const value_type& front() const
{ {
return base::front(); return base::front();
} }
@ -130,7 +122,7 @@ namespace boost
return base::back(); return base::back();
} }
const_reference back() const const value_type& back() const
{ {
return base::back(); return base::back();
} }
@ -140,7 +132,7 @@ namespace boost
return base::operator[](sz); return base::operator[](sz);
} }
const_reference operator[]( difference_type sz ) const const value_type& operator[]( difference_type sz ) const
{ {
return base::operator[](sz); return base::operator[](sz);
} }

0
include/boost/range/value_type.hpp Normal file → Executable file
View File

2
index.html Normal file → Executable file
View File

@ -22,7 +22,7 @@
</p> </p>
<p> <p>
Use, modification and distribution is subject to the Boost Software License, Version 1.0 Use, modification and distribution is subject to the Boost Software License, Version 1.0
(see <a href="http://www.boost.org/LICENSE_1_0.txt"> (see <a href=http://www.boost.org/LICENSE_1_0.txt>
http://www.boost.org/LICENSE_1_0.txt</a>). http://www.boost.org/LICENSE_1_0.txt</a>).
</p> </p>

View File

@ -14,7 +14,7 @@ rule range-test ( name : includes * )
run $(name).cpp /boost/test//boost_unit_test_framework/<link>static run $(name).cpp /boost/test//boost_unit_test_framework/<link>static
: :
: :
: <toolset>gcc:<cxxflags>"-Wall -Wunused " : $(includes)
] ; ] ;
} }

0
test/adl_conformance.cpp Normal file → Executable file
View File

0
test/adl_conformance_no_using.cpp Normal file → Executable file
View File

0
test/algorithm_example.cpp Normal file → Executable file
View File

0
test/array.cpp Normal file → Executable file
View File

0
test/compat2.cpp Normal file → Executable file
View File

0
test/compat3.cpp Normal file → Executable file
View File

0
test/const_ranges.cpp Normal file → Executable file
View File

0
test/extension_mechanism.cpp Normal file → Executable file
View File

0
test/iterator_pair.cpp Normal file → Executable file
View File

0
test/iterator_range.cpp Normal file → Executable file
View File

0
test/mfc.cpp Normal file → Executable file
View File

0
test/partial_workaround.cpp Normal file → Executable file
View File

0
test/reversible_range.cpp Normal file → Executable file
View File

0
test/std_container.cpp Normal file → Executable file
View File

34
test/string.cpp Normal file → Executable file
View File

@ -137,7 +137,14 @@ void check_char()
BOOST_CHECK_EQUAL( str_end( char_s ), str_end1 ); BOOST_CHECK_EQUAL( str_end( char_s ), str_end1 );
BOOST_CHECK_EQUAL( str_empty( char_s ), (char_s == 0 || char_s[0] == char()) ); BOOST_CHECK_EQUAL( str_empty( char_s ), (char_s == 0 || char_s[0] == char()) );
BOOST_CHECK_EQUAL( sz, std::char_traits<char>::length( char_s ) ); BOOST_CHECK_EQUAL( sz, std::char_traits<char>::length( char_s ) );
/*
BOOST_CHECK_EQUAL( str_begin( char_s2 ), char_s2 );
std::size_t sz2 = size( char_s2 );
const char* str_end12 = str_begin( char_s2 ) + sz;
BOOST_CHECK_EQUAL( str_end( char_s2 ), str_end12 );
BOOST_CHECK_EQUAL( empty( char_s2 ), (char_s2 == 0 || char_s2[0] == char()) );
BOOST_CHECK_EQUAL( sz2, std::char_traits<char>::length( char_s2 ) );
*/
BOOST_CHECK_EQUAL( str_begin( my_string ), my_string ); BOOST_CHECK_EQUAL( str_begin( my_string ), my_string );
range_iterator<char_array_t>::type str_end2 = str_begin( my_string ) + str_size(my_string); range_iterator<char_array_t>::type str_end2 = str_begin( my_string ) + str_size(my_string);
range_iterator<char_array_t>::type str_end3 = str_end(my_string); range_iterator<char_array_t>::type str_end3 = str_end(my_string);
@ -158,20 +165,6 @@ void check_char()
BOOST_CHECK( find_const( as_array( my_string ), to_search ) != str_end(my_string) ); BOOST_CHECK( find_const( as_array( my_string ), to_search ) != str_end(my_string) );
BOOST_CHECK( find_const( as_array( my_const_string ), to_search ) != str_end(my_string) ); BOOST_CHECK( find_const( as_array( my_const_string ), to_search ) != str_end(my_string) );
//
// Test that as_literal() always scan for null terminator
//
char an_array[] = "foo\0bar";
BOOST_CHECK_EQUAL( str_begin( an_array ), an_array );
BOOST_CHECK_EQUAL( str_end( an_array ), an_array + 3 );
BOOST_CHECK_EQUAL( str_size( an_array ), 3 );
const char a_const_array[] = "foobar\0doh";
BOOST_CHECK_EQUAL( str_begin( a_const_array ), a_const_array );
BOOST_CHECK_EQUAL( str_end( a_const_array ), a_const_array + 6 );
BOOST_CHECK_EQUAL( str_size( a_const_array ), 6 );
} }
@ -179,6 +172,9 @@ void check_char()
void check_string() void check_string()
{ {
check_char(); check_char();
// check_char<volatile char>();
// check_char<const char>();
// check_char<const volatile char>();
#ifndef BOOST_NO_STD_WSTRING #ifndef BOOST_NO_STD_WSTRING
typedef wchar_t* wchar_iterator_t; typedef wchar_t* wchar_iterator_t;
@ -201,7 +197,13 @@ void check_string()
BOOST_CHECK_EQUAL( str_end(char_ws), (str_begin( char_ws ) + sz) ); BOOST_CHECK_EQUAL( str_end(char_ws), (str_begin( char_ws ) + sz) );
BOOST_CHECK_EQUAL( str_empty( char_ws ), (char_ws == 0 || char_ws[0] == wchar_t()) ); BOOST_CHECK_EQUAL( str_empty( char_ws ), (char_ws == 0 || char_ws[0] == wchar_t()) );
BOOST_CHECK_EQUAL( sz, std::char_traits<wchar_t>::length( char_ws ) ); BOOST_CHECK_EQUAL( sz, std::char_traits<wchar_t>::length( char_ws ) );
/*
std::size_t sz2 = size( char_ws2 );
BOOST_CHECK_EQUAL( str_begin( char_ws2 ), char_ws2 );
BOOST_CHECK_EQUAL( str_end( char_ws2 ), (begin( char_ws2 ) + sz2) );
BOOST_CHECK_EQUAL( empty( char_ws2 ), (char_ws2 == 0 || char_ws2[0] == wchar_t()) );
BOOST_CHECK_EQUAL( sz2, std::char_traits<wchar_t>::length( char_ws2 ) );
*/
wchar_t to_search = L'n'; wchar_t to_search = L'n';
BOOST_CHECK( find( char_ws, to_search ) != str_end(char_ws) ); BOOST_CHECK( find( char_ws, to_search ) != str_end(char_ws) );

0
test/sub_range.cpp Normal file → Executable file
View File