From 8e715b38104379ede1f1877fa2bc56a46fc8cd2b Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 21 Mar 2006 02:26:31 +0000 Subject: [PATCH 01/73] This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'. [SVN r33417] From ee024f588b7e26e9be15861be74ddb87cda61c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 11 Apr 2006 20:12:31 +0000 Subject: [PATCH 02/73] applied borland patch [SVN r33670] --- include/boost/range/iterator_range.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/range/iterator_range.hpp b/include/boost/range/iterator_range.hpp index b29df15..bd77ffa 100755 --- a/include/boost/range/iterator_range.hpp +++ b/include/boost/range/iterator_range.hpp @@ -261,8 +261,12 @@ namespace boost { if( singular ) return 0; - + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) + return std::distance( m_Begin, m_End ); +#else return std::distance( m_Begin, m_End ); +#endif } bool empty() const From 12cf02586c1144b200a527964e39899eb17e6252 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 26 Aug 2006 14:28:38 +0000 Subject: [PATCH 03/73] Remove tabs [SVN r34957] --- test/iterator_range.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/iterator_range.cpp b/test/iterator_range.cpp index 20696aa..7e036ab 100755 --- a/test/iterator_range.cpp +++ b/test/iterator_range.cpp @@ -26,7 +26,7 @@ using namespace boost; using namespace std; - + void check_reference_type(); void check_iterator_range() @@ -94,7 +94,7 @@ void check_iterator_range() rrr = make_iterator_range( rrr, -1, 1 ); BOOST_CHECK( rrr == str ); - check_reference_type(); + check_reference_type(); } @@ -124,10 +124,10 @@ int test_iter_range( Container& a_cont ) typedef BOOST_DEDUCED_TYPENAME range_result_iterator::type citer_type; typedef iterator_range riter_type; riter_type a_riter( make_iterator_range( a_cont ) ); - a_riter.front(); - a_riter.back(); - int i = a_riter[0]; - return i; + a_riter.front(); + a_riter.back(); + int i = a_riter[0]; + return i; } From e46eae81444a85496079887af935bfe96a64dc0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 24 Oct 2006 10:37:46 +0000 Subject: [PATCH 04/73] *** empty log message *** [SVN r35717] --- include/boost/range/detail/implementation_help.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/range/detail/implementation_help.hpp b/include/boost/range/detail/implementation_help.hpp index 77cc8cc..11c6612 100755 --- a/include/boost/range/detail/implementation_help.hpp +++ b/include/boost/range/detail/implementation_help.hpp @@ -43,7 +43,7 @@ namespace boost #else inline const wchar_t* str_end( const wchar_t* s, const wchar_t* ) { - if( s == 0 && s[0] == 0 ) + if( s == 0 || s[0] == 0 ) return s; while( *++s != 0 ) ; From 3bd0d886c42c118e991f50af209ddcbbc6167e5b Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 6 Nov 2006 17:10:46 +0000 Subject: [PATCH 05/73] Remove obsolete Boost.Build v1 files. [SVN r35880] --- test/Jamfile | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100755 test/Jamfile diff --git a/test/Jamfile b/test/Jamfile deleted file mode 100755 index 4a8ef6d..0000000 --- a/test/Jamfile +++ /dev/null @@ -1,41 +0,0 @@ -# Boost.Range library -# -# Copyright Thorsten Ottosen 2003-2004. Use, modification and -# distribution is subject to 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) -# -# For more information, see http://www.boost.org/libs/range/ -# - -subproject libs/range/test ; - -import testing ; - -rule range-test ( name : includes * ) -{ - return [ - run $(name).cpp - ../../test/build/boost_unit_test_framework - : - : - : $(BOOST_ROOT) - $(includes) - ] ; -} - -test-suite range : - [ range-test array ] - [ range-test iterator_pair ] - [ range-test std_container ] - [ range-test string ] - [ range-test iterator_range ] - [ range-test sub_range ] - [ range-test partial_workaround ] - [ range-test algorithm_example ] - [ range-test reversible_range ] - [ range-test const_ranges ] - [ range-test extension_mechanism ] -# [ range-test mfc : $(VC71_ROOT)/atlmfc/include ] - ; - From 523f8a59269adaf57feb1ddb8dfd48c4f1e97d9b Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Fri, 10 Nov 2006 19:59:52 +0000 Subject: [PATCH 06/73] Merge from HEAD. Allow building of shared versions of some Boost.Test libraries. Adjust tests to use always use static linking to Boost.Test, since linking to the shared version requires test changes. Patch from Juergen Hunold. [SVN r35990] --- test/Jamfile.v2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index fcc67f2..b6942ca 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -11,7 +11,7 @@ rule range-test ( name : includes * ) { return [ - run $(name).cpp /boost/test//boost_unit_test_framework + run $(name).cpp /boost/test//boost_unit_test_framework/static : : : $(includes) From 33c8f3e3ecf577a342e4f7821db058380764f4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Wed, 22 Nov 2006 22:27:28 +0000 Subject: [PATCH 07/73] *** empty log message *** [SVN r36155] --- test/TODO | 1 - test/compat1.cpp | 0 test/extension_mechanism.cpp | 2 +- 3 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 test/TODO delete mode 100755 test/compat1.cpp diff --git a/test/TODO b/test/TODO deleted file mode 100644 index 8b13789..0000000 --- a/test/TODO +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/compat1.cpp b/test/compat1.cpp deleted file mode 100755 index e69de29..0000000 diff --git a/test/extension_mechanism.cpp b/test/extension_mechanism.cpp index 0a272c3..d355e4e 100755 --- a/test/extension_mechanism.cpp +++ b/test/extension_mechanism.cpp @@ -69,7 +69,7 @@ namespace Foo } - inline X::iterator boost_range_end( X& x ) + inline X::iterator boost_range_end( X& x ) { return x.vec.end(); } From 21b558fe5e71622affbe507f7113101bea807bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Wed, 22 Nov 2006 22:33:09 +0000 Subject: [PATCH 08/73] license info [SVN r36156] --- doc/boost_range.html | 2 +- doc/example.cpp | 7 +++++++ doc/examples.html | 2 +- doc/faq.html | 2 +- doc/headers.html | 2 +- doc/history_ack.html | 2 +- doc/intro.html | 2 +- doc/portability.html | 2 +- doc/range.html | 2 +- doc/style.css | 7 +++++++ doc/style.html | 2 +- doc/utility_class.html | 2 +- 12 files changed, 24 insertions(+), 10 deletions(-) diff --git a/doc/boost_range.html b/doc/boost_range.html index 303f9d6..16ef3f3 100644 --- a/doc/boost_range.html +++ b/doc/boost_range.html @@ -727,7 +727,7 @@ class=identifier>T&

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0.



diff --git a/doc/example.cpp b/doc/example.cpp index afe448f..a45bbcc 100644 --- a/doc/example.cpp +++ b/doc/example.cpp @@ -1,3 +1,10 @@ +/* +// Copyright Thorsten Ottosen 2003-2005. Use, modification and +// distribution is subject to 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 #include // for std::iterator_traits, std::distance() diff --git a/doc/examples.html b/doc/examples.html index 6db7253..b0e4973 100755 --- a/doc/examples.html +++ b/doc/examples.html @@ -47,7 +47,7 @@

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0.


diff --git a/doc/faq.html b/doc/faq.html index 34304ef..614725a 100755 --- a/doc/faq.html +++ b/doc/faq.html @@ -116,7 +116,7 @@ Cool indeed!

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0.


diff --git a/doc/headers.html b/doc/headers.html index f8b12a3..4d320a1 100755 --- a/doc/headers.html +++ b/doc/headers.html @@ -154,7 +154,7 @@

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0.


diff --git a/doc/history_ack.html b/doc/history_ack.html index 40ee5dc..ec3d887 100755 --- a/doc/history_ack.html +++ b/doc/history_ack.html @@ -61,7 +61,7 @@ C++ standard:

- (C) Copyright Thorsten Ottosen 2003-2006 + (C) Copyright Thorsten Ottosen 2003-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0.


diff --git a/doc/intro.html b/doc/intro.html index 444b4ca..a2a6701 100755 --- a/doc/intro.html +++ b/doc/intro.html @@ -146,7 +146,7 @@ Notice that we have to

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0.


diff --git a/doc/portability.html b/doc/portability.html index ae3a264..2461222 100755 --- a/doc/portability.html +++ b/doc/portability.html @@ -75,7 +75,7 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0.


diff --git a/doc/range.html b/doc/range.html index 03a773d..0fe4c88 100755 --- a/doc/range.html +++ b/doc/range.html @@ -530,7 +530,7 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator Copyright © 2004 - Thorsten Ottosen. + Thorsten Ottosen. Use, modification and distribution is subject to the Boost Software License, Version 1.0.
diff --git a/doc/style.css b/doc/style.css index 1890b52..227040a 100755 --- a/doc/style.css +++ b/doc/style.css @@ -1,3 +1,10 @@ +/* +#// Copyright Thorsten Ottosen 2003-2005. Use, modification and +#// distribution is subject to 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) +*/ + pre{ BORDER-RIGHT: gray 1pt solid; PADDING-RIGHT: 2pt; diff --git a/doc/style.html b/doc/style.html index 9a5617e..76a63f1 100755 --- a/doc/style.html +++ b/doc/style.html @@ -104,7 +104,7 @@

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0.


diff --git a/doc/utility_class.html b/doc/utility_class.html index 33c95ae..6dfa78b 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -352,7 +352,7 @@ store the result

- (C) Copyright Thorsten Ottosen 2003-2004 + (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0.


From fd448ffa316baf94e0622afcf8882b6d6b4b1b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Wed, 28 Feb 2007 22:27:50 +0000 Subject: [PATCH 09/73] removed invalid test [SVN r37117] --- test/sub_range.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/test/sub_range.cpp b/test/sub_range.cpp index 0b28fc1..f590b53 100755 --- a/test/sub_range.cpp +++ b/test/sub_range.cpp @@ -90,17 +90,6 @@ void check_sub_range() s.empty(); r.size(); s.size(); - - irange singular_irange; - BOOST_CHECK( singular_irange.empty() ); - BOOST_CHECK( singular_irange.size() == 0 ); - - srange singular_srange; - BOOST_CHECK( singular_srange.empty() ); - BOOST_CHECK( singular_srange.size() == 0 ); - - BOOST_CHECK( empty( singular_irange ) ); - BOOST_CHECK( empty( singular_srange ) ); srange rr = make_iterator_range( str ); BOOST_CHECK( rr.equal( r ) ); From c54e15d3740e2c745502a7b997e52da9d75c73e1 Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 24 Jul 2007 19:28:14 +0000 Subject: [PATCH 10/73] This commit was manufactured by cvs2svn to create tag 'Version_1_34_1'. [SVN r38286] From 25e932149c792b3a95991f7b8f442108c8d162b8 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Fri, 5 Oct 2007 14:25:06 +0000 Subject: [PATCH 11/73] Starting point for releases [SVN r39706] From 901266b76a05b0afd8e2bd461febbac797a7d1d9 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:07:19 +0000 Subject: [PATCH 12/73] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41369] --- include/boost/range/as_array.hpp | 45 + include/boost/range/as_literal.hpp | 131 +++ include/boost/range/atl.hpp | 733 +++++++++++++ include/boost/range/begin.hpp | 105 +- include/boost/range/category.hpp | 29 + include/boost/range/concepts.hpp | 45 +- include/boost/range/config.hpp | 3 +- include/boost/range/const_iterator.hpp | 65 +- .../boost/range/const_reverse_iterator.hpp | 17 +- include/boost/range/detail/as_literal.hpp | 33 + include/boost/range/detail/begin.hpp | 49 +- include/boost/range/detail/common.hpp | 1 + include/boost/range/detail/const_iterator.hpp | 52 - include/boost/range/detail/detail_str.hpp | 376 +++++++ include/boost/range/detail/end.hpp | 71 +- .../range/detail/implementation_help.hpp | 71 +- include/boost/range/detail/iterator.hpp | 52 +- include/boost/range/detail/mfc/carray.hpp | 97 -- include/boost/range/detail/mfc/cstring.hpp | 92 -- include/boost/range/detail/microsoft.hpp | 931 +++++++++++++++++ include/boost/range/detail/size_type.hpp | 50 +- include/boost/range/detail/str_types.hpp | 38 + include/boost/range/detail/value_type.hpp | 50 - include/boost/range/difference_type.hpp | 124 +-- include/boost/range/distance.hpp | 34 + include/boost/range/empty.hpp | 43 +- include/boost/range/end.hpp | 104 +- include/boost/range/functions.hpp | 4 +- include/boost/range/iterator.hpp | 140 +-- include/boost/range/iterator_range.hpp | 205 ++-- include/boost/range/metafunctions.hpp | 10 +- include/boost/range/mfc.hpp | 984 ++++++++++++++++++ include/boost/range/mutable_iterator.hpp | 64 ++ include/boost/range/pointer.hpp | 29 + include/boost/range/rbegin.hpp | 19 +- include/boost/range/reference.hpp | 29 + include/boost/range/rend.hpp | 19 +- include/boost/range/result_iterator.hpp | 20 +- .../boost/range/reverse_result_iterator.hpp | 17 +- include/boost/range/size.hpp | 109 +- include/boost/range/size_type.hpp | 178 +--- include/boost/range/sub_range.hpp | 51 +- include/boost/range/value_type.hpp | 124 +-- 43 files changed, 3818 insertions(+), 1625 deletions(-) create mode 100755 include/boost/range/as_array.hpp create mode 100755 include/boost/range/as_literal.hpp create mode 100644 include/boost/range/atl.hpp create mode 100755 include/boost/range/category.hpp create mode 100755 include/boost/range/detail/as_literal.hpp create mode 100755 include/boost/range/detail/detail_str.hpp delete mode 100755 include/boost/range/detail/mfc/carray.hpp delete mode 100755 include/boost/range/detail/mfc/cstring.hpp create mode 100644 include/boost/range/detail/microsoft.hpp create mode 100755 include/boost/range/detail/str_types.hpp create mode 100755 include/boost/range/distance.hpp create mode 100644 include/boost/range/mfc.hpp create mode 100755 include/boost/range/mutable_iterator.hpp create mode 100755 include/boost/range/pointer.hpp create mode 100755 include/boost/range/reference.hpp diff --git a/include/boost/range/as_array.hpp b/include/boost/range/as_array.hpp new file mode 100755 index 0000000..0723e60 --- /dev/null +++ b/include/boost/range/as_array.hpp @@ -0,0 +1,45 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2006. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_AS_ARRAY_HPP +#define BOOST_RANGE_AS_ARRAY_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include + +namespace boost +{ + + template< class R > + inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > + as_array( R& r ) + { + return boost::make_iterator_range( r ); + } + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + + template< class Range > + inline boost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > + as_array( const Range& r ) + { + return boost::make_iterator_range( r ); + } + +#endif + +} + +#endif + diff --git a/include/boost/range/as_literal.hpp b/include/boost/range/as_literal.hpp new file mode 100755 index 0000000..72f0eb5 --- /dev/null +++ b/include/boost/range/as_literal.hpp @@ -0,0 +1,131 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2006. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_AS_LITERAL_HPP +#define BOOST_RANGE_DETAIL_AS_LITERAL_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#if BOOST_NO_FUNCTION_TEMPLATE_ORDERING +#include +#else + +#include +#include + +#include + +#include +#include + +namespace boost +{ + namespace range_detail + { + inline std::size_t length( const char* s ) + { + return strlen( s ); + } + + inline std::size_t length( const wchar_t* s ) + { + return wcslen( s ); + } + + // + // Remark: the compiler cannot choose between T* and T[sz] + // overloads, so we must put the T* internal to the + // unconstrained version. + // + + inline bool is_char_ptr( char* ) + { + return true; + } + + inline bool is_char_ptr( const char* ) + { + return true; + } + + + inline bool is_char_ptr( wchar_t* ) + { + return true; + } + + inline bool is_char_ptr( const wchar_t* ) + { + return true; + } + + template< class T > + inline long is_char_ptr( T /* r */ ) + { + return 0L; + } + + template< class T > + inline iterator_range + make_range( T* const r, bool ) + { + return iterator_range( r, r + length(r) ); + } + + template< class T > + inline iterator_range::type> + make_range( T& r, long ) + { + return boost::make_iterator_range( r ); + } + + } + + template< class Range > + inline iterator_range::type> + as_literal( Range& r ) + { + return range_detail::make_range( r, range_detail::is_char_ptr(r) ); + } + + template< class Range > + inline iterator_range::type> + as_literal( const Range& r ) + { + return range_detail::make_range( r, range_detail::is_char_ptr(r) ); + } + + template< class Char, std::size_t sz > + inline iterator_range as_literal( Char (&arr)[sz] ) + { +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590 + return boost::make_iterator_range( arr, arr + sz - 1 ); +#else + return boost::make_iterator_range( arr, arr + sz - 1 ); +#endif + } + + + template< class Char, std::size_t sz > + inline iterator_range as_literal( const Char (&arr)[sz] ) + { +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590 + return boost::make_iterator_range( arr, arr + sz - 1 ); +#else + return boost::make_iterator_range( arr, arr + sz - 1 ); +#endif + } +} + +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#endif diff --git a/include/boost/range/atl.hpp b/include/boost/range/atl.hpp new file mode 100644 index 0000000..ab492d9 --- /dev/null +++ b/include/boost/range/atl.hpp @@ -0,0 +1,733 @@ +#ifndef BOOST_RANGE_ATL_HPP +#define BOOST_RANGE_ATL_HPP + + + + +// Boost.Range ATL Extension +// +// Copyright Shunsuke Sogame 2005-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) + + + + +// config +// + + +#include // _ATL_VER + + +#if !defined(BOOST_RANGE_ATL_NO_COLLECTIONS) + #if (_ATL_VER < 0x0700) + #define BOOST_RANGE_ATL_NO_COLLECTIONS + #endif +#endif + + +#if !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + #if (_ATL_VER < 0x0700) // dubious + #define BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX + #endif +#endif + + +#if !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLESTRING) + #if (_MSC_VER < 1310) // from , but dubious + #define BOOST_RANGE_ATL_HAS_OLD_CSIMPLESTRING + #endif +#endif + + + + +// forward declarations +// + + +#include // IID + + +namespace ATL { + + +#if !defined(BOOST_RANGE_ATL_NO_COLLECTIONS) + + + // arrays + // + template< class E, class ETraits > + class CAtlArray; + + template< class E > + class CAutoPtrArray; + + template< class I, const IID *piid > + class CInterfaceArray; + + + // lists + // + template< class E, class ETraits > + class CAtlList; + + template< class E > + class CAutoPtrList; + + template< class E, class Allocator > + class CHeapPtrList; + + template< class I, const IID *piid > + class CInterfaceList; + + + // maps + // + template< class K, class V, class KTraits, class VTraits > + class CAtlMap; + + template< class K, class V, class KTraits, class VTraits > + class CRBTree; + + template< class K, class V, class KTraits, class VTraits > + class CRBMap; + + template< class K, class V, class KTraits, class VTraits > + class CRBMultiMap; + + + // strings + // +#if !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLESTRING) + template< class BaseType, bool t_bMFCDLL > + class CSimpleStringT; +#else + template< class BaseType > + class CSimpleStringT; +#endif + + template< class BaseType, class StringTraits > + class CStringT; + + template< class StringType, int t_nChars > + class CFixedStringT; + + template< class BaseType, const int t_nSize > + class CStaticString; + + +#endif // !defined(BOOST_RANGE_ATL_NO_COLLECTIONS) + + + // simples + // +#if !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + + template< class T, class TEqual > + class CSimpleArray; + + template< class TKey, class TVal, class TEqual > + class CSimpleMap; + +#else + + template< class T > + class CSimpleArray; + + template< class T > + class CSimpleValArray; + + template< class TKey, class TVal > + class CSimpleMap; + +#endif // !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + + + // pointers + // + template< class E > + class CAutoPtr; + + template< class T > + class CComPtr; + + template< class T, const IID *piid > + class CComQIPtr; + + template< class E, class Allocator > + class CHeapPtr; + + template< class T > + class CAdapt; + + +} // namespace ATL + + + + +// indirect_iterator customizations +// + + +#include +#include + + +namespace boost { + + + template< class E > + struct pointee< ATL::CAutoPtr > : + mpl::identity + { }; + + template< class T > + struct pointee< ATL::CComPtr > : + mpl::identity + { }; + + template< class T, const IID *piid > + struct pointee< ATL::CComQIPtr > : + mpl::identity + { }; + + template< class E, class Allocator > + struct pointee< ATL::CHeapPtr > : + mpl::identity + { }; + + template< class T > + struct pointee< ATL::CAdapt > : + pointee + { }; + + +} // namespace boost + + + + +// extended customizations +// + + +#include +#include +#include +#include +#include // CComBSTR + + +namespace boost { namespace range_detail_microsoft { + + +#if !defined(BOOST_RANGE_ATL_NO_COLLECTIONS) + + + // arrays + // + + struct atl_array_functions : + array_functions + { + template< class Iterator, class X > + Iterator end(X& x) // redefine + { + return x.GetData() + x.GetCount(); // no 'GetSize()' + } + }; + + + template< class E, class ETraits > + struct customization< ATL::CAtlArray > : + atl_array_functions + { + template< class X > + struct meta + { + typedef E val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + + template< class E > + struct customization< ATL::CAutoPtrArray > : + atl_array_functions + { + template< class X > + struct meta + { + // ATL::CAutoPtr/CHeapPtr is no assignable. + typedef ATL::CAutoPtr val_t; + typedef val_t *miter_t; + typedef val_t const *citer_t; + + typedef indirect_iterator mutable_iterator; + typedef indirect_iterator const_iterator; + }; + }; + + + template< class I, const IID *piid > + struct customization< ATL::CInterfaceArray > : + atl_array_functions + { + template< class X > + struct meta + { + typedef ATL::CComQIPtr val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + + template< class E, class ETraits > + struct customization< ATL::CAtlList > : + list_functions + { + template< class X > + struct meta + { + typedef E val_t; + + typedef list_iterator mutable_iterator; + typedef list_iterator const_iterator; + }; + }; + + + struct indirected_list_functions + { + template< class Iterator, class X > + Iterator begin(X& x) + { + typedef typename Iterator::base_type base_t; // == list_iterator + return Iterator(base_t(x, x.GetHeadPosition())); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + typedef typename Iterator::base_type base_t; + return Iterator(base_t(x, POSITION(0))); + } + }; + + + template< class E > + struct customization< ATL::CAutoPtrList > : + indirected_list_functions + { + template< class X > + struct meta + { + typedef ATL::CAutoPtr val_t; + typedef list_iterator miter_t; + typedef list_iterator citer_t; + + typedef indirect_iterator mutable_iterator; + typedef indirect_iterator const_iterator; + }; + }; + + + template< class E, class Allocator > + struct customization< ATL::CHeapPtrList > : + indirected_list_functions + { + template< class X > + struct meta + { + typedef ATL::CHeapPtr val_t; + typedef list_iterator miter_t; + typedef list_iterator citer_t; + + typedef indirect_iterator mutable_iterator; + typedef indirect_iterator const_iterator; + }; + }; + + + template< class I, const IID *piid > + struct customization< ATL::CInterfaceList > : + list_functions + { + template< class X > + struct meta + { + typedef ATL::CComQIPtr val_t; + + typedef list_iterator mutable_iterator; + typedef list_iterator const_iterator; + }; + }; + + + // maps + // + + struct atl_rb_tree_tag + { }; + + template< > + struct customization< atl_rb_tree_tag > : + indirected_list_functions + { + template< class X > + struct meta + { + typedef typename X::CPair val_t; + + typedef list_iterator miter_t; + typedef list_iterator citer_t; + + typedef indirect_iterator mutable_iterator; + typedef indirect_iterator const_iterator; + }; + }; + + + template< class K, class V, class KTraits, class VTraits > + struct customization< ATL::CAtlMap > : + customization< atl_rb_tree_tag > + { + template< class Iterator, class X > + Iterator begin(X& x) // redefine + { + typedef typename Iterator::base_type base_t; // == list_iterator + return Iterator(base_t(x, x.GetStartPosition())); // no 'GetHeadPosition' + } + }; + + + // strings + // + + struct atl_string_tag + { }; + + template< > + struct customization< atl_string_tag > + { + template< class X > + struct meta + { + typedef typename X::PXSTR mutable_iterator; + typedef typename X::PCXSTR const_iterator; + }; + + template< class Iterator, class X > + typename mutable_::type begin(X& x) + { + return x.GetBuffer(0); + } + + template< class Iterator, class X > + Iterator begin(X const& x) + { + return x.GetString(); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return begin(x) + x.GetLength(); + } + }; + + + template< class BaseType, const int t_nSize > + struct customization< ATL::CStaticString > + { + template< class X > + struct meta + { + typedef BaseType const *mutable_iterator; + typedef mutable_iterator const_iterator; + }; + + template< class Iterator, class X > + Iterator begin(X const& x) + { + return x; + } + + template< class Iterator, class X > + Iterator end(X const& x) + { + return begin(x) + X::GetLength(); + } + }; + + +#endif // !defined(BOOST_RANGE_ATL_NO_COLLECTIONS) + + + template< > + struct customization< ATL::CComBSTR > + { + template< class X > + struct meta + { + typedef OLECHAR *mutable_iterator; + typedef OLECHAR const *const_iterator; + }; + + template< class Iterator, class X > + Iterator begin(X& x) + { + return x.operator BSTR(); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return begin(x) + x.Length(); + } + }; + + + // simples + // + +#if !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + template< class T, class TEqual > + struct customization< ATL::CSimpleArray > : +#else + template< class T > + struct customization< ATL::CSimpleArray > : +#endif + array_functions + { + template< class X > + struct meta + { + typedef T val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + +#if defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + + template< class T > + struct customization< ATL::CSimpleValArray > : + array_functions + { + template< class X > + struct meta + { + typedef T val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + +#endif // defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + + +#if !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + template< class TKey, class TVal, class TEqual > + struct customization< ATL::CSimpleMap > +#else + template< class TKey, class TVal > + struct customization< ATL::CSimpleMap > +#endif + { + template< class X > + struct meta + { + typedef TKey k_val_t; + typedef k_val_t *k_miter_t; + typedef k_val_t const *k_citer_t; + + typedef TVal v_val_t; + typedef v_val_t *v_miter_t; + typedef v_val_t const *v_citer_t; + + // Topic: + // 'std::pair' can't contain references + // because of reference to reference problem. + + typedef zip_iterator< tuple > mutable_iterator; + typedef zip_iterator< tuple > const_iterator; + }; + + template< class Iterator, class X > + Iterator begin(X& x) + { + return Iterator(boost::make_tuple(x.m_aKey, x.m_aVal)); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return Iterator(boost::make_tuple(x.m_aKey + x.GetSize(), x.m_aVal + x.GetSize())); + } + }; + + +} } // namespace boost::range_detail_microsoft + + + + +// range customizations +// + + +#if !defined(BOOST_RANGE_ATL_NO_COLLECTIONS) + + + // arrays + // + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CAtlArray, 2 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CAutoPtrArray, 1 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CInterfaceArray, (class)(const IID *) + ) + + + // lists + // + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CAtlList, 2 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CAutoPtrList, 1 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CHeapPtrList, 2 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CInterfaceList, (class)(const IID *) + ) + + + //maps + // + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CAtlMap, 4 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::atl_rb_tree_tag, + (ATL, BOOST_PP_NIL), CRBTree, 4 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::atl_rb_tree_tag, + (ATL, BOOST_PP_NIL), CRBMap, 4 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::atl_rb_tree_tag, + (ATL, BOOST_PP_NIL), CRBMultiMap, 4 + ) + + + // strings + // + #if !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLESTRING) + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::atl_string_tag, + (ATL, BOOST_PP_NIL), CSimpleStringT, (class)(bool) + ) + #else + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::atl_string_tag, + (ATL, BOOST_PP_NIL), CSimpleStringT, 1 + ) + #endif + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::atl_string_tag, + (ATL, BOOST_PP_NIL), CStringT, 2 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::atl_string_tag, + (ATL, BOOST_PP_NIL), CFixedStringT, (class)(int) + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CStaticString, (class)(const int) + ) + + +#endif // !defined(BOOST_RANGE_ATL_NO_COLLECTIONS) + + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CComBSTR +) + + +// simples +// +#if !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CSimpleArray, 2 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CSimpleMap, 3 + ) + +#else + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CSimpleArray, 1 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CSimpleMap, 2 + ) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + (ATL, BOOST_PP_NIL), CSimpleValArray, 1 + ) + +#endif // !defined(BOOST_RANGE_ATL_HAS_OLD_CSIMPLE_XXX) + + + + +#endif diff --git a/include/boost/range/begin.hpp b/include/boost/range/begin.hpp index d16ce1e..9abf313 100755 --- a/include/boost/range/begin.hpp +++ b/include/boost/range/begin.hpp @@ -15,7 +15,6 @@ # pragma once #endif -#include #include #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING @@ -23,7 +22,6 @@ #else #include -#include namespace boost { @@ -40,17 +38,14 @@ namespace range_detail ////////////////////////////////////////////////////////////////////// template< typename C > - inline BOOST_DEDUCED_TYPENAME range_const_iterator::type - boost_range_begin( const C& c ) - { - return c.begin(); - } - - template< typename C > - inline BOOST_DEDUCED_TYPENAME range_iterator< - typename remove_const::type >::type - boost_range_begin( C& c ) + inline BOOST_DEDUCED_TYPENAME range_iterator::type + range_begin( C& c ) { + // + // If you get a compile-error here, it is most likely because + // you have not implemented range_begin() properly in + // the namespace of C + // return c.begin(); } @@ -59,13 +54,13 @@ namespace range_detail ////////////////////////////////////////////////////////////////////// template< typename Iterator > - inline Iterator boost_range_begin( const std::pair& p ) + inline Iterator range_begin( const std::pair& p ) { return p.first; } template< typename Iterator > - inline Iterator boost_range_begin( std::pair& p ) + inline Iterator range_begin( std::pair& p ) { return p.first; } @@ -74,66 +69,22 @@ namespace range_detail // array ////////////////////////////////////////////////////////////////////// + // + // May this be discarded? Or is it needed for bad compilers? + // template< typename T, std::size_t sz > - inline const T* boost_range_begin( const T (&array)[sz] ) + inline const T* range_begin( const T (&array)[sz] ) { return array; } template< typename T, std::size_t sz > - inline T* boost_range_begin( T (&array)[sz] ) + inline T* range_begin( T (&array)[sz] ) { return array; } - ////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////// - -#if 1 || BOOST_WORKAROUND(__MWERKS__, <= 0x3204 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -// CW up to 9.3 and borland have troubles with function ordering - inline const char* boost_range_begin( const char* s ) - { - return s; - } - - inline char* boost_range_begin( char* s ) - { - return s; - } - - inline const wchar_t* boost_range_begin( const wchar_t* s ) - { - return s; - } - - inline wchar_t* boost_range_begin( wchar_t* s ) - { - return s; - } -#else - inline const char* boost_range_begin( const char*& s ) - { - return s; - } - - inline char* boost_range_begin( char*& s ) - { - return s; - } - - inline const wchar_t* boost_range_begin( const wchar_t*& s ) - { - return s; - } - - inline wchar_t* boost_range_begin( wchar_t*& s ) - { - return s; - } -#endif - #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ !BOOST_WORKAROUND(__GNUC__, < 3) \ /**/ @@ -142,44 +93,27 @@ namespace range_detail template< class T > -inline BOOST_DEDUCED_TYPENAME range_iterator< - typename remove_const::type >::type begin( T& r ) +inline BOOST_DEDUCED_TYPENAME range_iterator::type begin( T& r ) { #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ !BOOST_WORKAROUND(__GNUC__, < 3) \ /**/ using namespace range_detail; #endif - return boost_range_begin( r ); + return range_begin( r ); } template< class T > -inline BOOST_DEDUCED_TYPENAME range_const_iterator::type begin( const T& r ) +inline BOOST_DEDUCED_TYPENAME range_iterator::type begin( const T& r ) { #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ !BOOST_WORKAROUND(__GNUC__, < 3) \ /**/ using namespace range_detail; #endif - return boost_range_begin( r ); + return range_begin( r ); } -#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -// BCB and CW are not able to overload pointer when class overloads are also available. -template<> -inline range_const_iterator::type begin( const char*& r ) -{ - return r; -} - -template<> -inline range_const_iterator::type begin( const wchar_t*& r ) -{ - return r; -} - -#endif - } // namespace boost #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING @@ -187,7 +121,7 @@ inline range_const_iterator::type begin( const w namespace boost { template< class T > - inline BOOST_DEDUCED_TYPENAME range_const_iterator::type + inline BOOST_DEDUCED_TYPENAME range_iterator::type const_begin( const T& r ) { return boost::begin( r ); @@ -195,3 +129,4 @@ namespace boost } #endif + diff --git a/include/boost/range/category.hpp b/include/boost/range/category.hpp new file mode 100755 index 0000000..1574605 --- /dev/null +++ b/include/boost/range/category.hpp @@ -0,0 +1,29 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2006. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_CATEGORY_HPP +#define BOOST_RANGE_CATEGORY_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + template< class T > + struct range_category : iterator_category< typename range_iterator::type > + { }; +} + +#endif diff --git a/include/boost/range/concepts.hpp b/include/boost/range/concepts.hpp index 2441d43..53a88dc 100755 --- a/include/boost/range/concepts.hpp +++ b/include/boost/range/concepts.hpp @@ -13,8 +13,8 @@ #include #include -#include -#include +#include +#include /*! * \file @@ -57,10 +57,11 @@ namespace boost { //! Check if a type T models the SinglePassRange range concept. template - struct SinglePassRangeConcept { - typedef typename range_value::type range_value; - typedef typename range_iterator::type range_iterator; - typedef typename range_const_iterator::type range_const_iterator; + struct SinglePassRangeConcept + { + typedef typename range_iterator::type range_const_iterator; + typedef typename range_iterator::type range_iterator; + void constraints() { function_requires< @@ -70,9 +71,9 @@ namespace boost { >(); i = boost::begin(a); i = boost::end(a); - b = boost::empty(a); const_constraints(a); } + void const_constraints(const T& a) { ci = boost::begin(a); @@ -81,14 +82,12 @@ namespace boost { T a; range_iterator i; range_const_iterator ci; - bool b; }; //! Check if a type T models the ForwardRange range concept. template - struct ForwardRangeConcept { - typedef typename range_difference::type range_difference; - typedef typename range_size::type range_size; + struct ForwardRangeConcept + { void constraints() { function_requires< @@ -99,17 +98,13 @@ namespace boost { typename range_iterator::type > >(); - s = boost::size(a); } - T a; - range_size s; }; //! Check if a type T models the BidirectionalRange range concept. template - struct BidirectionalRangeConcept { - typedef typename range_reverse_iterator::type range_reverse_iterator; - typedef typename range_const_reverse_iterator::type range_const_reverse_iterator; + struct BidirectionalRangeConcept + { void constraints() { function_requires< @@ -120,23 +115,13 @@ namespace boost { typename range_iterator::type > >(); - i = boost::rbegin(a); - i = boost::rend(a); - const_constraints(a); - } - void const_constraints(const T& a) - { - ci = boost::rbegin(a); - ci = boost::rend(a); } - T a; - range_reverse_iterator i; - range_const_reverse_iterator ci; }; //! Check if a type T models the RandomAccessRange range concept. template - struct RandomAccessRangeConcept { + struct RandomAccessRangeConcept + { void constraints() { function_requires< @@ -147,7 +132,7 @@ namespace boost { typename range_iterator::type > >(); - } + } }; } // namespace boost diff --git a/include/boost/range/config.hpp b/include/boost/range/config.hpp index 5f856bb..4e7fb24 100755 --- a/include/boost/range/config.hpp +++ b/include/boost/range/config.hpp @@ -37,8 +37,7 @@ #error "macro already defined!" #endif -//#if BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) || __MWERKS__ <= 0x3003 -#if _MSC_VER <= 1300 && !defined( __COMO__ ) && !defined( __GNUC__ ) && __MWERKS__ <= 0x3003 +#if BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) || BOOST_WORKAROUND( __MWERKS__, <= 0x3003 ) #define BOOST_RANGE_NO_ARRAY_SUPPORT 1 #endif diff --git a/include/boost/range/const_iterator.hpp b/include/boost/range/const_iterator.hpp index 4ba41b2..195f9d4 100755 --- a/include/boost/range/const_iterator.hpp +++ b/include/boost/range/const_iterator.hpp @@ -21,6 +21,7 @@ #include #else +#include #include #include @@ -46,12 +47,6 @@ namespace boost typedef Iterator type; }; - template< typename Iterator > - struct range_const_iterator< const std::pair > - { - typedef Iterator type; - }; - ////////////////////////////////////////////////////////////////////////// // array ////////////////////////////////////////////////////////////////////////// @@ -62,64 +57,6 @@ namespace boost typedef const T* type; }; - template< typename T, std::size_t sz > - struct range_const_iterator< const T[sz] > - { - typedef const T* type; - }; - - ////////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////////// - - template<> - struct range_const_iterator< char* > - { - typedef const char* type; - }; - - template<> - struct range_const_iterator< wchar_t* > - { - typedef const wchar_t* type; - }; - - template<> - struct range_const_iterator< const char* > - { - typedef const char* type; - }; - - template<> - struct range_const_iterator< const wchar_t* > - { - typedef const wchar_t* type; - }; - - template<> - struct range_const_iterator< char* const > - { - typedef const char* type; - }; - - template<> - struct range_const_iterator< wchar_t* const > - { - typedef const wchar_t* type; - }; - - template<> - struct range_const_iterator< const char* const > - { - typedef const char* type; - }; - - template<> - struct range_const_iterator< const wchar_t* const > - { - typedef const wchar_t* type; - }; - } // namespace boost #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/range/const_reverse_iterator.hpp b/include/boost/range/const_reverse_iterator.hpp index f33f63d..215bcc7 100755 --- a/include/boost/range/const_reverse_iterator.hpp +++ b/include/boost/range/const_reverse_iterator.hpp @@ -15,22 +15,17 @@ # pragma once #endif -#include -#include -#include +#include namespace boost { - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// + // + // This interface is deprecated, use range_reverse_iterator + // template< typename C > - struct range_const_reverse_iterator - { - typedef reverse_iterator< - BOOST_DEDUCED_TYPENAME range_const_iterator::type > type; - }; + struct range_const_reverse_iterator : range_reverse_iterator + { }; } // namespace boost diff --git a/include/boost/range/detail/as_literal.hpp b/include/boost/range/detail/as_literal.hpp new file mode 100755 index 0000000..b4fd925 --- /dev/null +++ b/include/boost/range/detail/as_literal.hpp @@ -0,0 +1,33 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2006. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_AS_LITERAL_HPP +#define BOOST_RANGE_AS_LITERAL_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include + +namespace boost +{ + template< class Range > + inline iterator_range::type> + as_literal( Range& r ) + { + return ::boost::make_iterator_range( ::boost::range_detail::str_begin(r), + ::boost::range_detail::str_end(r) ); + } + +} + +#endif diff --git a/include/boost/range/detail/begin.hpp b/include/boost/range/detail/begin.hpp index f516a14..06c2561 100755 --- a/include/boost/range/detail/begin.hpp +++ b/include/boost/range/detail/begin.hpp @@ -13,7 +13,7 @@ #include // BOOST_MSVC #include -#include +#include #include #if BOOST_WORKAROUND(BOOST_MSVC, < 1310) # include @@ -35,7 +35,7 @@ namespace boost struct range_begin { template< typename C > - static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator::type fun( C& c ) + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type fun( C& c ) { return c.begin(); }; @@ -49,7 +49,7 @@ namespace boost struct range_begin { template< typename P > - static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator

::type fun( const P& p ) + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator

::type fun( const P& p ) { return p.first; } @@ -77,51 +77,10 @@ namespace boost #endif }; - ////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////// - - template<> - struct range_begin - { - static char* fun( char* s ) - { - return s; - } - }; - - template<> - struct range_begin - { - static const char* fun( const char* s ) - { - return s; - } - }; - - template<> - struct range_begin - { - - static wchar_t* fun( wchar_t* s ) - { - return s; - } - }; - - template<> - struct range_begin - { - static const wchar_t* fun( const wchar_t* s ) - { - return s; - } - }; - } // namespace 'range_detail' template< typename C > - inline BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator::type + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type begin( C& c ) { return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); diff --git a/include/boost/range/detail/common.hpp b/include/boost/range/detail/common.hpp index 36fada1..f7539f5 100755 --- a/include/boost/range/detail/common.hpp +++ b/include/boost/range/detail/common.hpp @@ -114,3 +114,4 @@ namespace boost } #endif + diff --git a/include/boost/range/detail/const_iterator.hpp b/include/boost/range/detail/const_iterator.hpp index 3aef82a..e5cb34a 100755 --- a/include/boost/range/detail/const_iterator.hpp +++ b/include/boost/range/detail/const_iterator.hpp @@ -56,58 +56,6 @@ namespace boost remove_extent::type* type; }; }; - - template<> - struct range_const_iterator_ - { - template< typename T > - struct pts - { - typedef const BOOST_RANGE_DEDUCED_TYPENAME - remove_extent::type* type; - }; - }; - - template<> - struct range_const_iterator_ - { - template< typename S > - struct pts - { - typedef const char* type; - }; - }; - - template<> - struct range_const_iterator_ - { - template< typename S > - struct pts - { - typedef const char* type; - }; - }; - - template<> - struct range_const_iterator_ - { - template< typename S > - struct pts - { - typedef const wchar_t* type; - }; - }; - - template<> - struct range_const_iterator_ - { - template< typename S > - struct pts - { - typedef const wchar_t* type; - }; - }; - } template< typename C > diff --git a/include/boost/range/detail/detail_str.hpp b/include/boost/range/detail/detail_str.hpp new file mode 100755 index 0000000..d5ad5b3 --- /dev/null +++ b/include/boost/range/detail/detail_str.hpp @@ -0,0 +1,376 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_DETAIL_STR_HPP +#define BOOST_RANGE_DETAIL_DETAIL_STR_HPP + +#include // BOOST_MSVC +#include + +namespace boost +{ + + namespace range_detail + { + // + // iterator + // + + template<> + struct range_iterator_ + { + template< typename T > + struct pts + { + typedef BOOST_RANGE_DEDUCED_TYPENAME + remove_extent::type* type; + }; + }; + + template<> + struct range_iterator_ + { + template< typename S > + struct pts + { + typedef char* type; + }; + }; + + template<> + struct range_iterator_ + { + template< typename S > + struct pts + { + typedef const char* type; + }; + }; + + template<> + struct range_iterator_ + { + template< typename S > + struct pts + { + typedef wchar_t* type; + }; + }; + + template<> + struct range_iterator_ + { + template< typename S > + struct pts + { + typedef const wchar_t* type; + }; + }; + + + // + // const iterator + // + + template<> + struct range_const_iterator_ + { + template< typename T > + struct pts + { + typedef const BOOST_RANGE_DEDUCED_TYPENAME + remove_extent::type* type; + }; + }; + + template<> + struct range_const_iterator_ + { + template< typename S > + struct pts + { + typedef const char* type; + }; + }; + + template<> + struct range_const_iterator_ + { + template< typename S > + struct pts + { + typedef const char* type; + }; + }; + + template<> + struct range_const_iterator_ + { + template< typename S > + struct pts + { + typedef const wchar_t* type; + }; + }; + + template<> + struct range_const_iterator_ + { + template< typename S > + struct pts + { + typedef const wchar_t* type; + }; + }; + } +} + +#include +#include +#include +#include +#include + +namespace boost +{ + + namespace range_detail + { + // + // str_begin() + // + template<> + struct range_begin + { + static char* fun( char* s ) + { + return s; + } + }; + + template<> + struct range_begin + { + static const char* fun( const char* s ) + { + return s; + } + }; + + template<> + struct range_begin + { + + static wchar_t* fun( wchar_t* s ) + { + return s; + } + }; + + template<> + struct range_begin + { + static const wchar_t* fun( const wchar_t* s ) + { + return s; + } + }; + + template< typename C > + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type + str_begin( C& c ) + { + return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME + range_detail::range::type >::fun( c ); + } + + // + // str_end() + // + + template<> + struct range_end + { + template< typename T, std::size_t sz > + static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] ) + { + return boost::range_detail::array_end( boost_range_array ); + } + }; + + template<> + struct range_end + { + template< typename T, std::size_t sz > + static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] ) + { + return boost::range_detail::array_end( boost_range_array ); + } + }; + + template<> + struct range_end + { + static char* fun( char* s ) + { + return boost::range_detail::str_end( s ); + } + }; + + template<> + struct range_end + { + static const char* fun( const char* s ) + { + return boost::range_detail::str_end( s ); + } + }; + + template<> + struct range_end + { + static wchar_t* fun( wchar_t* s ) + { + return boost::range_detail::str_end( s ); + } + }; + + + template<> + struct range_end + { + static const wchar_t* fun( const wchar_t* s ) + { + return boost::range_detail::str_end( s ); + } + }; + + template< typename C > + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type + str_end( C& c ) + { + return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME + range_detail::range::type >::fun( c ); + } + + // + // size_type + // + + template<> + struct range_size_type_ + { + template< typename A > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename S > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename S > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename S > + struct pts + { + typedef std::size_t type; + }; + }; + + template<> + struct range_size_type_ + { + template< typename S > + struct pts + { + typedef std::size_t type; + }; + }; + + // + // value_type + // + + template<> + struct range_value_type_ + { + template< typename T > + struct pts + { + typedef char type; + }; + }; + + template<> + struct range_value_type_ + { + template< typename S > + struct pts + { + typedef char type; + }; + }; + + template<> + struct range_value_type_ + { + template< typename S > + struct pts + { + typedef const char type; + }; + }; + + template<> + struct range_value_type_ + { + template< typename S > + struct pts + { + typedef wchar_t type; + }; + }; + + template<> + struct range_value_type_ + { + template< typename S > + struct pts + { + typedef const wchar_t type; + }; + }; + + } // namespace 'range_detail' + +} // namespace 'boost' + + +#endif diff --git a/include/boost/range/detail/end.hpp b/include/boost/range/detail/end.hpp index 410ae60..d6a7368 100755 --- a/include/boost/range/detail/end.hpp +++ b/include/boost/range/detail/end.hpp @@ -18,8 +18,7 @@ # include #else # include -# include -# include +# include # include # if BOOST_WORKAROUND(BOOST_MSVC, < 1310) # include @@ -40,7 +39,7 @@ namespace boost struct range_end { template< typename C > - static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator::type + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type fun( C& c ) { return c.end(); @@ -55,7 +54,7 @@ namespace boost struct range_end { template< typename P > - static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator

::type + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator

::type fun( const P& p ) { return p.second; @@ -83,73 +82,11 @@ namespace boost } #endif }; - - - template<> - struct range_end - { - template< typename T, std::size_t sz > - static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] ) - { - return boost::range_detail::array_end( boost_range_array ); - } - }; - - template<> - struct range_end - { - template< typename T, std::size_t sz > - static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] ) - { - return boost::range_detail::array_end( boost_range_array ); - } - }; - - ////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////// - - template<> - struct range_end - { - static char* fun( char* s ) - { - return boost::range_detail::str_end( s ); - } - }; - - template<> - struct range_end - { - static const char* fun( const char* s ) - { - return boost::range_detail::str_end( s ); - } - }; - - template<> - struct range_end - { - static wchar_t* fun( wchar_t* s ) - { - return boost::range_detail::str_end( s ); - } - }; - - - template<> - struct range_end - { - static const wchar_t* fun( const wchar_t* s ) - { - return boost::range_detail::str_end( s ); - } - }; } // namespace 'range_detail' template< typename C > - inline BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator::type + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type end( C& c ) { return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); diff --git a/include/boost/range/detail/implementation_help.hpp b/include/boost/range/detail/implementation_help.hpp index 11c6612..da086f0 100755 --- a/include/boost/range/detail/implementation_help.hpp +++ b/include/boost/range/detail/implementation_help.hpp @@ -57,48 +57,16 @@ namespace boost return const_cast( str_end( s, s ) ); } - template< class T, std::size_t sz > - inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz], int ) - { - return boost_range_array + sz; - } - - template< class T, std::size_t sz > - inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz], int ) - { - return boost_range_array + sz; - } - - template< class T, std::size_t sz > - inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz], char_or_wchar_t_array_tag ) - { - return boost_range_array + sz - 1; - } - - template< class T, std::size_t sz > - inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz], char_or_wchar_t_array_tag ) - { - return boost_range_array + sz - 1; - } - template< class T, std::size_t sz > inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] ) { - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same::value || is_same::value, - char_or_wchar_t_array_tag, - int >::type tag; - - return array_end( boost_range_array, tag() ); + return boost_range_array + sz; } template< class T, std::size_t sz > inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] ) { - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same::value || is_same::value, - char_or_wchar_t_array_tag, - int >::type tag; - - return array_end( boost_range_array, tag() ); + return boost_range_array + sz; } ///////////////////////////////////////////////////////////////////// @@ -110,48 +78,17 @@ namespace boost { return str_end( s ) - s; } - - template< class T, std::size_t sz > - inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz], int ) - { - return sz; - } - - template< class T, std::size_t sz > - inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz], int ) - { - return sz; - } - - template< class T, std::size_t sz > - inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz], char_or_wchar_t_array_tag ) - { - return sz - 1; - } - - template< class T, std::size_t sz > - inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz], char_or_wchar_t_array_tag ) - { - return sz - 1; - } template< class T, std::size_t sz > inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] ) { - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same::value || is_same::value || - is_same::value || is_same::value, - char_or_wchar_t_array_tag, - int >::type tag; - return array_size( boost_range_array, tag() ); + return sz; } template< class T, std::size_t sz > inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] ) { - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same::value || is_same::value, - char_or_wchar_t_array_tag, - int >::type tag; - return array_size( boost_range_array, tag() ); + return sz; } } // namespace 'range_detail' diff --git a/include/boost/range/detail/iterator.hpp b/include/boost/range/detail/iterator.hpp index b9098e6..58346d4 100755 --- a/include/boost/range/detail/iterator.hpp +++ b/include/boost/range/detail/iterator.hpp @@ -64,60 +64,10 @@ namespace boost }; }; - template<> - struct range_iterator_ - { - template< typename T > - struct pts - { - typedef BOOST_RANGE_DEDUCED_TYPENAME - remove_extent::type* type; - }; - }; - - template<> - struct range_iterator_ - { - template< typename S > - struct pts - { - typedef char* type; - }; - }; - - template<> - struct range_iterator_ - { - template< typename S > - struct pts - { - typedef const char* type; - }; - }; - - template<> - struct range_iterator_ - { - template< typename S > - struct pts - { - typedef wchar_t* type; - }; - }; - - template<> - struct range_iterator_ - { - template< typename S > - struct pts - { - typedef const wchar_t* type; - }; - }; } template< typename C > - class range_iterator + class range_mutable_iterator { typedef BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type c_type; public: diff --git a/include/boost/range/detail/mfc/carray.hpp b/include/boost/range/detail/mfc/carray.hpp deleted file mode 100755 index 71ab5cb..0000000 --- a/include/boost/range/detail/mfc/carray.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to 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) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#if !defined( BOOST_RANGE_DETAIL_MFC_CARRAY_HPP ) && defined( BOOST_RANGE_ENABLE_MCF_CARRAY ) -#define BOOST_RANGE_DETAIL_MFC_CARRAY_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif - -#include // for CArray -#include -#include - -namespace boost -{ - template< class T, class U > - struct range_iterator< CArray > - { - typedef T* type; - }; - - // - // Why is this needed?!? - // - template< class T, class U > - struct range_iterator< const CArray > - { - typedef T* type; - }; - - template< class T, class U > - struct range_const_iterator< CArray > - { - typedef const T* type; - }; - - template< class T, class U > - struct range_difference< CArray > - { - typedef std::ptrdiff_t type; - }; - - template< class T, class U > - struct range_size< CArray > - { - typedef int type; - }; - - template< class T, class U > - struct range_value< CArray > - { - typedef T type; - }; - - template< class T, class U > - T* boost_range_begin( CArray& r ) - { - return r.GetData(); - } - - template< class T, class U > - const T* boost_range_begin( const CArray& r ) - { - return r.GetData(); - } - - template< class T, class U > - int boost_range_size( const CArray& r ) - { - return r.GetSize(); - } - - template< class T, class U > - T* boost_range_end( CArray& r ) - { - return boost_range_begin( r ) + boost_range_size( r ); - } - - template< class T, class U > - const T* boost_range_end( const CArray& r ) - { - return boost_range_begin( r ) + boost_range_size( r ); - } - - // default 'empty()' ok - -} // namespace 'boost' - -#endif diff --git a/include/boost/range/detail/mfc/cstring.hpp b/include/boost/range/detail/mfc/cstring.hpp deleted file mode 100755 index ccb0745..0000000 --- a/include/boost/range/detail/mfc/cstring.hpp +++ /dev/null @@ -1,92 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to 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) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#if !defined(BOOST_RANGE_DETAIL_MFC_CSTRING_HPP) && defined(BOOST_RANGE_ENABLE_MFC) -#define BOOST_RANGE_DETAIL_MFC_CSTRING_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif - -#include // for CString -#include -#include - -namespace boost -{ - template<> - struct range_iterator< CString > - { - typedef TCHAR* type; - }; - - // - // Why is this needed?!? - // - template<> - struct range_iterator< const CString > - { - typedef TCHAR* type; - }; - - template<> - struct range_const_iterator< CString > - { - typedef const TCHAR* type; - }; - - template<> - struct range_difference< CString > - { - typedef std::ptrdiff_t type; - }; - - template<> - struct range_size< CString > - { - typedef int type; - }; - - template<> - struct range_value< CString > - { - typedef TCHAR type; - }; - - TCHAR* boost_range_begin( CString& r ) - { - return r.GetBuffer(0); - } - - const TCHAR* boost_range_begin( const CString& r ) - { - return (LPCTSTR)r; - } - - int boost_range_size( const CString& r ) - { - return r.GetLength(); - } - - TCHAR* boost_range_end( CString& r ) - { - return boost_range_begin( r ) + boost_range_size( r ); - } - - const TCHAR* range_adl_end( const CString& r ) - { - return boost_range_begin( r ) + boost_range_size( r ); - } - - // default 'empty()' ok - -} // namespace 'boost' - -#endif diff --git a/include/boost/range/detail/microsoft.hpp b/include/boost/range/detail/microsoft.hpp new file mode 100644 index 0000000..7b672c9 --- /dev/null +++ b/include/boost/range/detail/microsoft.hpp @@ -0,0 +1,931 @@ +#ifndef BOOST_RANGE_DETAIL_MICROSOFT_HPP +#define BOOST_RANGE_DETAIL_MICROSOFT_HPP + +// Boost.Range MFC/ATL Extension +// +// Copyright Shunsuke Sogame 2005-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) + + + + +// config +// + + +#include + + +#define BOOST_RANGE_DETAIL_MICROSOFT_RANGE_VERSION_1 1 + + +#if !defined(BOOST_RANGE_DETAIL_MICROSOFT_RANGE_VERSION_1) + #define BOOST_RANGE_DETAIL_MICROSOFT_range_mutable_iterator range_mutable_iterator + #define BOOST_RANGE_DETAIL_MICROSOFT_range_begin range_begin + #define BOOST_RANGE_DETAIL_MICROSOFT_range_end range_end +#else + #define BOOST_RANGE_DETAIL_MICROSOFT_range_mutable_iterator range_mutable_iterator + #define BOOST_RANGE_DETAIL_MICROSOFT_range_begin range_begin + #define BOOST_RANGE_DETAIL_MICROSOFT_range_end range_end +#endif + + + + +// yet another customization way +// + + +#include // iterator_difference +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // disable_if + +#if !defined(BOOST_RANGE_DETAIL_MICROSOFT_RANGE_VERSION_1) + #include +#else + #include // distance + #include + #include + #include +#endif + + +namespace boost { namespace range_detail_microsoft { + + + // customization point + // + + template< class Tag > + struct customization; + + + template< class T > + struct customization_tag; + + + struct using_type_as_tag + { }; + + + // Topic: + // In fact, it is unnecessary for VC++. + // VC++'s behavior seems conforming, while GCC fails without this. + template< class Iterator, class T > + struct mutable_ : + disable_if< is_const, Iterator > + { }; + + + // helpers + // + + template< class Tag, class T > + struct customization_tag_of + { + typedef typename mpl::if_< is_same, + T, + Tag + >::type type; + }; + + + template< class T > + struct customization_of + { + typedef typename remove_cv::type bare_t; + typedef typename customization_tag::type tag_t; + typedef customization type; + }; + + + template< class T > + struct mutable_iterator_of + { + typedef typename remove_cv::type bare_t; + typedef typename customization_of::type cust_t; + typedef typename cust_t::template meta::mutable_iterator type; + }; + + + template< class T > + struct const_iterator_of + { + typedef typename remove_cv::type bare_t; + typedef typename customization_of::type cust_t; + typedef typename cust_t::template meta::const_iterator type; + }; + + + template< class T > + struct size_type_of + { + typedef typename range_detail_microsoft::mutable_iterator_of::type miter_t; + typedef typename iterator_difference::type type; + }; + + + template< class T > inline + typename mutable_iterator_of::type + begin_of(T& x) + { + typedef typename customization_of::type cust_t; + return cust_t().template begin::type>(x); + } + + + template< class T > inline + typename const_iterator_of::type + begin_of(T const& x) + { + typedef typename customization_of::type cust_t; + return cust_t().template begin::type>(x); + } + + + template< class T > inline + typename mutable_iterator_of::type + end_of(T& x) + { + typedef typename customization_of::type cust_t; + return cust_t().template end::type>(x); + } + + + template< class T > inline + typename const_iterator_of::type + end_of(T const& x) + { + typedef typename customization_of::type cust_t; + return cust_t().template end::type>(x); + } + + +#if defined(BOOST_RANGE_DETAIL_MICROSOFT_RANGE_VERSION_1) + + template< class T > inline + typename size_type_of::type + size_of(T const& x) + { + return std::distance(boost::begin(x), boost::end(x)); + } + +#endif + + + template< class Range > + struct compatible_mutable_iterator : + BOOST_RANGE_DETAIL_MICROSOFT_range_mutable_iterator + { }; + + +} } // namespace boost::range_detail_microsoft + + +#define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_open(NamespaceList) \ + BOOST_PP_LIST_FOR_EACH(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_open_op, ~, NamespaceList) \ +/**/ + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_open_op(r, data, elem) \ + namespace elem { \ + /**/ + + +#define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_close(NamespaceList) \ + BOOST_PP_LIST_FOR_EACH(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_close_op, ~, NamespaceList) \ +/**/ + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_close_op(r, data, elem) \ + } \ + /**/ + + +#define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_expand_op(r, data, elem) \ + :: elem \ +/**/ + + +#define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE(Tag, NamespaceList, Name) \ + namespace boost { namespace range_detail_microsoft { \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_tag(Tag, BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + } } \ + \ + namespace boost { \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_mutable_iterator(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_const_iterator(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_size_type(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + } \ + \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_open(NamespaceList) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_begin(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_begin_const(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_end(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_end_const(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_size(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name)) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_close(NamespaceList) \ +/**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_fullname(NamespaceList, Name) \ + BOOST_PP_LIST_FOR_EACH(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_expand_op, ~, NamespaceList) :: Name \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_tag(Tag, Fullname) \ + template< > \ + struct customization_tag< Fullname > : \ + customization_tag_of< Tag, Fullname > \ + { }; \ + /**/ + + + // metafunctions + // + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_mutable_iterator(Fullname) \ + template< > \ + struct BOOST_RANGE_DETAIL_MICROSOFT_range_mutable_iterator< Fullname > : \ + range_detail_microsoft::mutable_iterator_of< Fullname > \ + { }; \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_const_iterator(Fullname) \ + template< > \ + struct range_const_iterator< Fullname > : \ + range_detail_microsoft::const_iterator_of< Fullname > \ + { }; \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_size_type(Fullname) \ + template< > \ + struct range_size< Fullname > : \ + range_detail_microsoft::size_type_of< Fullname > \ + { }; \ + /**/ + + + // functions + // + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_begin(Fullname) \ + inline \ + boost::range_detail_microsoft::mutable_iterator_of< Fullname >::type \ + BOOST_RANGE_DETAIL_MICROSOFT_range_begin(Fullname& x) \ + { \ + return boost::range_detail_microsoft::begin_of(x); \ + } \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_begin_const(Fullname) \ + inline \ + boost::range_detail_microsoft::const_iterator_of< Fullname >::type \ + BOOST_RANGE_DETAIL_MICROSOFT_range_begin(Fullname const& x) \ + { \ + return boost::range_detail_microsoft::begin_of(x); \ + } \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_end(Fullname) \ + inline \ + boost::range_detail_microsoft::mutable_iterator_of< Fullname >::type \ + BOOST_RANGE_DETAIL_MICROSOFT_range_end(Fullname& x) \ + { \ + return boost::range_detail_microsoft::end_of(x); \ + } \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_end_const(Fullname) \ + inline \ + boost::range_detail_microsoft::const_iterator_of< Fullname >::type \ + BOOST_RANGE_DETAIL_MICROSOFT_range_end(Fullname const& x) \ + { \ + return boost::range_detail_microsoft::end_of(x); \ + } \ + /**/ + + + #if !defined(BOOST_RANGE_DETAIL_MICROSOFT_RANGE_VERSION_1) + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_size(Fullname) \ + /**/ + + #else + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE_size(Fullname) \ + inline \ + boost::range_detail_microsoft::size_type_of< Fullname >::type \ + boost_range_size(Fullname const& x) \ + { \ + return boost::range_detail_microsoft::size_of(x); \ + } \ + /**/ + + #endif + + +#define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE(Tag, NamespaceList, Name, ParamSeqOrCount) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_impl( \ + Tag, NamespaceList, Name, \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_to_param_seq(ParamSeqOrCount) \ + ) \ +/**/ + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_to_param_seq(ParamSeqOrCount) \ + BOOST_PP_IIF(BOOST_PP_IS_UNARY(ParamSeqOrCount), \ + ParamSeqOrCount BOOST_PP_TUPLE_EAT(3), \ + BOOST_PP_REPEAT \ + )(ParamSeqOrCount, BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_to_param_seq_op, ~) \ + /**/ + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_to_param_seq_op(z, n, _) \ + (class) \ + /**/ + + +#define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_impl(Tag, NamespaceList, Name, ParamSeq) \ + namespace boost { namespace range_detail_microsoft { \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_tag( \ + Tag, \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + } } \ + \ + namespace boost { \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_mutable_iterator( \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_const_iterator( \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_size_type( \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + } \ + \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_open(NamespaceList) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_begin( \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_begin_const( \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_end( \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_end_const( \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_size( \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq), \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + ) \ + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_close(NamespaceList) \ +/**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params(ParamSeq) \ + BOOST_PP_SEQ_FOR_EACH_I(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params_op, ~, ParamSeq) \ + /**/ + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_params_op(r, data, i, elem) \ + BOOST_PP_COMMA_IF(i) elem BOOST_PP_CAT(T, i) \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_fullname(NamespaceList, Name, ParamSeq) \ + BOOST_PP_LIST_FOR_EACH(BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_namespace_expand_op, ~, NamespaceList) \ + :: Name < BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(ParamSeq), T) > \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_tag(Tag, Params, Fullname) \ + template< Params > \ + struct customization_tag< Fullname > : \ + customization_tag_of< Tag, Fullname > \ + { }; \ + /**/ + + + // metafunctions + // + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_mutable_iterator(Params, Fullname) \ + template< Params > \ + struct BOOST_RANGE_DETAIL_MICROSOFT_range_mutable_iterator< Fullname > : \ + range_detail_microsoft::mutable_iterator_of< Fullname > \ + { }; \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_const_iterator(Params, Fullname) \ + template< Params > \ + struct range_const_iterator< Fullname > : \ + range_detail_microsoft::const_iterator_of< Fullname > \ + { }; \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_size_type(Params, Fullname) \ + template< Params > \ + struct range_size< Fullname > : \ + range_detail_microsoft::size_type_of< Fullname > \ + { }; \ + /**/ + + + // functions + // + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_begin(Params, Fullname) \ + template< Params > inline \ + typename boost::range_detail_microsoft::mutable_iterator_of< Fullname >::type \ + BOOST_RANGE_DETAIL_MICROSOFT_range_begin(Fullname& x) \ + { \ + return boost::range_detail_microsoft::begin_of(x); \ + } \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_begin_const(Params, Fullname) \ + template< Params > inline \ + typename boost::range_detail_microsoft::const_iterator_of< Fullname >::type \ + BOOST_RANGE_DETAIL_MICROSOFT_range_begin(Fullname const& x) \ + { \ + return boost::range_detail_microsoft::begin_of(x); \ + } \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_end(Params, Fullname) \ + template< Params > inline \ + typename boost::range_detail_microsoft::mutable_iterator_of< Fullname >::type \ + BOOST_RANGE_DETAIL_MICROSOFT_range_end(Fullname& x) \ + { \ + return boost::range_detail_microsoft::end_of(x); \ + } \ + /**/ + + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_end_const(Params, Fullname) \ + template< Params > inline \ + typename boost::range_detail_microsoft::const_iterator_of< Fullname >::type \ + BOOST_RANGE_DETAIL_MICROSOFT_range_end(Fullname const& x) \ + { \ + return boost::range_detail_microsoft::end_of(x); \ + } \ + /**/ + + + #if !defined(BOOST_RANGE_DETAIL_MICROSOFT_RANGE_VERSION_1) + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_size(Params, Fullname) \ + /**/ + + #else + + #define BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE_size(Params, Fullname) \ + template< Params > inline \ + typename boost::range_detail_microsoft::size_type_of< Fullname >::type \ + boost_range_size(Fullname const& x) \ + { \ + return boost::range_detail_microsoft::size_of(x); \ + } \ + /**/ + + #endif + + + + +// list_iterator and helpers +// + + +#include +#include +#include +#include +#include + + +// POSITION's header is undocumented, so is NULL. +// +struct __POSITION; // incomplete, but used as just a pointer. +typedef __POSITION *POSITION; + + +namespace boost { namespace range_detail_microsoft { + + + template< + class ListT, + class Value, + class Reference, + class Traversal + > + struct list_iterator; + + + template< + class ListT, + class Value, + class Reference, + class Traversal + > + struct list_iterator_super + { + typedef typename mpl::if_< is_same, + Value&, + Reference + >::type ref_t; + + typedef typename mpl::if_< is_same, + bidirectional_traversal_tag, + Traversal + >::type trv_t; + + typedef iterator_facade< + list_iterator, + Value, + trv_t, + ref_t + > type; + }; + + + template< + class ListT, + class Value, + class Reference = use_default, + class Traversal = use_default + > + struct list_iterator : + list_iterator_super::type + { + private: + typedef list_iterator self_t; + typedef typename list_iterator_super::type super_t; + typedef typename super_t::reference ref_t; + + public: + explicit list_iterator() + { } + + explicit list_iterator(ListT& lst, POSITION pos) : + m_plst(boost::addressof(lst)), m_pos(pos) + { } + + template< class, class, class, class > friend struct list_iterator; + template< class ListT_, class Value_, class Reference_, class Traversal_> + list_iterator(list_iterator const& other) : + m_plst(other.m_plst), m_pos(other.m_pos) + { } + + private: + ListT *m_plst; + POSITION m_pos; + + friend class iterator_core_access; + ref_t dereference() const + { + BOOST_ASSERT(m_pos != 0 && "out of range"); + return m_plst->GetAt(m_pos); + } + + // A B C D x + // Head Tail NULL(0) + // + void increment() + { + BOOST_ASSERT(m_pos != 0 && "out of range"); + m_plst->GetNext(m_pos); + } + + void decrement() + { + if (m_pos == 0) { + m_pos = m_plst->GetTailPosition(); + return; + } + + m_plst->GetPrev(m_pos); + } + + bool equal(self_t const& other) const + { + BOOST_ASSERT(m_plst == other.m_plst && "iterators incompatible"); + return m_pos == other.m_pos; + } + }; + + + // customization helpers + // + + struct array_functions + { + template< class Iterator, class X > + Iterator begin(X& x) + { + return x.GetData(); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return begin(x) + x.GetSize(); + } + }; + + + struct list_functions + { + template< class Iterator, class X > + Iterator begin(X& x) + { + return Iterator(x, x.GetHeadPosition()); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return Iterator(x, POSITION(0)); + } + }; + + +} } // namespace boost::range_detail_microsoft + + + + +// test +// + + +#if defined(BOOST_RANGE_DETAIL_MICROSOFT_TEST) + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace boost { namespace range_detail_microsoft { + + + template< class Range1, class Range2 > + bool test_equals(Range1 const& rng1, Range2 const& rng2) + { + return + boost::distance(rng1) == boost::distance(rng2) && + std::equal(boost::begin(rng1), boost::end(rng1), boost::begin(rng2)) + ; + } + + + template< class AssocContainer, class PairT > + bool test_find_key_and_mapped(AssocContainer const& ac, PairT const& pa) + { + typedef typename boost::range_const_iterator::type iter_t; + for (iter_t it = boost::const_begin(ac), last = boost::const_end(ac); it != last; ++it) { + if (it->first == pa.first && it->second == pa.second) + return true; + } + + return false; + } + + + // test functions + // + + template< class Range > + bool test_emptiness(Range& ) + { + bool result = true; + + Range emptyRng; + result = result && boost::empty(emptyRng); + + return result; + } + + + template< class Range > + bool test_trivial(Range& rng) + { + bool result = true; + + // convertibility check + typedef typename range_const_iterator::type citer_t; + citer_t cit = boost::begin(rng); + (void)cit; // unused + + // mutability check + typedef typename range_value::type val_t; + val_t v = *boost::begin(rng); + *boost::begin(rng) = v; + result = result && *boost::begin(rng) == v; + + return result; + } + + + template< class Range > + bool test_forward(Range& rng) + { + boost::function_requires< ForwardRangeConcept >(); + + bool result = (test_trivial)(rng); + + typedef typename range_value::type val_t; + + std::vector saved; + std::copy(boost::begin(rng), boost::end(rng), std::back_inserter(saved)); + std::rotate(boost::begin(saved), boost::next(boost::begin(saved)), boost::end(saved)); + + std::rotate(boost::begin(rng), boost::next(boost::begin(rng)), boost::end(rng)); + + return result && (test_equals)(saved, rng); + }; + + + template< class Range > + bool test_bidirectional(Range& rng) + { + boost::function_requires< BidirectionalRangeConcept >(); + + bool result = (test_forward)(rng); + + typedef typename range_value::type val_t; + + std::vector saved; + std::copy(boost::begin(rng), boost::end(rng), std::back_inserter(saved)); + + result = result && (test_equals)( + boost::make_iterator_range(boost::rbegin(saved), boost::rend(saved)), + boost::make_iterator_range(boost::rbegin(rng), boost::rend(rng)) + ); + + return result; + } + + + template< class Range > + bool test_random_access(Range& rng) + { + boost::function_requires< RandomAccessRangeConcept >(); + + bool result = (test_bidirectional)(rng); + + typedef typename range_value::type val_t; + + std::vector saved; + std::copy(boost::begin(rng), boost::end(rng), std::back_inserter(saved)); + std::sort(boost::begin(saved), boost::end(saved)); + + std::random_shuffle(boost::begin(rng), boost::end(rng)); + std::sort(boost::begin(rng), boost::end(rng)); + result = result && (test_equals)(rng, saved); + + std::random_shuffle(boost::begin(rng), boost::end(rng)); + std::stable_sort(boost::begin(rng), boost::end(rng)); + result = result && (test_equals)(rng, saved); + + std::random_shuffle(boost::begin(rng), boost::end(rng)); + std::partial_sort(boost::begin(rng), boost::end(rng), boost::end(rng)); + result = result && (test_equals)(rng, saved); + + return result; + } + + + // initializer + // + + template< class ArrayT, class SampleRange > + bool test_init_array(ArrayT& arr, SampleRange const& sample) + { + typedef typename range_const_iterator::type iter_t; + typedef typename range_value::type val_t; + + for (iter_t it = boost::const_begin(sample), last = boost::const_end(sample); it != last; ++it) { + val_t v = *it; // works around ATL3 CSimpleArray + arr.Add(v); + } + + return (test_equals)(arr, sample); + } + + + template< class ListT, class SampleRange > + bool test_init_list(ListT& lst, SampleRange const& sample) + { + typedef typename range_const_iterator::type iter_t; + + for (iter_t it = boost::const_begin(sample), last = boost::const_end(sample); it != last; ++it) { + lst.AddTail(*it); + } + + return (test_equals)(lst, sample); + } + + + template< class StringT, class SampleRange > + bool test_init_string(StringT& str, SampleRange const& sample) + { + typedef typename range_const_iterator::type iter_t; + typedef typename range_value::type val_t; + + for (iter_t it = boost::const_begin(sample), last = boost::const_end(sample); it != last; ++it) { + str += *it; + } + + return (test_equals)(str, sample); + } + + + template< class MapT, class SampleMap > + bool test_init_map(MapT& map, SampleMap const& sample) + { + typedef typename range_const_iterator::type iter_t; + + for (iter_t it = boost::const_begin(sample), last = boost::const_end(sample); it != last; ++it) { + map.SetAt(it->first, it->second); + } + + return boost::distance(map) == boost::distance(sample); + } + + + // metafunction test + // + + template< class Range, class Iter > + struct test_mutable_iter : + boost::is_same< typename boost::BOOST_RANGE_DETAIL_MICROSOFT_range_mutable_iterator::type, Iter > + { }; + + + template< class Range, class Iter > + struct test_const_iter : + boost::is_same< typename boost::range_const_iterator::type, Iter > + { }; + + +} } // namespace boost::range_detail_microsoft + + +#endif // defined(BOOST_RANGE_DETAIL_MICROSOFT_TEST) + + + +#endif diff --git a/include/boost/range/detail/size_type.hpp b/include/boost/range/detail/size_type.hpp index d4f0704..ec49f4d 100755 --- a/include/boost/range/detail/size_type.hpp +++ b/include/boost/range/detail/size_type.hpp @@ -54,55 +54,7 @@ namespace boost }; }; - template<> - struct range_size_type_ - { - template< typename A > - struct pts - { - typedef std::size_t type; - }; - }; - - template<> - struct range_size_type_ - { - template< typename S > - struct pts - { - typedef std::size_t type; - }; - }; - - template<> - struct range_size_type_ - { - template< typename S > - struct pts - { - typedef std::size_t type; - }; - }; - - template<> - struct range_size_type_ - { - template< typename S > - struct pts - { - typedef std::size_t type; - }; - }; - - template<> - struct range_size_type_ - { - template< typename S > - struct pts - { - typedef std::size_t type; - }; - }; + } template< typename C > diff --git a/include/boost/range/detail/str_types.hpp b/include/boost/range/detail/str_types.hpp new file mode 100755 index 0000000..f8cab19 --- /dev/null +++ b/include/boost/range/detail/str_types.hpp @@ -0,0 +1,38 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2006. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_STR_TYPES_HPP +#define BOOST_RANGE_DETAIL_STR_TYPES_HPP + +#include +#include + +namespace boost +{ + template< class T > + struct range_mutable_iterator + { + typedef T* type; + }; + + template< class T > + struct range_const_iterator + { + typedef const T* type; + }; + + template< class T > + struct range_size + { + typedef std::size_t type; + }; +} + +#endif diff --git a/include/boost/range/detail/value_type.hpp b/include/boost/range/detail/value_type.hpp index c3a4693..2784514 100755 --- a/include/boost/range/detail/value_type.hpp +++ b/include/boost/range/detail/value_type.hpp @@ -56,56 +56,6 @@ namespace boost }; }; - template<> - struct range_value_type_ - { - template< typename T > - struct pts - { - typedef char type; - }; - }; - - template<> - struct range_value_type_ - { - template< typename S > - struct pts - { - typedef char type; - }; - }; - - template<> - struct range_value_type_ - { - template< typename S > - struct pts - { - typedef const char type; - }; - }; - - template<> - struct range_value_type_ - { - template< typename S > - struct pts - { - typedef wchar_t type; - }; - }; - - template<> - struct range_value_type_ - { - template< typename S > - struct pts - { - typedef const wchar_t type; - }; - }; - } template< typename C > diff --git a/include/boost/range/difference_type.hpp b/include/boost/range/difference_type.hpp index 33c56e3..164288f 100755 --- a/include/boost/range/difference_type.hpp +++ b/include/boost/range/difference_type.hpp @@ -16,130 +16,14 @@ #endif #include -#include +#include #include namespace boost { - template< class T > - struct range_difference - { - typedef BOOST_DEDUCED_TYPENAME iterator_difference< - BOOST_DEDUCED_TYPENAME range_const_iterator::type >::type - type; - }; + template< class T > + struct range_difference : iterator_difference< typename range_iterator::type > + { }; } -//#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -//#include -//#else - -/* -#include -#include - -namespace boost -{ - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// - - template< typename C > - struct range_difference - { - typedef BOOST_DEDUCED_TYPENAME C::difference_type type; - }; - - ////////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - struct range_difference< std::pair > - { - typedef BOOST_DEDUCED_TYPENAME - iterator_difference::type type; - }; - - template< typename Iterator > - struct range_difference< const std::pair > - { - typedef BOOST_DEDUCED_TYPENAME - iterator_difference::type type; - }; - - - ////////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////////// - - template< typename T, std::size_t sz > - struct range_difference< T[sz] > - { - typedef std::ptrdiff_t type; - }; - - template< typename T, std::size_t sz > - struct range_difference< const T[sz] > - { - typedef std::ptrdiff_t type; - }; - - ////////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////////// - - template<> - struct range_difference< char* > - { - typedef std::ptrdiff_t type; - }; - - template<> - struct range_difference< wchar_t* > - { - typedef std::ptrdiff_t type; - }; - - template<> - struct range_difference< const char* > - { - typedef std::ptrdiff_t type; - }; - - template<> - struct range_difference< const wchar_t* > - { - typedef std::ptrdiff_t type; - }; - - template<> - struct range_difference< char* const > - { - typedef std::ptrdiff_t type; - }; - - template<> - struct range_difference< wchar_t* const > - { - typedef std::ptrdiff_t type; - }; - - template<> - struct range_difference< const char* const > - { - typedef std::ptrdiff_t type; - }; - - template<> - struct range_difference< const wchar_t* const > - { - typedef std::ptrdiff_t type; - }; - -} // namespace boost - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -*/ - #endif diff --git a/include/boost/range/distance.hpp b/include/boost/range/distance.hpp new file mode 100755 index 0000000..42a106d --- /dev/null +++ b/include/boost/range/distance.hpp @@ -0,0 +1,34 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2006. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DISTANCE_HPP +#define BOOST_RANGE_DISTANCE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + + template< class T > + inline BOOST_DEDUCED_TYPENAME range_difference::type + distance( const T& r ) + { + return std::distance( boost::begin( r ), boost::end( r ) ); + } + +} // namespace 'boost' + +#endif diff --git a/include/boost/range/empty.hpp b/include/boost/range/empty.hpp index 7363262..78c4e85 100755 --- a/include/boost/range/empty.hpp +++ b/include/boost/range/empty.hpp @@ -16,52 +16,19 @@ #endif #include -//#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING -//#include -//#else - #include #include namespace boost { -namespace range_detail -{ - ////////////////////////////////////////////////////////////////////// - // primary template - ////////////////////////////////////////////////////////////////////// - - template< typename C > - inline bool empty( const C& c ) - { - return boost::begin( c ) == boost::end( c ); - } - - ////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////// - - inline bool empty( const char* const& s ) - { - return s == 0 || s[0] == 0; - } - - inline bool empty( const wchar_t* const& s ) - { - return s == 0 || s[0] == 0; - } - -} // namespace 'range_detail' - -template< class T > -inline bool empty( const T& r ) -{ - return range_detail::empty( r ); -} + template< class T > + inline bool empty( const T& r ) + { + return boost::begin( r ) == boost::end( r ); + } } // namepace 'boost' -//#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING #endif diff --git a/include/boost/range/end.hpp b/include/boost/range/end.hpp index 493208f..b777a55 100755 --- a/include/boost/range/end.hpp +++ b/include/boost/range/end.hpp @@ -15,7 +15,6 @@ # pragma once #endif -#include #include #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING @@ -39,19 +38,15 @@ namespace range_detail ////////////////////////////////////////////////////////////////////// // primary template ////////////////////////////////////////////////////////////////////// - template< typename C > - inline BOOST_DEDUCED_TYPENAME range_const_iterator::type - boost_range_end( const C& c ) - { - return c.end(); - } - - template< typename C > - inline BOOST_DEDUCED_TYPENAME range_iterator< - typename remove_const::type >::type - boost_range_end( C& c ) + inline BOOST_DEDUCED_TYPENAME range_iterator::type + range_end( C& c ) { + // + // If you get a compile-error here, it is most likely because + // you have not implemented range_begin() properly in + // the namespace of C + // return c.end(); } @@ -60,13 +55,13 @@ namespace range_detail ////////////////////////////////////////////////////////////////////// template< typename Iterator > - inline Iterator boost_range_end( const std::pair& p ) + inline Iterator range_end( const std::pair& p ) { return p.second; } template< typename Iterator > - inline Iterator boost_range_end( std::pair& p ) + inline Iterator range_end( std::pair& p ) { return p.second; } @@ -76,64 +71,17 @@ namespace range_detail ////////////////////////////////////////////////////////////////////// template< typename T, std::size_t sz > - inline const T* boost_range_end( const T (&array)[sz] ) + inline const T* range_end( const T (&array)[sz] ) { return range_detail::array_end( array ); } template< typename T, std::size_t sz > - inline T* boost_range_end( T (&array)[sz] ) + inline T* range_end( T (&array)[sz] ) { return range_detail::array_end( array ); } - ////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////// - -#if 1 || BOOST_WORKAROUND(__MWERKS__, <= 0x3204 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -// CW up to 9.3 and borland have troubles with function ordering - inline char* boost_range_end( char* s ) - { - return range_detail::str_end( s ); - } - - inline wchar_t* boost_range_end( wchar_t* s ) - { - return range_detail::str_end( s ); - } - - inline const char* boost_range_end( const char* s ) - { - return range_detail::str_end( s ); - } - - inline const wchar_t* boost_range_end( const wchar_t* s ) - { - return range_detail::str_end( s ); - } -#else - inline char* boost_range_end( char*& s ) - { - return range_detail::str_end( s ); - } - - inline wchar_t* boost_range_end( wchar_t*& s ) - { - return range_detail::str_end( s ); - } - - inline const char* boost_range_end( const char*& s ) - { - return range_detail::str_end( s ); - } - - inline const wchar_t* boost_range_end( const wchar_t*& s ) - { - return range_detail::str_end( s ); - } -#endif - #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ !BOOST_WORKAROUND(__GNUC__, < 3) \ /**/ @@ -141,46 +89,27 @@ namespace range_detail #endif template< class T > -inline BOOST_DEDUCED_TYPENAME range_iterator< - typename remove_const::type >::type end( T& r ) +inline BOOST_DEDUCED_TYPENAME range_iterator::type end( T& r ) { #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ !BOOST_WORKAROUND(__GNUC__, < 3) \ /**/ using namespace range_detail; #endif - return boost_range_end( r ); + return range_end( r ); } template< class T > -inline BOOST_DEDUCED_TYPENAME range_const_iterator::type end( const T& r ) +inline BOOST_DEDUCED_TYPENAME range_iterator::type end( const T& r ) { #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ !BOOST_WORKAROUND(__GNUC__, < 3) \ /**/ using namespace range_detail; #endif - return boost_range_end( r ); + return range_end( r ); } - - -#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -// BCB and CW are not able to overload pointer when class overloads are also available. -template<> -inline range_const_iterator::type end( const char*& r ) -{ - return range_detail::str_end( r ); -} - -template<> -inline range_const_iterator::type end( const wchar_t*& r ) -{ - return range_detail::str_end( r ); -} - -#endif - } // namespace 'boost' @@ -191,7 +120,7 @@ inline range_const_iterator::type end( const wch namespace boost { template< class T > - inline BOOST_DEDUCED_TYPENAME range_const_iterator::type + inline BOOST_DEDUCED_TYPENAME range_iterator::type const_end( const T& r ) { return boost::end( r ); @@ -199,3 +128,4 @@ namespace boost } #endif + diff --git a/include/boost/range/functions.hpp b/include/boost/range/functions.hpp index 5b5fb54..b8b8608 100755 --- a/include/boost/range/functions.hpp +++ b/include/boost/range/functions.hpp @@ -1,6 +1,6 @@ // Boost.Range library // -// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// Copyright Thorsten Ottosen 2003-2006. Use, modification and // distribution is subject to 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) @@ -18,8 +18,10 @@ #include #include #include +#include #include #include #include #endif + diff --git a/include/boost/range/iterator.hpp b/include/boost/range/iterator.hpp index 0225495..21798c5 100755 --- a/include/boost/range/iterator.hpp +++ b/include/boost/range/iterator.hpp @@ -11,118 +11,62 @@ #ifndef BOOST_RANGE_ITERATOR_HPP #define BOOST_RANGE_ITERATOR_HPP -#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#include -#else - -#include -#include -#include +#include +#include +#include +#include +#include namespace boost { - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// + +#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + + namespace range_detail_vc7_1 + { + template< typename C, typename Sig = void(C) > + struct range_iterator + { + typedef BOOST_RANGE_DEDUCED_TYPENAME + mpl::eval_if_c< is_const::value, + range_const_iterator< typename remove_const::type >, + range_mutable_iterator >::type type; + }; + template< typename C, typename T > + struct range_iterator< C, void(T[]) > + { + typedef T* type; + }; + } + +#endif + template< typename C > struct range_iterator { - typedef BOOST_DEDUCED_TYPENAME C::iterator type; +#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + + typedef BOOST_RANGE_DEDUCED_TYPENAME + range_detail_vc7_1::range_iterator::type type; + +#else + + typedef BOOST_RANGE_DEDUCED_TYPENAME + mpl::eval_if_c< is_const::value, + range_const_iterator< typename remove_const::type >, + range_mutable_iterator >::type type; + +#endif }; - ////////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - struct range_iterator< std::pair > - { - typedef Iterator type; - }; - - template< typename Iterator > - struct range_iterator< const std::pair > - { - typedef Iterator type; - }; - - ////////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////////// - - template< typename T, std::size_t sz > - struct range_iterator< T[sz] > - { - typedef T* type; - }; - - template< typename T, std::size_t sz > - struct range_iterator< const T[sz] > - { - typedef const T* type; - }; - - ////////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////////// - - template<> - struct range_iterator< char* > - { - typedef char* type; - }; - - template<> - struct range_iterator< wchar_t* > - { - typedef wchar_t* type; - }; - - template<> - struct range_iterator< const char* > - { - typedef const char* type; - }; - - template<> - struct range_iterator< const wchar_t* > - { - typedef const wchar_t* type; - }; - - template<> - struct range_iterator< char* const > - { - typedef char* type; - }; - - template<> - struct range_iterator< wchar_t* const > - { - typedef wchar_t* type; - }; - - template<> - struct range_iterator< const char* const > - { - typedef const char* type; - }; - - template<> - struct range_iterator< const wchar_t* const > - { - typedef const wchar_t* type; - }; - } // namespace boost -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +//#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #endif diff --git a/include/boost/range/iterator_range.hpp b/include/boost/range/iterator_range.hpp index bd77ffa..4304ecc 100755 --- a/include/boost/range/iterator_range.hpp +++ b/include/boost/range/iterator_range.hpp @@ -23,19 +23,24 @@ #include #include -#include +#include #include #include #include #include #include -#ifndef BOOST_OLD_IOSTREAMS -# include -#else -# include -#endif +#ifndef _STLP_NO_IOSTREAMS +# ifndef BOOST_OLD_IOSTREAMS +# include +# else +# include +# endif +#endif // _STLP_NO_IOSTREAMS #include +#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) + #pragma warning( disable : 4996 ) +#endif /*! \file Defines the \c iterator_class and related functions. @@ -70,7 +75,7 @@ namespace boost template< class Left, class Right > inline bool equal( const Left& l, const Right& r ) { - typedef BOOST_DEDUCED_TYPENAME boost::range_size::type sz_type; + typedef BOOST_DEDUCED_TYPENAME boost::range_difference::type sz_type; sz_type l_size = boost::size( l ), r_size = boost::size( r ); @@ -158,61 +163,66 @@ namespace boost //! iterator type typedef IteratorT iterator; - iterator_range() : m_Begin( iterator() ), m_End( iterator() ), - singular( true ) + iterator_range() : m_Begin( iterator() ), m_End( iterator() ) + #ifndef NDEBUG + , singular( true ) + #endif { } -/* -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - iterator_range( this_type r ) : - : m_Begin(r.begin()), m_End(r.end()) - { } - - this_type& operator=( this_type r ) - { - m_Begin = r.begin(); - m_End = r.end(); - return *this; - } -#endif -*/ + //! Constructor from a pair of iterators template< class Iterator > iterator_range( Iterator Begin, Iterator End ) : - m_Begin(Begin), m_End(End), singular(false) {} + m_Begin(Begin), m_End(End) + #ifndef NDEBUG + , singular(false) + #endif + {} //! Constructor from a Range template< class Range > iterator_range( const Range& r ) : - m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ), - singular(false) {} - + m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ) + #ifndef NDEBUG + , singular(false) + #endif + {} + //! Constructor from a Range template< class Range > iterator_range( Range& r ) : - m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ), - singular(false) {} + m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ) + #ifndef NDEBUG + , singular(false) + #endif + {} //! Constructor from a Range template< class Range > iterator_range( const Range& r, iterator_range_detail::const_range_tag ) : - m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ), - singular(false) {} + m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ) + #ifndef NDEBUG + , singular(false) + #endif + {} //! Constructor from a Range template< class Range > iterator_range( Range& r, iterator_range_detail::range_tag ) : - m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ), - singular(false) {} + m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ) + #ifndef NDEBUG + , singular(false) + #endif + {} #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) this_type& operator=( const this_type& r ) { m_Begin = r.begin(); m_End = r.end(); - // - // remark: this need not necessarily be true, but it does no harm - // + + #ifndef NDEBUG singular = r.singular; + #endif return *this; } #endif @@ -222,10 +232,9 @@ namespace boost { m_Begin = r.begin(); m_End = r.end(); - // - // remark: this need not necessarily be true, but it does no harm - // - singular = r.empty(); + #ifndef NDEBUG + singular = r.is_singular(); + #endif return *this; } @@ -234,7 +243,9 @@ namespace boost { m_Begin = impl::adl_begin( r ); m_End = impl::adl_end( r ); + #ifndef NDEBUG singular = false; + #endif return *this; } @@ -243,37 +254,33 @@ namespace boost { m_Begin = impl::adl_begin( r ); m_End = impl::adl_end( r ); + #ifndef NDEBUG singular = false; + #endif return *this; } IteratorT begin() const { + BOOST_ASSERT( !is_singular() ); return m_Begin; } IteratorT end() const { + BOOST_ASSERT( !is_singular() ); return m_End; } - size_type size() const + difference_type size() const { - if( singular ) - return 0; - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) - return std::distance( m_Begin, m_End ); -#else - return std::distance( m_Begin, m_End ); -#endif + BOOST_ASSERT( !is_singular() ); + return m_End - m_Begin; } bool empty() const { - if( singular ) - return true; - + BOOST_ASSERT( !is_singular() ); return m_Begin == m_End; } @@ -292,7 +299,8 @@ namespace boost bool equal( const iterator_range& r ) const { - return singular == r.singular && m_Begin == r.m_Begin && m_End == r.m_End; + BOOST_ASSERT( !is_singular() ); + return m_Begin == r.m_Begin && m_End == r.m_End; } @@ -300,17 +308,20 @@ namespace boost bool operator==( const iterator_range& r ) const { + BOOST_ASSERT( !is_singular() ); return iterator_range_detail::equal( *this, r ); } bool operator!=( const iterator_range& r ) const { + BOOST_ASSERT( !is_singular() ); return !operator==(r); } bool operator<( const iterator_range& r ) const { - return iterator_range_detail::less_than( *this, r ); + BOOST_ASSERT( !is_singular() ); + return iterator_range_detail::less_than( *this, r ); } #endif @@ -329,21 +340,33 @@ namespace boost return *--last; } - reference operator[]( size_type sz ) const + reference operator[]( difference_type at ) const { - //BOOST_STATIC_ASSERT( is_random_access ); - BOOST_ASSERT( sz < size() ); - return m_Begin[sz]; + BOOST_ASSERT( at >= 0 && at < size() ); + return m_Begin[at]; + } + + // + // When storing transform iterators, operator[]() + // fails because it returns by reference. Therefore + // operator()() is provided for these cases. + // + value_type operator()( difference_type at ) const + { + BOOST_ASSERT( at >= 0 && at < size() ); + return m_Begin[at]; } iterator_range& advance_begin( difference_type n ) { + BOOST_ASSERT( !is_singular() ); std::advance( m_Begin, n ); return *this; } iterator_range& advance_end( difference_type n ) { + BOOST_ASSERT( !is_singular() ); std::advance( m_End, n ); return *this; } @@ -352,25 +375,31 @@ namespace boost // begin and end iterators IteratorT m_Begin; IteratorT m_End; + + #ifndef NDEBUG bool singular; + #endif + + #ifndef NDEBUG + public: + bool is_singular() const + { + return singular; + } + #endif + + protected: + // + // Allow subclasses an easy way to access the + // base type + // + typedef iterator_range iterator_range_; }; // iterator range free-standing operators ---------------------------// -#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING -#else - template< class Iterator > - inline bool empty( const iterator_range& r ) - { - // - // this will preserve the well-defined empty() even - // though 'r' is singular. - // - return r.empty(); - } -#endif - -#ifndef BOOST_OLD_IOSTREAMS +#ifndef _STLP_NO_IOSTREAMS +# ifndef BOOST_OLD_IOSTREAMS //! iterator_range output operator /*! @@ -384,12 +413,12 @@ namespace boost { std::copy( r.begin(), r.end(), std::ostream_iterator< BOOST_DEDUCED_TYPENAME - iterator_value::type, + iterator_value::type, Elem, Traits>(Os) ); return Os; } -#else +# else //! iterator_range output operator /*! @@ -405,7 +434,8 @@ namespace boost return Os; } -#endif +# endif +#endif // _STLP_NO_IOSTREAMS ///////////////////////////////////////////////////////////////////// // comparison operators @@ -500,10 +530,10 @@ namespace boost #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template< typename Range > - inline iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator::type > + inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > make_iterator_range( Range& r ) { - return iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator::type > + return iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > ( boost::begin( r ), boost::end( r ) ); } @@ -522,10 +552,10 @@ namespace boost } template< class ForwardRange > - inline iterator_range< BOOST_DEDUCED_TYPENAME range_const_iterator::type > + inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > make_iterator_range( const ForwardRange& r ) { - return iterator_range< BOOST_DEDUCED_TYPENAME range_const_iterator::type > + return iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > ( r, iterator_range_detail::const_range_tag() ); } @@ -534,15 +564,19 @@ namespace boost namespace iterator_range_detail { template< class Range > - inline iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator::type > + inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > make_range_impl( Range& r, BOOST_DEDUCED_TYPENAME range_difference::type advance_begin, BOOST_DEDUCED_TYPENAME range_difference::type advance_end ) { - if( advance_begin == 0 && advance_end == 0 ) - return make_iterator_range( r ); + // + // Not worth the effort + // + //if( advance_begin == 0 && advance_end == 0 ) + // return make_iterator_range( r ); + // - BOOST_DEDUCED_TYPENAME range_result_iterator::type + BOOST_DEDUCED_TYPENAME range_iterator::type new_begin = boost::begin( r ), new_end = boost::end( r ); std::advance( new_begin, advance_begin ); @@ -554,7 +588,7 @@ namespace boost #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template< class Range > - inline iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator::type > + inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > make_iterator_range( Range& r, BOOST_DEDUCED_TYPENAME range_difference::type advance_begin, BOOST_DEDUCED_TYPENAME range_difference::type advance_end ) @@ -576,7 +610,7 @@ namespace boost } template< class Range > - inline iterator_range< BOOST_DEDUCED_TYPENAME range_const_iterator::type > + inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > make_iterator_range( const Range& r, BOOST_DEDUCED_TYPENAME range_difference::type advance_begin, BOOST_DEDUCED_TYPENAME range_difference::type advance_end ) @@ -606,3 +640,4 @@ namespace boost #undef BOOST_OLD_IOSTREAMS #endif + diff --git a/include/boost/range/metafunctions.hpp b/include/boost/range/metafunctions.hpp index 3bf899f..5b25a8f 100755 --- a/include/boost/range/metafunctions.hpp +++ b/include/boost/range/metafunctions.hpp @@ -16,13 +16,15 @@ #endif #include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include +#include +#include +#include #endif diff --git a/include/boost/range/mfc.hpp b/include/boost/range/mfc.hpp new file mode 100644 index 0000000..058e54e --- /dev/null +++ b/include/boost/range/mfc.hpp @@ -0,0 +1,984 @@ +#ifndef BOOST_RANGE_MFC_HPP +#define BOOST_RANGE_MFC_HPP + + + + +// Boost.Range MFC Extension +// +// Copyright Shunsuke Sogame 2005-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) + + + + +// config +// + + +#include // _MFC_VER + + +#if !defined(BOOST_RANGE_MFC_NO_CPAIR) + #if (_MFC_VER < 0x0700) // dubious + #define BOOST_RANGE_MFC_NO_CPAIR + #endif +#endif + + +#if !defined(BOOST_RANGE_MFC_HAS_LEGACY_STRING) + #if (_MFC_VER < 0x0700) // dubious + #define BOOST_RANGE_MFC_HAS_LEGACY_STRING + #endif +#endif + + +// A const collection of old MFC doesn't return const reference. +// +#if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + #if (_MFC_VER < 0x0700) // dubious + #define BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF + #endif +#endif + + + + +// forward declarations +// + + +template< class Type, class ArgType > +class CArray; + +template< class Type, class ArgType > +class CList; + +template< class Key, class ArgKey, class Mapped, class ArgMapped > +class CMap; + +template< class BaseClass, class PtrType > +class CTypedPtrArray; + +template< class BaseClass, class PtrType > +class CTypedPtrList; + +template< class BaseClass, class KeyPtrType, class MappedPtrType > +class CTypedPtrMap; + + + + +// extended customizations +// + + +#include // ptrdiff_t +#include // pair +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // legacy CString +#include // CXXXArray, CXXXList, CMapXXXToXXX +#include + + +namespace boost { namespace range_detail_microsoft { + + + // mfc_ptr_array_iterator + // + // 'void **' is not convertible to 'void const **', + // so we define... + // + + template< class ArrayT, class PtrType > + struct mfc_ptr_array_iterator; + + template< class ArrayT, class PtrType > + struct mfc_ptr_array_iterator_super + { + typedef iterator_adaptor< + mfc_ptr_array_iterator, + std::ptrdiff_t, // Base! + PtrType, // Value + random_access_traversal_tag, + use_default, + std::ptrdiff_t // Difference + > type; + }; + + template< class ArrayT, class PtrType > + struct mfc_ptr_array_iterator : + mfc_ptr_array_iterator_super::type + { + private: + typedef mfc_ptr_array_iterator self_t; + typedef typename mfc_ptr_array_iterator_super::type super_t; + typedef typename super_t::reference ref_t; + + public: + explicit mfc_ptr_array_iterator() + { } + + explicit mfc_ptr_array_iterator(ArrayT& arr, INT_PTR index) : + super_t(index), m_parr(boost::addressof(arr)) + { } + + template< class, class > friend struct mfc_ptr_array_iterator; + template< class ArrayT_, class PtrType_ > + mfc_ptr_array_iterator(mfc_ptr_array_iterator const& other) : + super_t(other.base()), m_parr(other.m_parr) + { } + + private: + ArrayT *m_parr; + + friend class iterator_core_access; + ref_t dereference() const + { + BOOST_ASSERT(0 <= this->base() && this->base() < m_parr->GetSize() && "out of range"); + return *( m_parr->GetData() + this->base() ); + } + + bool equal(self_t const& other) const + { + BOOST_ASSERT(m_parr == other.m_parr && "iterators incompatible"); + return this->base() == other.base(); + } + }; + + struct mfc_ptr_array_functions + { + template< class Iterator, class X > + Iterator begin(X& x) + { + return Iterator(x, 0); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return Iterator(x, x.GetSize()); + } + }; + + + // arrays + // + + template< > + struct customization< ::CByteArray > : + array_functions + { + template< class X > + struct meta + { + typedef BYTE val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + + template< > + struct customization< ::CDWordArray > : + array_functions + { + template< class X > + struct meta + { + typedef DWORD val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + + template< > + struct customization< ::CObArray > : + mfc_ptr_array_functions + { + template< class X > + struct meta + { + typedef mfc_ptr_array_iterator mutable_iterator; + typedef mfc_ptr_array_iterator const_iterator; + }; + }; + + + template< > + struct customization< ::CPtrArray > : + mfc_ptr_array_functions + { + template< class X > + struct meta + { + typedef mfc_ptr_array_iterator mutable_iterator; + typedef mfc_ptr_array_iterator const_iterator; + }; + }; + + + template< > + struct customization< ::CStringArray > : + array_functions + { + template< class X > + struct meta + { + typedef ::CString val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + + template< > + struct customization< ::CUIntArray > : + array_functions + { + template< class X > + struct meta + { + typedef UINT val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + + template< > + struct customization< ::CWordArray > : + array_functions + { + template< class X > + struct meta + { + typedef WORD val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + + // lists + // + + template< > + struct customization< ::CObList > : + list_functions + { + template< class X > + struct meta + { + typedef list_iterator mutable_iterator; + #if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + typedef list_iterator const_iterator; + #else + typedef list_iterator const_iterator; + #endif + }; + }; + + + template< > + struct customization< ::CPtrList > : + list_functions + { + template< class X > + struct meta + { + typedef list_iterator mutable_iterator; + #if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + typedef list_iterator const_iterator; + #else + typedef list_iterator const_iterator; + #endif + }; + }; + + + template< > + struct customization< ::CStringList > : + list_functions + { + template< class X > + struct meta + { + typedef ::CString val_t; + + typedef list_iterator mutable_iterator; + #if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + typedef list_iterator const_iterator; + #else + typedef list_iterator const_iterator; + #endif + }; + }; + + + // mfc_map_iterator + // + + template< class MapT, class KeyT, class MappedT > + struct mfc_map_iterator; + + template< class MapT, class KeyT, class MappedT > + struct mfc_map_iterator_super + { + typedef iterator_facade< + mfc_map_iterator, + std::pair, + forward_traversal_tag, + std::pair const + > type; + }; + + template< class MapT, class KeyT, class MappedT > + struct mfc_map_iterator : + mfc_map_iterator_super::type + { + private: + typedef mfc_map_iterator self_t; + typedef typename mfc_map_iterator_super::type super_t; + typedef typename super_t::reference ref_t; + + public: + explicit mfc_map_iterator() + { } + + explicit mfc_map_iterator(MapT const& map, POSITION pos) : + m_pmap(boost::addressof(map)), m_posNext(pos) + { + increment(); + } + + explicit mfc_map_iterator(MapT const& map) : + m_pmap(&map), m_pos(0) // end iterator + { } + + template< class, class, class > friend struct mfc_map_iterator; + template< class MapT_, class KeyT_, class MappedT_> + mfc_map_iterator(mfc_map_iterator const& other) : + m_pmap(other.m_pmap), + m_pos(other.m_pos), m_posNext(other.m_posNext), + m_key(other.m_key), m_mapped(other.m_mapped) + { } + + private: + MapT const *m_pmap; + POSITION m_pos, m_posNext; + KeyT m_key; MappedT m_mapped; + + friend class iterator_core_access; + ref_t dereference() const + { + BOOST_ASSERT(m_pos != 0 && "out of range"); + return std::make_pair(m_key, m_mapped); + } + + void increment() + { + BOOST_ASSERT(m_pos != 0 && "out of range"); + + if (m_posNext == 0) { + m_pos = 0; + return; + } + + m_pos = m_posNext; + m_pmap->GetNextAssoc(m_posNext, m_key, m_mapped); + } + + bool equal(self_t const& other) const + { + BOOST_ASSERT(m_pmap == other.m_pmap && "iterators incompatible"); + return m_pos == other.m_pos; + } + }; + + struct mfc_map_functions + { + template< class Iterator, class X > + Iterator begin(X& x) + { + return Iterator(x, x.GetStartPosition()); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return Iterator(x); + } + }; + + +#if !defined(BOOST_RANGE_MFC_NO_CPAIR) + + + // mfc_cpair_map_iterator + // + // used by ::CMap and ::CMapStringToString + // + + template< class MapT, class PairT > + struct mfc_cpair_map_iterator; + + template< class MapT, class PairT > + struct mfc_pget_map_iterator_super + { + typedef iterator_facade< + mfc_cpair_map_iterator, + PairT, + forward_traversal_tag + > type; + }; + + template< class MapT, class PairT > + struct mfc_cpair_map_iterator : + mfc_pget_map_iterator_super::type + { + private: + typedef mfc_cpair_map_iterator self_t; + typedef typename mfc_pget_map_iterator_super::type super_t; + typedef typename super_t::reference ref_t; + + public: + explicit mfc_cpair_map_iterator() + { } + + explicit mfc_cpair_map_iterator(MapT& map, PairT *pp) : + m_pmap(boost::addressof(map)), m_pp(pp) + { } + + template< class, class > friend struct mfc_cpair_map_iterator; + template< class MapT_, class PairT_> + mfc_cpair_map_iterator(mfc_cpair_map_iterator const& other) : + m_pmap(other.m_pmap), m_pp(other.m_pp) + { } + + private: + MapT *m_pmap; + PairT *m_pp; + + friend class iterator_core_access; + ref_t dereference() const + { + BOOST_ASSERT(m_pp != 0 && "out of range"); + return *m_pp; + } + + void increment() + { + BOOST_ASSERT(m_pp != 0 && "out of range"); + m_pp = m_pmap->PGetNextAssoc(m_pp); + } + + bool equal(self_t const& other) const + { + BOOST_ASSERT(m_pmap == other.m_pmap && "iterators incompatible"); + return m_pp == other.m_pp; + } + }; + + struct mfc_cpair_map_functions + { + template< class Iterator, class X > + Iterator begin(X& x) + { + // Workaround: + // Assertion fails if empty. + // MFC document is wrong. + #if !defined(NDEBUG) + if (x.GetCount() == 0) + return Iterator(x, 0); + #endif + + return Iterator(x, x.PGetFirstAssoc()); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return Iterator(x, 0); + } + }; + + +#endif // !defined(BOOST_RANGE_MFC_NO_CPAIR) + + + // maps + // + + template< > + struct customization< ::CMapPtrToWord > : + mfc_map_functions + { + template< class X > + struct meta + { + typedef void *key_t; + typedef WORD mapped_t; + + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + }; + }; + + + template< > + struct customization< ::CMapPtrToPtr > : + mfc_map_functions + { + template< class X > + struct meta + { + typedef void *key_t; + typedef void *mapped_t; + + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + }; + }; + + + template< > + struct customization< ::CMapStringToOb > : + mfc_map_functions + { + template< class X > + struct meta + { + typedef ::CString key_t; + typedef ::CObject *mapped_t; + + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + }; + }; + + + template< > + struct customization< ::CMapStringToPtr > : + mfc_map_functions + { + template< class X > + struct meta + { + typedef ::CString key_t; + typedef void *mapped_t; + + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + }; + }; + + + template< > + struct customization< ::CMapStringToString > : + #if !defined(BOOST_RANGE_MFC_NO_CPAIR) + mfc_cpair_map_functions + #else + mfc_map_functions + #endif + { + template< class X > + struct meta + { + #if !defined(BOOST_RANGE_MFC_NO_CPAIR) + typedef typename X::CPair pair_t; + + typedef mfc_cpair_map_iterator mutable_iterator; + typedef mfc_cpair_map_iterator const_iterator; + #else + typedef ::CString key_t; + typedef ::CString mapped_t; + + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + #endif + }; + }; + + + template< > + struct customization< ::CMapWordToOb > : + mfc_map_functions + { + template< class X > + struct meta + { + typedef WORD key_t; + typedef ::CObject *mapped_t; + + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + }; + }; + + + template< > + struct customization< ::CMapWordToPtr > : + mfc_map_functions + { + template< class X > + struct meta + { + typedef WORD key_t; + typedef void *mapped_t; + + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + }; + }; + + + // templates + // + + template< class Type, class ArgType > + struct customization< ::CArray > : + array_functions + { + template< class X > + struct meta + { + typedef Type val_t; + + typedef val_t *mutable_iterator; + typedef val_t const *const_iterator; + }; + }; + + + template< class Type, class ArgType > + struct customization< ::CList > : + list_functions + { + template< class X > + struct meta + { + typedef Type val_t; + + typedef list_iterator mutable_iterator; + #if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + typedef list_iterator const_iterator; + #else + typedef list_iterator const_iterator; + #endif + }; + }; + + + template< class Key, class ArgKey, class Mapped, class ArgMapped > + struct customization< ::CMap > : + #if !defined(BOOST_RANGE_MFC_NO_CPAIR) + mfc_cpair_map_functions + #else + mfc_map_functions + #endif + { + template< class X > + struct meta + { + #if !defined(BOOST_RANGE_MFC_NO_CPAIR) + typedef typename X::CPair pair_t; + + typedef mfc_cpair_map_iterator mutable_iterator; + typedef mfc_cpair_map_iterator const_iterator; + #else + typedef Key key_t; + typedef Mapped mapped_t; + + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + #endif + }; + }; + + + template< class BaseClass, class PtrType > + struct customization< ::CTypedPtrArray > + { + template< class X > + struct fun + { + typedef typename remove_pointer::type val_t; + + typedef typename mpl::if_< is_const, + val_t const, + val_t + >::type val_t_; + + typedef val_t_ * const result_type; + + template< class PtrType_ > + result_type operator()(PtrType_ p) const + { + return static_cast(p); + } + }; + + template< class X > + struct meta + { + typedef typename compatible_mutable_iterator::type miter_t; + typedef typename range_const_iterator::type citer_t; + + typedef transform_iterator, miter_t> mutable_iterator; + typedef transform_iterator, citer_t> const_iterator; + }; + + template< class Iterator, class X > + Iterator begin(X& x) + { + return Iterator(boost::begin(x), fun()); + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return Iterator(boost::end(x), fun()); + } + }; + + + template< class BaseClass, class PtrType > + struct customization< ::CTypedPtrList > : + list_functions + { + template< class X > + struct meta + { + typedef typename remove_pointer::type val_t; + + // not l-value + typedef list_iterator mutable_iterator; + typedef list_iterator const_iterator; + }; + }; + + + template< class BaseClass, class KeyPtrType, class MappedPtrType > + struct customization< ::CTypedPtrMap > : + mfc_map_functions + { + template< class X > + struct meta + { + typedef mfc_map_iterator mutable_iterator; + typedef mutable_iterator const_iterator; + }; + }; + + + // strings + // + +#if defined(BOOST_RANGE_MFC_HAS_LEGACY_STRING) + + template< > + struct customization< ::CString > + { + template< class X > + struct meta + { + // LPTSTR/LPCTSTR is not always defined in . + typedef TCHAR *mutable_iterator; + typedef TCHAR const *const_iterator; + }; + + template< class Iterator, class X > + typename mutable_::type begin(X& x) + { + return x.GetBuffer(0); + } + + template< class Iterator, class X > + Iterator begin(X const& x) + { + return x; + } + + template< class Iterator, class X > + Iterator end(X& x) + { + return begin(x) + x.GetLength(); + } + }; + +#endif // defined(BOOST_RANGE_MFC_HAS_LEGACY_STRING) + + +} } // namespace boost::range_detail_microsoft + + + + +// range customizations +// + + +// arrays +// +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CByteArray +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CDWordArray +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CStringArray +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CUIntArray +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CWordArray +) + + +// lists +// +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CObList +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CPtrList +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CStringList +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CObArray +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CPtrArray +) + + +// maps +// +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CMapPtrToWord +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CMapPtrToPtr +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CMapStringToOb +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CMapStringToPtr +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CMapStringToString +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CMapWordToOb +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CMapWordToPtr +) + + +// templates +// +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CArray, 2 +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CList, 2 +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CMap, 4 +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CTypedPtrArray, 2 +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CTypedPtrList, 2 +) + +BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TEMPLATE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CTypedPtrMap, 3 +) + + +// strings +// +#if defined(BOOST_RANGE_MFC_HAS_LEGACY_STRING) + + BOOST_RANGE_DETAIL_MICROSOFT_CUSTOMIZATION_TYPE( + boost::range_detail_microsoft::using_type_as_tag, + BOOST_PP_NIL, CString + ) + +#endif + + + + +#endif diff --git a/include/boost/range/mutable_iterator.hpp b/include/boost/range/mutable_iterator.hpp new file mode 100755 index 0000000..2f45c16 --- /dev/null +++ b/include/boost/range/mutable_iterator.hpp @@ -0,0 +1,64 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_MUTABLE_ITERATOR_HPP +#define BOOST_RANGE_MUTABLE_ITERATOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else + +#include +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct range_mutable_iterator + { + typedef BOOST_DEDUCED_TYPENAME C::iterator type; + }; + + ////////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + struct range_mutable_iterator< std::pair > + { + typedef Iterator type; + }; + + ////////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + struct range_mutable_iterator< T[sz] > + { + typedef T* type; + }; + +} // namespace boost + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif diff --git a/include/boost/range/pointer.hpp b/include/boost/range/pointer.hpp new file mode 100755 index 0000000..e7431ff --- /dev/null +++ b/include/boost/range/pointer.hpp @@ -0,0 +1,29 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2006. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_POINTER_TYPE_HPP +#define BOOST_RANGE_POINTER_TYPE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + template< class T > + struct range_pointer : iterator_pointer< typename range_iterator::type > + { }; +} + +#endif diff --git a/include/boost/range/rbegin.hpp b/include/boost/range/rbegin.hpp index 0fcf00c..78e5f61 100755 --- a/include/boost/range/rbegin.hpp +++ b/include/boost/range/rbegin.hpp @@ -16,9 +16,7 @@ #endif #include -#include #include -#include namespace boost { @@ -26,30 +24,28 @@ namespace boost #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template< class C > -inline BOOST_DEDUCED_TYPENAME range_reverse_result_iterator::type +inline BOOST_DEDUCED_TYPENAME range_reverse_iterator::type rbegin( C& c ) { - return BOOST_DEDUCED_TYPENAME range_reverse_result_iterator::type( end( c ) ); + return BOOST_DEDUCED_TYPENAME range_reverse_iterator::type( boost::end( c ) ); } #else template< class C > -inline BOOST_DEDUCED_TYPENAME range_reverse_iterator< - typename remove_const::type >::type +inline BOOST_DEDUCED_TYPENAME range_reverse_iterator::type rbegin( C& c ) { - typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator< - typename remove_const::type >::type + typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator::type iter_type; return iter_type( boost::end( c ) ); } template< class C > -inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type +inline BOOST_DEDUCED_TYPENAME range_reverse_iterator::type rbegin( const C& c ) { - typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type + typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator::type iter_type; return iter_type( boost::end( c ) ); } @@ -57,7 +53,7 @@ rbegin( const C& c ) #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING template< class T > -inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type +inline BOOST_DEDUCED_TYPENAME range_reverse_iterator::type const_rbegin( const T& r ) { return boost::rbegin( r ); @@ -66,3 +62,4 @@ const_rbegin( const T& r ) } // namespace 'boost' #endif + diff --git a/include/boost/range/reference.hpp b/include/boost/range/reference.hpp new file mode 100755 index 0000000..d308e43 --- /dev/null +++ b/include/boost/range/reference.hpp @@ -0,0 +1,29 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_REFERENCE_TYPE_HPP +#define BOOST_RANGE_REFERENCE_TYPE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + template< class T > + struct range_reference : iterator_reference< typename range_iterator::type > + { }; +} + +#endif diff --git a/include/boost/range/rend.hpp b/include/boost/range/rend.hpp index 3e91ff7..fd79aa2 100755 --- a/include/boost/range/rend.hpp +++ b/include/boost/range/rend.hpp @@ -16,9 +16,7 @@ #endif #include -#include #include -#include namespace boost { @@ -26,30 +24,28 @@ namespace boost #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template< class C > -inline BOOST_DEDUCED_TYPENAME range_reverse_result_iterator::type +inline BOOST_DEDUCED_TYPENAME range_reverse_iterator::type rend( C& c ) { - return BOOST_DEDUCED_TYPENAME range_reverse_result_iterator::type( boost::begin( c ) ); + return BOOST_DEDUCED_TYPENAME range_reverse_iterator::type( boost::begin( c ) ); } #else template< class C > -inline BOOST_DEDUCED_TYPENAME range_reverse_iterator< - typename remove_const::type >::type +inline BOOST_DEDUCED_TYPENAME range_reverse_iterator::type rend( C& c ) { - typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator< - typename remove_const::type >::type + typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator::type iter_type; return iter_type( boost::begin( c ) ); } template< class C > -inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type +inline BOOST_DEDUCED_TYPENAME range_reverse_iterator::type rend( const C& c ) { - typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type + typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator::type iter_type; return iter_type( boost::begin( c ) ); } @@ -57,7 +53,7 @@ rend( const C& c ) #endif template< class T > -inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type +inline BOOST_DEDUCED_TYPENAME range_reverse_iterator::type const_rend( const T& r ) { return boost::rend( r ); @@ -66,3 +62,4 @@ const_rend( const T& r ) } // namespace 'boost' #endif + diff --git a/include/boost/range/result_iterator.hpp b/include/boost/range/result_iterator.hpp index 86e71cd..ba09c5f 100755 --- a/include/boost/range/result_iterator.hpp +++ b/include/boost/range/result_iterator.hpp @@ -15,29 +15,19 @@ # pragma once #endif -#include #include -#include -#include -#include namespace boost { - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// + // + // This interface is deprecated, use range_iterator + // template< typename C > - struct range_result_iterator - { - typedef BOOST_RANGE_DEDUCED_TYPENAME - mpl::if_< BOOST_DEDUCED_TYPENAME is_const::type, - BOOST_DEDUCED_TYPENAME range_const_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type >::type type; - }; + struct range_result_iterator : range_iterator + { }; } // namespace boost -//#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #endif diff --git a/include/boost/range/reverse_result_iterator.hpp b/include/boost/range/reverse_result_iterator.hpp index bb17389..62bf135 100755 --- a/include/boost/range/reverse_result_iterator.hpp +++ b/include/boost/range/reverse_result_iterator.hpp @@ -15,22 +15,17 @@ # pragma once #endif -#include -#include -#include +#include namespace boost { - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// + // + // This interface is deprecated, use range_reverse_iterator + // template< typename C > - struct range_reverse_result_iterator - { - typedef reverse_iterator< - BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator::type > type; - }; + struct range_reverse_result_iterator : range_reverse_iterator + { }; } // namespace boost diff --git a/include/boost/range/size.hpp b/include/boost/range/size.hpp index 88201da..311a692 100755 --- a/include/boost/range/size.hpp +++ b/include/boost/range/size.hpp @@ -15,109 +15,22 @@ # pragma once #endif -#include - -#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING -#include -#else - -#include -#include -#include -#include -#include +#include +#include +#include +#include namespace boost { -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -namespace range_detail -{ -#endif - ////////////////////////////////////////////////////////////////////// - // primary template - ////////////////////////////////////////////////////////////////////// - - template< typename C > - inline BOOST_DEDUCED_TYPENAME C::size_type - boost_range_size( const C& c ) - { - return c.size(); - } - - ////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - inline std::size_t boost_range_size( const std::pair& p ) - { - return std::distance( p.first, p.second ); - } - - ////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////// - - template< typename T, std::size_t sz > - inline std::size_t boost_range_size( const T (&array)[sz] ) - { - return range_detail::array_size( array ); - } - - template< typename T, std::size_t sz > - inline std::size_t boost_range_size( T (&array)[sz] ) - { - return boost::range_detail::array_size( array ); - } - - ////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////// - - inline std::size_t boost_range_size( const char* const& s ) - { - return boost::range_detail::str_size( s ); - } - - inline std::size_t boost_range_size( const wchar_t* const& s ) - { - return boost::range_detail::str_size( s ); - } - -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -} // namespace 'range_detail' -#endif - -template< class T > -inline BOOST_DEDUCED_TYPENAME range_size::type size( const T& r ) -{ -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - using namespace range_detail; -#endif - return boost_range_size( r ); -} - - -#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -// BCB and CW are not able to overload pointer when class overloads are also available. -inline range_size::type size( const char* r ) { - return range_detail::str_size( r ); -} -inline range_size::type size( char* r ) { - return range_detail::str_size( r ); -} -inline range_size::type size( const wchar_t* r ) { - return range_detail::str_size( r ); -} -inline range_size::type size( wchar_t* r ) { - return range_detail::str_size( r ); -} -#endif - + template< class T > + inline BOOST_DEDUCED_TYPENAME range_difference::type size( const T& r ) + { + BOOST_ASSERT( (boost::end( r ) - boost::begin( r )) >= 0 && + "reachability invariant broken!" ); + return boost::end( r ) - boost::begin( r ); + } } // namespace 'boost' -#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - #endif diff --git a/include/boost/range/size_type.hpp b/include/boost/range/size_type.hpp index 57f191d..7ed8dfa 100755 --- a/include/boost/range/size_type.hpp +++ b/include/boost/range/size_type.hpp @@ -16,158 +16,60 @@ #endif #include -/* -#include - -namespace boost -{ - namespace range_detail - { - template< class T > - struct add_unsigned; - - template<> - struct add_unsigned - { - typedef unsigned short type; - }; - - template<> - struct add_unsigned - { - typedef unsigned int type; - }; - - template<> - struct add_unsigned - { - typedef unsigned long type; - }; - -#ifdef BOOST_HAS_LONG_LONG - - template<> - struct add_unsigned - { - typedef unsigned long long type; - }; -#endif - - } - - template< class T > - struct range_size - { - typedef BOOST_DEDUCED_TYPENAME range_detail::add_unsigned< - BOOST_DEDUCED_TYPENAME range_difference::type >::type - type; - }; -} -*/ #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #include #else +#include #include #include namespace boost { - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// - - template< typename C > - struct range_size + namespace detail { - typedef BOOST_DEDUCED_TYPENAME C::size_type type; - }; - ////////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + template< typename C > + struct range_size + { + typedef BOOST_DEDUCED_TYPENAME C::size_type type; + }; + + ////////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + struct range_size< std::pair > + { + typedef std::size_t type; + }; + + ////////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + struct range_size< T[sz] > + { + typedef std::size_t type; + }; + } - template< typename Iterator > - struct range_size< std::pair > - { - typedef std::size_t type; - }; - - template< typename Iterator > - struct range_size< const std::pair > - { - typedef std::size_t type; - }; - - ////////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////////// - - template< typename T, std::size_t sz > - struct range_size< T[sz] > - { - typedef std::size_t type; - }; - - template< typename T, std::size_t sz > - struct range_size< const T[sz] > - { - typedef std::size_t type; - }; - - ////////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////////// - - template<> - struct range_size< char* > - { - typedef std::size_t type; - }; - - template<> - struct range_size< wchar_t* > - { - typedef std::size_t type; - }; - - template<> - struct range_size< const char* > - { - typedef std::size_t type; - }; - - template<> - struct range_size< const wchar_t* > - { - typedef std::size_t type; - }; - - template<> - struct range_size< char* const > - { - typedef std::size_t type; - }; - - template<> - struct range_size< wchar_t* const > - { - typedef std::size_t type; - }; - - template<> - struct range_size< const char* const > - { - typedef std::size_t type; - }; - - template<> - struct range_size< const wchar_t* const > - { - typedef std::size_t type; - }; + template< class T > + struct range_size : + detail::range_size + { }; + template< class T > + struct range_size : range_size + { }; + } // namespace boost #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/range/sub_range.hpp b/include/boost/range/sub_range.hpp index 7781fca..802454b 100755 --- a/include/boost/range/sub_range.hpp +++ b/include/boost/range/sub_range.hpp @@ -11,10 +11,13 @@ #ifndef BOOST_RANGE_SUB_RANGE_HPP #define BOOST_RANGE_SUB_RANGE_HPP +#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) + #pragma warning( disable : 4996 ) +#endif + #include #include #include -#include #include #include #include @@ -23,34 +26,29 @@ namespace boost { template< class ForwardRange > - class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator::type > + class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > { - typedef BOOST_DEDUCED_TYPENAME range_result_iterator::type iterator_t; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; typedef iterator_range< iterator_t > base; typedef BOOST_DEDUCED_TYPENAME base::impl impl; public: typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; - typedef BOOST_DEDUCED_TYPENAME range_result_iterator::type iterator; - typedef BOOST_DEDUCED_TYPENAME range_const_iterator::type const_iterator; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type const_iterator; typedef BOOST_DEDUCED_TYPENAME range_difference::type difference_type; typedef BOOST_DEDUCED_TYPENAME range_size::type size_type; typedef BOOST_DEDUCED_TYPENAME base::reference reference; - typedef BOOST_DEDUCED_TYPENAME iterator_reference::type const_reference; public: sub_range() : base() { } - -/* - template< class ForwardRange2 > - sub_range( sub_range r ) : - -#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 ) - base( impl::adl_begin( r ), impl::adl_end( r ) ) -#else - base( r ) -#endif */ + +#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) + sub_range( const sub_range& r ) + : base( static_cast( r ) ) + { } +#endif template< class ForwardRange2 > sub_range( ForwardRange2& r ) : @@ -89,15 +87,11 @@ namespace boost { base::operator=( r ); return *this; - } + } - sub_range& operator=( sub_range r ) + sub_range& operator=( const sub_range& r ) { - // - // argument passed by value to avoid - // const_iterator to iterator conversion - // - base::operator=( r ); + base::operator=( static_cast(r) ); return *this; } @@ -107,7 +101,7 @@ namespace boost const_iterator begin() const { return base::begin(); } iterator end() { return base::end(); } const_iterator end() const { return base::end(); } - size_type size() const { return base::size(); } + difference_type size() const { return base::size(); } public: // convenience @@ -116,7 +110,7 @@ namespace boost return base::front(); } - const_reference front() const + const value_type& front() const { return base::front(); } @@ -126,17 +120,17 @@ namespace boost return base::back(); } - const_reference back() const + const value_type& back() const { return base::back(); } - reference operator[]( size_type sz ) + reference operator[]( difference_type sz ) { return base::operator[](sz); } - const_reference operator[]( size_type sz ) const + const value_type& operator[]( difference_type sz ) const { return base::operator[](sz); } @@ -168,3 +162,4 @@ namespace boost } // namespace 'boost' #endif + diff --git a/include/boost/range/value_type.hpp b/include/boost/range/value_type.hpp index 15537b0..95c7580 100755 --- a/include/boost/range/value_type.hpp +++ b/include/boost/range/value_type.hpp @@ -18,129 +18,17 @@ #include #include -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#include -#else +//#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +//#include +//#else #include namespace boost { - template< class T > - struct range_value - { - typedef BOOST_DEDUCED_TYPENAME iterator_value< - BOOST_DEDUCED_TYPENAME range_iterator::type >::type - type; - }; + template< class T > + struct range_value : iterator_value< typename range_iterator::type > + { }; } -/* -#include -#include - - -namespace boost -{ - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// - - template< typename C > - struct range_value - { - typedef BOOST_DEDUCED_TYPENAME C::value_type type; - }; - - ////////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - struct range_value< std::pair > - { - typedef BOOST_DEDUCED_TYPENAME - iterator_value::type type; - }; - - - template< typename Iterator > - struct range_value< const std::pair > - { - typedef BOOST_DEDUCED_TYPENAME - iterator_value::type type; - }; - - ////////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////////// - - template< typename T, std::size_t sz > - struct range_value< T[sz] > - { - typedef T type; - }; - - template< typename T, std::size_t sz > - struct range_value< const T[sz] > - { - typedef const T type; - }; - - ////////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////////// - - template<> - struct range_value< char* > - { - typedef char type; - }; - - template<> - struct range_value< wchar_t* > - { - typedef wchar_t type; - }; - - template<> - struct range_value< const char* > - { - typedef const char type; - }; - - template<> - struct range_value< const wchar_t* > - { - typedef const wchar_t type; - }; - - template<> - struct range_value< char* const > - { - typedef char type; - }; - - template<> - struct range_value< wchar_t* const > - { - typedef wchar_t type; - }; - - template<> - struct range_value< const char* const > - { - typedef const char type; - }; - - template<> - struct range_value< const wchar_t* const > - { - typedef const wchar_t type; - }; - -} // namespace boost -*/ -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - #endif From a33d5c22c593af87a481a13390f28c5caa70a571 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:38:02 +0000 Subject: [PATCH 13/73] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41370] --- doc/Jamfile.v2 | 22 + doc/boost_range.html | 1266 +++++++++++++++++----------------- doc/boost_range.qbk | 1234 +++++++++++++++++++++++++++++++++ doc/example.cpp | 7 - doc/examples.html | 6 +- doc/faq.html | 2 +- doc/headers.html | 59 +- doc/history_ack.html | 2 +- doc/intro.html | 30 +- doc/mfc_atl.html | 581 ++++++++++++++++ doc/mfc_atl.rst | 232 +++++++ doc/portability.html | 4 +- doc/range.html | 211 +----- doc/style.css | 7 - doc/style.html | 2 +- doc/utility_class.html | 73 +- index.html | 10 +- test/TODO | 1 + test/algorithm_example.cpp | 13 +- test/array.cpp | 10 +- test/atl.cpp | 623 +++++++++++++++++ test/compat1.cpp | 0 test/extension_mechanism.cpp | 15 +- test/iterator_pair.cpp | 19 +- test/iterator_range.cpp | 26 +- test/mfc.cpp | 787 +++++++++++++++++++-- test/partial_workaround.cpp | 7 +- test/reversible_range.cpp | 31 +- test/std_container.cpp | 12 +- test/string.cpp | 146 ++-- test/sub_range.cpp | 33 +- 31 files changed, 4352 insertions(+), 1119 deletions(-) create mode 100644 doc/Jamfile.v2 create mode 100644 doc/boost_range.qbk create mode 100644 doc/mfc_atl.html create mode 100644 doc/mfc_atl.rst create mode 100644 test/TODO create mode 100644 test/atl.cpp create mode 100755 test/compat1.cpp diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 new file mode 100644 index 0000000..0fafdd7 --- /dev/null +++ b/doc/Jamfile.v2 @@ -0,0 +1,22 @@ + +use-project boost : $(BOOST_ROOT) ; + + +import boostbook : boostbook ; +import quickbook ; + +xml boost_range : boost_range.qbk ; + +boostbook standalone + : + boost_range + : + toc.max.depth=2 + toc.section.depth=4 + chunk.section.depth=2 + +# generate.section.toc.level=4 +# chunk.first.sections=7 +# toc.section.depth=10 + ; + diff --git a/doc/boost_range.html b/doc/boost_range.html index 16ef3f3..ace1901 100644 --- a/doc/boost_range.html +++ b/doc/boost_range.html @@ -1,86 +1,87 @@ - - Boost.Range Reference - - - - - - - - - -


- Boost.Range -

-
-

Synopsis and Reference -

- -
- -

Overview

-

- Four types of objects are currently supported by the library: -

    -
  • - standard-like containers -
  • - std::pair<iterator,iterator> -
  • - null terminated strings (this includes char[],wchar_t[], - char*, and wchar_t*) -

    - Warning: support for null-terminated strings is deprecated and will - disappear in the next Boost release (1.34). -

    -
  • - built-in arrays -
  • -
- Even though the behavior of the primary templates are exactly such that - standard containers will be supported by default, the requirements are much - lower than the standard container requirements. For example, the utility class - iterator_range implements the minimal - interface required to make the class a Forward - Range - . -

-

- Please also see Range concepts for more details. -

- -

Synopsis

-

-

+    
+        Boost.Range Reference 
+        
+        
+    
+    
+        
+            
+                
+                
+            
+        


+ Boost.Range +

+
+

Synopsis and Reference +

+ +
+ +

Overview

+

+ Three types of objects are currently supported by the library: +

    +
  • + standard-like containers +
  • + std::pair<iterator,iterator> +
  • + built-in arrays +
  • +
+ Even though the behavior of the primary templates are exactly such that + standard containers will be supported by default, the requirements are much + lower than the standard container requirements. For example, the utility class + iterator_range implements the minimal + interface required to make the class a Forward + Range + . +

+

+ Please also see Range concepts for more details. +

+ +

Synopsis

+

+

 namespace boost
 {
     //
     // Single Pass Range metafunctions
     //
-    
-    template< class T >
-    struct range_value;
-                 
+                   
     template< class T >
     struct range_iterator;
     
     template< class T >
-    struct range_const_iterator;
+    struct range_value;
+  
+    template< class T >
+    struct range_reference;
+
+    template< class T >
+    struct range_pointer;
     
+    template< class T >
+    struct range_category;
+
     //
     // Forward Range metafunctions
     //
@@ -89,10 +90,6 @@ class=identifier>range_const_iterator;
     struct range_difference;
     
-    template< class T >
-    struct range_size;
-    
     //
     // Bidirectional Range metafunctions
     //
@@ -101,56 +98,38 @@ class=identifier>range_size;
     struct range_reverse_iterator;
-
-    template< class T >
-    struct range_const_reverse_iterator;
     
-    //
-    // Special metafunctions
-    //
-    
-    template< class T >
-    struct range_result_iterator;
-                 
-    template< class T >
-    struct range_reverse_result_iterator;
-
     //
     // Single Pass Range functions
     //
     
     template< class T >
     typename range_iterator<T>::type
-    begin( T& c );
+    begin( T& r );
     
     template< class T >
-    typename range_const_iterator<T>::type
-    begin( const T& c );
+    typename range_iterator<const T>::type
+    begin( const T& r );
         
     template< class T >
     typename range_iterator<T>::type
-    end( T& c );
+    end( T& r );
                       
     template< class T >
-    typename range_const_iterator<T>::type
-    end( const T& c );
+    typename range_iterator<const T>::type
+    end( const T& r );
     
     template< class T >
     bool
-    empty( const T& c );
+    empty( const T& r );
                
     //
     // Forward Range functions
     //
     
     template< class T >
-    typename range_size<T>::type
-    size( const T& c );
+    typename range_difference<T>::type
+    distance( const T& r );
                             
     //
     // Bidirectional Range functions
@@ -158,546 +137,585 @@ class=identifier>range_reverse_result_iterator;
                      
     template< class T >
     typename range_reverse_iterator<T>::type
-    rbegin( T& c );
+    rbegin( T& r );
     
     template< class T >
-    typename range_const_reverse_iterator<T>::type
-    rbegin( const T& c );
+    typename range_reverse_iterator<const T>::type
+    rbegin( const T& r );
         
     template< class T >
     typename range_reverse_iterator<T>::type
-    rend( T& c );
+    rend( T& r );
                       
     template< class T >
-    typename range_const_reverse_iterator<T>::type
+    typename range_reverse_iterator<const T>::type
     rend( const T& c );
+class=identifier>T& r );
     
+    //
+    // Random Access Range functions
+    //
+    
+    template< class T >
+    typename range_difference<T>::type
+    size( const T& r );
+    
     //
     // Special const Range functions
     // 
     
     template< class T >
-    typename range_const_iterator<T>::type 
+    typename range_iterator<const T>::type 
     const_begin( const T& r );
     
     template< class T >
-    typename range_const_iterator<T>::type 
+    typename range_iterator<const T>::type 
     const_end( const T& r );
     
     template< class T >
-    typename range_const_reverse_iterator<T>::type 
+    typename range_reverse_iterator<const T>::type 
     const_rbegin( const T& r );
     
     template< class T >
-    typename range_const_reverse_iterator<T>::type 
+    typename range_reverse_iterator<const T>::type 
     const_rend( const T& r );
 
+    //
+    // String utilities
+    //
+    
+    template< class T >
+    iterator_range<...see below...> 
+    as_literal( T& r );
+
+    template< class T >
+    iterator_range<...see below...> 
+    as_literal( const T& r );
+
+    template< class T >
+    iterator_range< typename range_iterator<T>::type > 
+    as_array( T& r );
+
+    template< class T >
+    iterator_range< typename range_iterator<const T>::type > 
+    as_array( const T& r );
+
 } // namespace 'boost' 
 
 
-

- -

Semantics

-

notation

-

- - - - - - - - - - - - - - - - -
- Type - - Object - - Describes -
X - x - any type
T - t - denotes behavior of the primary templates
P - p - denotes std::pair<iterator,iterator>
A[sz] - a - denotes an array of type A of size sz -
Char* - s - denotes either char* or wchar_t*
-

-

- Please notice in tables below that when four lines appear in a cell, the first - line will describe the primary template, the second line pairs of iterators, - the third line arrays and the last line null-terminated strings. -

-

Metafunctions

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Expression - Return type - Complexity
range_value<X>::typeT::value_type
- boost::iterator_value<P::first_type>::type
- A
- Char -
compile time
range_iterator<X>::typeT::iterator
- P::first_type
- A*
- Char* -
compile time
range_const_iterator<X>::typeT::const_iterator
- P::first_type
- const A*
- const Char* -
compile time
range_difference<X>::typeT::difference_type
- boost::iterator_difference<P::first_type>::type
- std::ptrdiff_t
- std::ptrdiff_t
-
compile time
range_size<X>::typeT::size_type
- std::size_t
- std::size_t
- std::size_t
-
compile time
range_result_iterator<X>::typerange_const_iterator<X>::type if X is const -
- range_iterator<X>::type otherwise -
compile time
range_reverse_iterator<X>::typeboost::reverse_iterator< typename range_iterator<T>::type >
-
compile time
range_const_reverse_iterator<X>::typeboost::reverse_iterator< typename range_const_iterator<T>::type > -
-
compile time
range_reverse_result_iterator<X>::typeboost::reverse_iterator< typename range_result_iterator<T>::type - > - compile time
-

-

- The special metafunctions range_result_iterator and range_reverse_result_iterator - are not part of any Range concept, but they are very useful when implementing - certain Range classes like sub_range - because of their ability to select iterators based on constness. -

-

Functions

-

- - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + - -

Method 1: provide member functions and nested types

- -

- This procedure assumes that you have control over the types that should be made - conformant to a Range concept. If not, see method 2. -

- -

- The primary templates in this library are implemented such that standard - containers will work automatically and so will boost::array. - Below is given an overview of which member functions and member types a class - must specify to be useable as a certain Range concept. -

-

-

- Expression - Return type - Returns - Complexity
begin(x)range_result_iterator<X>::type - p.first if p is of type std::pair<T>
- a if a is an array
- s if s is a string literal
- boost_range_begin(x) if that expression would invoke a function found by ADL
- t.begin() otherwise +

+ +

Semantics

+

notation

+

+ + + + + + + + + + + + + + + + +
+ Type + + Object + + Describes +
X + x + any type
T + t + denotes behavior of the primary templates
P + p + denotes std::pair<iterator,iterator>
A[sz] + a + denotes an array of type A of size sz +
Char* + s + denotes either char* or wchar_t*
+

+

+ Please notice in tables below that when four lines appear in a cell, the first + line will describe the primary template, the second line pairs of iterators, + the third line arrays and the last line null-terminated strings. +

+

Metafunctions

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Expression + Return type + Complexity
range_iterator<X>::typeT::iterator
+ P::first_type
+ A*
+ +
compile time
range_iterator<const X>::typeT::const_iterator
+ P::first_type
+ const A*
+ +
compile time
range_value<X>::typeboost::iterator_value<range_iterator<X>::type>::type + compile time
range_reference<X>::typeboost::iterator_reference<range_iterator<X>::type>::type + compile time
range_pointer<X>::typeboost::iterator_pointer<range_iterator<X>::type>::type + compile time
range_category<X>::typeboost::iterator_category<range_iterator<X>::type>::type + compile time
range_difference<X>::type + boost::iterator_difference<range_iterator<X>::type>::typecompile time
range_reverse_iterator<X>::typeboost::reverse_iterator<range_iterator<X>::type>
+
compile time
range_reverse_iterator<const X>::typeboost::reverse_iterator<range_iterator<const X>::type> +
+
compile time
+

+

Functions

+

+ + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ Expression + Return type + Returns + Complexity
begin(x)range_iterator<X>::type + p.first if p is of type std::pair<T>
+ a if a is an array
+ range_begin(x) if that expression would invoke a function found by ADL
+ t.begin() otherwise -
constant time
end(x)range_result_iterator<X>::type - p.second if p is of type std::pair<T>
- a + sz if a is an array of size sz
- s + std::char_traits<X>::length( s ) if s is a Char* -
- s + sz - 1 if s is a string literal of size sz -
- boost_range_end(x) if that expression would invoke a function found by ADL
- t.end() otherwise - -
linear if X is Char* -
- constant time otherwise
empty(x)boolbegin(x) == end( x )
-
linear if X is Char* -
- constant time otherwise
-
size(x)range_size<X>::type - std::distance(p.first,p.second) if p is of type std::pair<T>
- sz if a is an array of size sz
- end(s) - s if s is a string literal or a Char*
- boost_range_size(x) if that expression would invoke a function found by ADL
- t.size() otherwise -
linear if X is Char* -
- or if std::distance() is linear -
- constant time otherwise
rbegin(x)range_reverse_result_iterator<X>::typerange_reverse_result_iterator<X>::type( end(x) ) -
-
same as end(x) -
rend(x)range_reverse_result_iterator<X>::typerange_reverse_result_iterator<X>::type( begin(x) ) - same as begin(x)
const_begin(x)range_const_iterator<X>::typerange_const_iterator<X>::type( begin(x) ) -
-
same as begin(x) -
const_end(x)range_const_iterator<X>::typerange_const_iterator<X>::type( end(x) ) - same as end(x)
const_rbegin(x)range_const_reverse_iterator<X>::typerange_const_reverse_iterator<X>::type( rbegin(x) ) -
-
same as rbegin(x) -
const_rend(x)range_const_reverse_iterator<X>::typerange_const_reverse_iterator<X>::type( rend(x) ) - same as rend(x)
-

-

- The special const functions are not part of any Range concept, but - are very useful when you want to document clearly that your code is read-only. -

-
- -

Extending the library

- +
constant time
end(x)range_iterator<X>::type + p.second if p is of type std::pair<T>
+ a + sz if a is an array of size sz + +
+ range_end(x) if that expression would invoke a function found by ADL
+ t.end() otherwise + +
+ constant time
empty(x)boolboost::begin(x) == boost::end(x)
+
constant time
+
distance(x)range_difference<X>::type + + std::distance(boost::begin(x),boost::end(x)) + + -
- - - - - - - - - - - - - - - -
- Member function - Related concept
begin()Single Pass Range
end() - Single Pass Range
size()Forward Range
-

-

- Notice that rbegin() and rend() member functions are - not needed even though the container can support bidirectional iteration. -

-

- The required member types are: -

-

- - - - - - - - - - - - - - - - - -
- Member type - Related concept
iteratorSingle Pass Range
const_iteratorSingle Pass Range
size_typeForward Range
-

-

- Again one should notice that member types reverse_iterator and const_reverse_iterator - are not needed. -

- -

Method 2: provide free-standing functions and specialize metafunctions

+ + + size(x) + range_difference<X>::type + boost::end(x) - boost::begin(x) + + constant time + + + + rbegin(x) + range_reverse_iterator<X>::type + range_reverse_iterator<X>::type( boost::end(x) ) +
+ constant time + + + + + rend(x) + range_reverse_iterator<X>::type + range_reverse_iterator<X>::type( boost::begin(x) ) + constant time + + + + const_begin(x) + range_iterator<const X>::type + range_iterator<const X>::type( boost::begin(x) ) +
+ constant time + + + + + const_end(x) + range_iterator<const X>::type + range_iterator<const X>::type( boost::end(x) ) + constant time + + + + const_rbegin(x) + range_reverse_iterator<const X>::type + range_reverse_iterator<const X>::type( boost::rbegin(x) ) +
+ constant time + + + + + const_rend(x) + range_reverse_iterator<const X>::type + range_reverse_iterator<const X>::type( boost::rend(x) ) + + constant time + + + + as_literal(x) + iterator_range<U> where U is + Char* if x is a pointer to a + string and U is + range_iterator<X>::type otherwise + + + + [a,a+sz-1) if a is an array of size sz
+ [s,s + std::char_traits<X>::length(s)) if s is a Char* +
+ [boost::begin(x),boost::end(x)) otherwise -

- This procedure assumes that you cannot (or do not wish to) change the types that should be made - conformant to a Range concept. If this is not true, see method 1. -

- -

- The primary templates in this library are implemented such that - certain functions are found via argument-dependent-lookup (ADL). - Below is given an overview of which free-standing functions a class - must specify to be useable as a certain Range concept. - Let x be a variable (const or mutable) - of the class in question. -

-

- - - - - - - - - - - - - - - - -
- Function - Related concept
boost_range_begin(x)Single Pass Range
boost_range_end(x) - Single Pass Range
boost_range_size(x)Forward Range
-

-

boost_range_begin() and boost_range_end() must be - overloaded for both const and mutable reference arguments. -

- -

- You must also specialize 3 metafunctions for your type X: -

-

- - - - - - - - - - - - - - - - -
- Metafunction - Related concept
boost::range_iteratorSingle Pass Range
boost::range_const_iteratorSingle Pass Range
boost::range_sizeForward Range
-

-

- A complete example is given here: -

-
-
+
+                         
+                            
+                    linear time for pointers to a string, constant time 
+                        otherwise
+                
+                 
+                    
+                    as_array(x)
+                     iterator_range<X>                       
+                     
+                                  [boost::begin(x),boost::end(x)) 
+                                    
+
+
+                         
+                            
+                    constant time otherwise
+                
+
+            
+        

+

+ The special const_-named functions are useful when you + want to document clearly that your code is read-only. +

+

+ as_literal() can be used internally in string + algorithm librararies to such that arrays of characters are + handled correctly. +

+

+ as_array() can be used with string algorithm libraries to make it clear that arrays of characters are handled like an array and not like a string. +

+

Notice that the above functions should always be called with + qualification (boost::) to prevent unintended + Argument Dependent Lookup (ADL). +

+
+ +

Extending the library

+ + + + + +

Method 1: provide member functions and nested types

+ +

+ This procedure assumes that you have control over the types that should be made + conformant to a Range concept. If not, see method 2. +

+ +

+ The primary templates in this library are implemented such that standard + containers will work automatically and so will boost::array. + Below is given an overview of which member functions and member types a class + must specify to be useable as a certain Range concept. +

+

+ + + + + + + + + + + + +
+ Member function + Related concept
begin()Single Pass Range
end() + Single Pass Range
+

+

+ Notice that rbegin() and rend() member functions are + not needed even though the container can support bidirectional iteration. +

+

+ The required member types are: +

+

+ + + + + + + + + + + + + +
+ Member type + Related concept
iteratorSingle Pass Range
const_iteratorSingle Pass Range
+

+

+ Again one should notice that member types reverse_iterator and const_reverse_iterator + are not needed. +

+ +

Method 2: provide free-standing functions and specialize metafunctions

+ +

+ This procedure assumes that you cannot (or do not wish to) change the types that should be made + conformant to a Range concept. If this is not true, see method 1. +

+ +

+ The primary templates in this library are implemented such that + certain functions are found via argument-dependent-lookup (ADL). + Below is given an overview of which free-standing functions a class + must specify to be useable as a certain Range concept. + Let x be a variable (const or mutable) + of the class in question. +

+

+ + + + + + + + + + + + + +
+ Function + Related concept
range_begin(x)Single Pass Range
range_end(x) + Single Pass Range
+

+

range_begin() and range_end() must be + overloaded for both const and mutable reference arguments. +

+ +

+ You must also specialize two metafunctions for your type X: +

+

+ + + + + + + + + + + + + +
+ Metafunction + Related concept
boost::range_mutable_iteratorSingle Pass Range
boost::range_const_iteratorSingle Pass Range
+

+

+ A complete example is given here: +

+
+
 #include <boost/range.hpp>
 #include <iterator>         // for std::iterator_traits, std::distance()
 
 namespace Foo
 {
-	//
-	// Our sample UDT. A 'Pair'
-	// will work as a range when the stored
-	// elements are iterators.
-	//
-	template< class T >
-	struct Pair
-	{
-		T first, last;	
-	};
+    //
+    // Our sample UDT. A 'Pair'
+    // will work as a range when the stored
+    // elements are iterators.
+    //
+    template< class T >
+    struct Pair
+    {
+        T first, last;  
+    };
 
 } // namespace 'Foo'
 
 namespace boost
 {
-	//
-	// Specialize metafunctions. We must include the range.hpp header.
-	// We must open the 'boost' namespace.
-	//
+    //
+    // Specialize metafunctions. We must include the range.hpp header.
+    // We must open the 'boost' namespace.
+    //
 
-	template< class T >
-	struct range_iterator< Foo::Pair<T> >
-	{
-		typedef T type;
-	};
+    template< class T >
+    struct range_mutable_iterator< Foo::Pair<T> >
+    {
+        typedef T type;
+    };
 
-	template< class T >
-	struct range_const_iterator< Foo::Pair<T> >
-	{
-		//
-		// Remark: this is defined similar to 'range_iterator'
-		//         because the 'Pair' type does not distinguish
-		//         between an iterator and a const_iterator.
-		//
-		typedef T type;
-	};
-
-	template< class T >
-	struct range_size< Foo::Pair<T> >
-	{
-
-		typedef std::size_t type;
-	};
+    template< class T >
+    struct range_const_iterator< Foo::Pair<T> >
+    {
+        //
+        // Remark: this is defined similar to 'range_mutable_iterator'
+        //         because the 'Pair' type does not distinguish
+        //         between an iterator and a const_iterator.
+        //
+        typedef T type;
+    };
 
 } // namespace 'boost'
 
 namespace Foo
 {
-	//
-	// The required functions. These should be defined in
-	// the same namespace as 'Pair', in this case 
-	// in namespace 'Foo'.
-	//
-	
-	template< class T >
-	inline T boost_range_begin( Pair<T>& x )
-	{ 
-		return x.first;
-	}
+    //
+    // The required functions. These should be defined in
+    // the same namespace as 'Pair', in this case 
+    // in namespace 'Foo'.
+    //
+    
+    template< class T >
+    inline T range_begin( Pair<T>& x )
+    { 
+        return x.first;
+    }
 
-	template< class T >
-	inline T boost_range_begin( const Pair<T>& x )
-	{ 
-		return x.first;
-	}
+    template< class T >
+    inline T range_begin( const Pair<T>& x )
+    { 
+        return x.first;
+    }
 
-	template< class T >
-	inline T boost_range_end( Pair<T>& x )
-	{ 
-		return x.last;
-	}
+    template< class T >
+    inline T range_end( Pair<T>& x )
+    { 
+        return x.last;
+    }
 
-	template< class T >
-	inline T boost_range_end( const Pair<T>& x )
-	{ 
-		return x.last;
-	}
-
-	template< class T >
-	inline typename boost::range_size< Pair<T> >::type
-	boost_range_size( const Pair<T>& x )
-	{
-		return std::distance(x.first,x.last);
-	}
+    template< class T >
+    inline T range_end( const Pair<T>& x )
+    { 
+        return x.last;
+    }
 
 } // namespace 'Foo'
 
@@ -705,41 +723,41 @@ class=identifier>T& int main()
 {
-	typedef std::vector<int>::iterator  iter;
-	std::vector<int>                    vec;
-	Foo::Pair<iter>                     pair = { vec.begin(), vec.end() };
-	const Foo::Pair<iter>&              cpair = pair; 
-	//
-	// Notice that we call 'begin' etc with qualification. 
-	//
-	iter i = boost::begin( pair );
-	iter e = boost::end( pair );
-	i      = boost::begin( cpair );
-	e      = boost::end( cpair );
-	boost::range_size< Foo::Pair<iter> >::type s = boost::size( pair );
-	s      = boost::size( cpair );
-	boost::range_const_reverse_iterator< Foo::Pair<iter> >::type
-	ri     = boost::rbegin( cpair ),
-	re     = boost::rend( cpair );
-}	
+    typedef std::vector<int>::iterator  iter;
+    std::vector<int>                    vec;
+    Foo::Pair<iter>                     pair  = { vec.begin(), vec.end() };
+    const Foo::Pair<iter>&              cpair = pair; 
+    //
+    // Notice that we call 'begin' etc with qualification. 
+    //
+    iter i = boost::begin( pair );
+    iter e = boost::end( pair );
+    i      = boost::begin( cpair );
+    e      = boost::end( cpair );
+    boost::range_difference< Foo::Pair<iter> >::type s = boost::size( pair );
+    s      = boost::size( cpair );
+    boost::range_reverse_iterator< const Foo::Pair<iter> >::type
+    ri     = boost::rbegin( cpair ),
+    re     = boost::rend( cpair );
+}    
 
- -
-

- (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0. -

-
-
-
-
-
-
-
-
-
-
-
-
- + +
+

+ (C) Copyright Thorsten Ottosen 2003-2007 +

+
+
+
+
+
+
+
+
+
+
+
+
+ diff --git a/doc/boost_range.qbk b/doc/boost_range.qbk new file mode 100644 index 0000000..80b5c8c --- /dev/null +++ b/doc/boost_range.qbk @@ -0,0 +1,1234 @@ +[article Boost.Range Documentation + [quickbook 1.3] + [id boost.range] + [copyright 2003-2007 Thorsten Ottosen] + [license + 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]) + ] +] + +[/ Converted to Quickbook format by Darren Garvey, 2007] + +[def __ranges__ [link boost.range.concepts Ranges]] +[def __range_concepts__ [link boost.range.concepts Range concepts]] +[def __forward_range__ [link boost.range.concepts.forward_range Forward Range]] +[def __single_pass_range__ [link boost.range.concepts.single_pass_range Single Pass Range]] +[def __bidirectional_range__ [link boost.range.concepts.bidirectional_range Bidirectional Range]] +[def __random_access_range__ [link boost.range.concepts.random_access_range Random Access Range]] + +[def __iterator_range__ [link boost.range.utilities.iterator_range `iterator_range`]] +[def __sub_range__ [link boost.range.utilities.sub_range `sub_range`]] +[def __minimal_interface__ [link boost.range.reference.extending minimal interface]] +[def __range_result_iterator__ [link boost.range.reference.semantics.metafunctions `range_result_iterator`]] +[def __implementation_of_metafunctions__ [link boost.range.reference.semantics.metafunctions implementation of metafunctions]] +[def __implementation_of_functions__ [link boost.range.reference.semantics.functions implementation of functions]] + +[def __single_pass_iterator__ [@../../libs/iterator/doc/new-iter-concepts.html#singls-pass-iterators-lib-single-pass-iterators Single Pass Iterator]] +[def __forward_traversal_iterator__ [@../../libs/iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators Forward Traversal Iterator]] +[def __bidirectional_traversal_iterator__ [@../../libs/iterator/doc/new-iter-concepts.html#bidirectional-traversal-iterators-lib-bidirectional-traversal-iterators Bidirectional Traversal Iterator]] +[def __random_access_traversal_iterator__ [@../../libs/iterator/doc/new-iter-concepts.html#random-access-traversal-iterators-lib-random-access-traversal-iterators Random Access Traversal Iterator]] +[def __new_style_iterators__ [@../../libs/iterator/doc/new-iter-concepts.html new style iterators]] +[def __iterator_concepts__ [@../../libs/iterator/doc/iterator_concepts.html Iterator concepts]] + +[def __container__ [@http://www.sgi.com/Technology/STL/Container.html Container]] +[def __metafunctions__ [@../../libs/mpl/doc/refmanual/metafunction.html metafunctions]] +[def __concept_check__ [@../../libs/concept_check/index.html Boost Concept Check library]] +[def __boost_array__ [@../../libs/array/index.html boost::array]] +[def __the_forwarding_problem__ [@http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm The Forwarding Problem]] + + +Boost.Range is a collection of concepts and utilities that are particularly useful for specifying and implementing generic algorithms. + + +[section Introduction] + +Generic algorithms have so far been specified in terms of two or more iterators. Two iterators would together form a range of values that the algorithm could work on. This leads to a very general interface, but also to a somewhat clumsy use of the algorithms with redundant specification of container names. Therefore we would like to raise the abstraction level for algorithms so they specify their interface in terms of __ranges__ as much as possible. + +The most common form of ranges we are used to work with is standard library containers. However, one often finds it desirable to extend that code to work with other types that offer enough functionality to satisfy the needs of the generic code if a suitable layer of indirection is applied . For example, raw arrays are often suitable for use with generic code that works with containers, provided a suitable adapter is used. Likewise, null terminated strings can be treated as containers of characters, if suitably adapted. + +This library therefore provides the means to adapt standard-like containers, null terminated strings, `std::pairs` of iterators, and raw arrays (and more), such that the same generic code can work with them all. The basic idea is to add another layer of indirection using __metafunctions__ and free-standing functions so syntactic and/or semantic differences can be removed. + +The main advantages are + +* simpler implementation and specification of generic range algorithms +* more flexible, compact and maintainable client code +* correct handling of null-terminated strings + +[:[*Warning: support for null-terminated strings is deprecated and will disappear in the next Boost release (1.34).]] + +* safe use of built-in arrays (for legacy code; why else would you use built-in arrays?) + +Below are given a small example (the complete example can be found [@http://www.boost.org/libs/range/test/algorithm_example.cpp here] ): + +`` + // + // example: extracting bounds in a generic algorithm + // + template< class ForwardReadableRange, class T > + inline typename boost::range_iterator< ForwardReadableRange >::type + find( ForwardReadableRange& c, const T& value ) + { + return std::find( boost::begin( c ), boost::end( c ), value ); + } + + template< class ForwardReadableRange, class T > + inline typename boost::range_const_iterator< ForwardReadableRange >::type + find( const ForwardReadableRange& c, const T& value ) + { + return std::find( boost::begin( c ), boost::end( c ), value ); + } + + // + // replace first value and return its index + // + template< class ForwardReadableWriteableRange, class T > + inline typename boost::range_size< ForwardReadableWriteableRange >::type + my_generic_replace( ForwardReadableWriteableRange& c, const T& value, const T& replacement ) + { + typename boost::range_iterator< ForwardReadableWriteableRange >::type found = find( c, value ); + + if( found != boost::end( c ) ) + *found = replacement; + return std::distance( boost::begin( c ), found ); + } + + // + // usage + // + const int N = 5; + std::vector my_vector; + int values[] = { 1,2,3,4,5,6,7,8,9 }; + + my_vector.assign( values, boost::end( values ) ); + typedef std::vector::iterator iterator; + std::pair my_view( boost::begin( my_vector ), + boost::begin( my_vector ) + N ); + char str_val[] = "a string"; + char* str = str_val; + + std::cout << my_generic_replace( my_vector, 4, 2 ); + std::cout << my_generic_replace( my_view, 4, 2 ); + std::cout << my_generic_replace( str, 'a', 'b' ); + + // prints '3', '5' and '0' +`` + +By using the free-standing functions and __metafunctions__, the code automatically works for all the types supported by this library; now and in the future. Notice that we have to provide two version of `find()` since we cannot forward a non-const rvalue with reference arguments (see this article about __the_forwarding_problem__ ). + +[endsect] + + + +[section:concepts Range Concepts] + +[section Overview] + +A Range is a ['concept] similar to the STL [@http://www.sgi.com/Technology/STL/Container.html Container] concept. A Range provides iterators for accessing a half-open range `[first,one_past_last)` of elements and provides information about the number of elements in the Range. However, a Range has fewer requirements than a Container. + +The motivation for the Range concept is that there are many useful Container-like types that do not meet the full requirements of Container, and many algorithms that can be written with this reduced set of requirements. In particular, a Range does not necessarily + +* own the elements that can be accessed through it, +* have copy semantics, + +Because of the second requirement, a Range object must be passed by (const or non-const) reference in generic code. + +The operations that can be performed on a Range is dependent on the [@../../iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal traversal category] of the underlying iterator type. Therefore the range concepts are named to reflect which traversal category its iterators support. See also terminology and style guidelines. for more information about naming of ranges. + +The concepts described below specifies associated types as [@../../libs/mpl/doc/refmanual/metafunction.html metafunctions] and all functions as free-standing functions to allow for a layer of indirection. + +[endsect] + + +[section Single Pass Range] + +[h4 Notation] + +`X` A type that is a model of __single_pass_range__. +`a` Object of type X. + +[h4 Description] + +A range `X` where `boost::range_iterator::type` is a model of __single_pass_iterator__. + +[h4 Associated types] + +[table + [] + [[Value type ] [`boost::range_value::type` ] [The type of the object stored in a Range.]] + [[Iterator type ] [`boost::range_iterator::type` ] [The type of iterator used to iterate through a Range's elements. The iterator's value type is expected to be the Range's value type. A conversion from the iterator type to the `const` iterator type must exist.]] + [[Const iterator type] [`boost::range_const_iterator::type`] [A type of iterator that may be used to examine, but not to modify, a Range's elements.]] +] + +[h4 Valid expressions] + +The following expressions must be valid. + +[table + [[Name ] [Expression ] [Return type ]] + [[Beginning of range] [`boost::begin(a)`] [`boost::range_iterator::type` if `a` is mutable,[br] `boost::range_const_iterator::type` otherwise]] + [[End of range ] [`boost::end(a)` ] [`boost::range_iterator::type` if `a` is mutable,[br] `boost::range_const_iterator::type` otherwise]] + [[Is range empty? ] [boost::empty(a) ] [Convertible to bool]] +] + +[h4 Expression semantics] + +[table + [[Expression ] [Semantics ] [Postcondition]] + [[`boost::begin(a)`] [Returns an iterator pointing to the first element in the Range. ] [`boost::begin(a)` is either dereferenceable or past-the-end. It is past-the-end if and only if `boost::size(a) == 0`.]] + [[`boost::end(a)` ] [Returns an iterator pointing one past the last element in the Range. ] [`boost::end(a)` is past-the-end.]] + [[`boost::empty(a)`] [Equivalent to `boost::begin(a) == boost::end(a)`. (But possibly faster.)] [- ]] +] + +[h4 Complexity guarantees] + +All three functions are at most amortized linear time. For most practical purposes, one can expect `boost::begin(a)`, `boost::end(a)` and `boost::empty(a)` to be amortized constant time. + +[h4 Invariants] + +[table + [] + [[Valid range ] [For any Range `a`, `[boost::begin(a),boost::end(a))` is a valid range, that is, `boost::end(a)` is reachable from `boost::begin(a)` in a finite number of increments.]] + + [[Completeness] [An algorithm that iterates through the range `[boost::begin(a),boost::end(a))` will pass through every element of `a`.]] +] + +[h4 See also] + +__container__ + +__implementation_of_metafunctions__ + +__implementation_of_functions__ + +[endsect] + + +[section Forward Range] + +[h4 Notation] + +`X` A type that is a model of __forward_range__. +`a` Object of type X. + +[h4 Description] + +A range `X` where `boost::range_iterator::type` is a model of __forward_traversal_iterator__. + +[h4 Refinement of] + +__single_pass_range__ + +[h4 Associated types] + +[table + [] + [[Distance type] [`boost::range_difference::type`] [A signed integral type used to represent the distance between two of the Range's iterators. This type must be the same as the iterator's distance type.]] + [[Size type ] [`boost::range_size::type` ] [An unsigned integral type that can represent any nonnegative value of the Range's distance type.]] +] + +[h4 Valid expressions] + +[table + [[Name ] [Expression ] [Return type ]] + [[Size of range] [`boost::size(a)`] [`boost::range_size::type`]] +] + +[h4 Expression semantics] + +[table + [[Expression ] [Semantics] [Postcondition]] + [[`boost::size(a)`] [Returns the size of the Range, that is, its number of elements. Note `boost::size(a) == 0u` is equivalent to `boost::empty(a)`.] [`boost::size(a) >= 0`]] +] + +[h4 Complexity guarantees] + +`boost::size(a)` is at most amortized linear time. + +[h4 Invariants] + +[table + [] + [[Range size] [`boost::size(a)` is equal to the distance from `boost::begin(a)` to `boost::end(a)`.]] +] + +[h4 See also] + +__implementation_of_metafunctions__ + +__implementation_of_functions__ + +[endsect] + + +[section Bidirectional Range] + +[h4 Notation] + +`X` A type that is a model of __bidirectional_range__. +`a` Object of type X. + +[h4 Description] + +This concept provides access to iterators that traverse in both directions (forward and reverse). The `boost::range_iterator::type` iterator must meet all of the requirements of __bidirectional_traversal_iterator__. + +[h4 Refinement of] + +__forward_range__ + +[h4 Associated types] + +[table + [] + [[Reverse Iterator type ] [`boost::range_reverse_iterator::type` ] [The type of iterator used to iterate through a Range's elements in reverse order. The iterator's value type is expected to be the Range's value type. A conversion from the reverse iterator type to the const reverse iterator type must exist.]] + + [[Const reverse iterator type] [`boost::range_const_reverse_iterator::type`] [A type of reverse iterator that may be used to examine, but not to modify, a Range's elements.]] +] + +[h4 Valid expressions] + +[table + [[Name ] [Expression ] [Return type] [Semantics]] + [[Beginning of range] [`boost::rbegin(a)`] [`boost::range_reverse_iterator::type` if `a` is mutable[br] `boost::range_const_reverse_iterator::type` otherwise.] [Equivalent to `boost::range_reverse_iterator::type(boost::end(a))`.]] + + [[End of range ] [`boost::rend(a)` ] [`boost::range_reverse_iterator::type` if `a` is mutable,[br] `boost::range_const_reverse_iterator::type` otherwise.] [Equivalent to `boost::range_reverse_iterator::type(boost::begin(a))`.]] +] + +[h4 Complexity guarantees] + +`boost::rbegin(a)` has the same complexity as `boost::end(a)` and `boost::rend(a)` has the same complexity as `boost::begin(a)` from __forward_range__. + +[h4 Invariants] + +[table + [] + [[Valid reverse range] [For any Bidirectional Range a, `[boost::rbegin(a),boost::rend(a))` is a valid range, that is, `boost::rend(a)` is reachable from `boost::rbegin(a)` in a finite number of increments.]] + + [[Completeness ] [`An algorithm that iterates through the range `[boost::rbegin(a),boost::rend(a))` will pass through every element of `a`.]] +] + +[h4 See also] + +__implementation_of_metafunctions__ + +__implementation_of_functions__ + +[endsect] + + +[section Random Access Range] + +[h4 Description] + +A range `X` where `boost::range_iterator::type` is a model of __random_access_traversal_iterator__. + +[h4 Refinement of] + +__bidirectional_range__ + +[endsect] + + +[section Concept Checking] + +Each of the range concepts has a corresponding concept checking class in the file [@../../boost/range/concepts.hpp `boost/range/concepts.hpp`]. These classes may be used in conjunction with the __concept_check__ to insure that the type of a template parameter is compatible with a range concept. If not, a meaningful compile time error is generated. Checks are provided for the range concepts related to iterator traversal categories. For example, the following line checks that the type `T` models the __forward_range__ concept. + +`` +function_requires >(); +`` + +An additional concept check is required for the value access property of the range based on the range's iterator type. For example to check for a ForwardReadableRange, the following code is required. + +`` +function_requires >(); + function_requires< + ReadableIteratorConcept< + typename range_iterator::type + > + >(); +`` + +The following range concept checking classes are provided. + +* Class SinglePassRangeConcept checks for __single_pass_range__ +* Class ForwardRangeConcept checks for __forward_range__ +* Class BidirectionalRangeConcept checks for __bidirectional_range__ +* Class RandomAccessRangeConcept checks for __random_access_range__ + +[h4 See also] + +[link boost.range.style_guide Range Terminology and style guidelines] + +__iterator_concepts__ + +__concept_check__ + +[endsect] + +[endsect] + + + +[section Reference] + +[section Overview] + +Four types of objects are currently supported by the library: + +* standard-like containers +* `std::pair` +* null terminated strings (this includes `char[]`,`wchar_t[]`, `char*`, and `wchar_t*`) + +[:[*Warning: ['support for null-terminated strings is deprecated and will disappear in the next Boost release (1.34).]]] + +* built-in arrays + +Even though the behavior of the primary templates are exactly such that standard containers will be supported by default, the requirements are much lower than the standard container requirements. For example, the utility class __iterator_range__ implements the __minimal_interface__ required to make the class a __forward_range__. + +Please also see __range_concepts__ for more details. + +[endsect] + + +[section Synopsis] + +`` +namespace boost +{ + // + // Single Pass Range metafunctions + // + + template< class T > + struct range_value; + + template< class T > + struct range_iterator; + + template< class T > + struct range_const_iterator; + + // + // Forward Range metafunctions + // + + template< class T > + struct range_difference; + + template< class T > + struct range_size; + + // + // Bidirectional Range metafunctions + // + + template< class T > + struct range_reverse_iterator; + + template< class T > + struct range_const_reverse_iterator; + + // + // Special metafunctions + // + + template< class T > + struct range_result_iterator; + + template< class T > + struct range_reverse_result_iterator; + + // + // Single Pass Range functions + // + + template< class T > + typename range_iterator::type + begin( T& c ); + + template< class T > + typename range_const_iterator::type + begin( const T& c ); + + template< class T > + typename range_iterator::type + end( T& c ); + + template< class T > + typename range_const_iterator::type + end( const T& c ); + + template< class T > + bool + empty( const T& c ); + + // + // Forward Range functions + // + + template< class T > + typename range_size::type + size( const T& c ); + + // + // Bidirectional Range functions + // + + template< class T > + typename range_reverse_iterator::type + rbegin( T& c ); + + template< class T > + typename range_const_reverse_iterator::type + rbegin( const T& c ); + + template< class T > + typename range_reverse_iterator::type + rend( T& c ); + + template< class T > + typename range_const_reverse_iterator::type + rend( const T& c ); + + // + // Special const Range functions + // + + template< class T > + typename range_const_iterator::type + const_begin( const T& r ); + + template< class T > + typename range_const_iterator::type + const_end( const T& r ); + + template< class T > + typename range_const_reverse_iterator::type + const_rbegin( const T& r ); + + template< class T > + typename range_const_reverse_iterator::type + const_rend( const T& r ); + +} // namespace 'boost' +`` + +[endsect] + + +[section Semantics] + +[h5 notation] + +[table + [[Type ] [Object] [Describes ]] + [[`X` ] [`x` ] [any type ]] + [[`T` ] [`t` ] [denotes behavior of the primary templates]] + [[`P` ] [`p` ] [denotes `std::pair` ]] + [[`A[sz]`] [`a` ] [denotes an array of type `A` of size `sz`]] + [[`Char*`] [`s` ] [denotes either `char*` or `wchar_t*` ]] +] + +Please notice in tables below that when four lines appear in a cell, the first line will describe the primary template, the second line pairs of iterators, the third line arrays and the last line null-terminated strings. + +[section Metafunctions] + +[table + [[Expression] [Return type] [Complexity]] + [[`range_value::type`] [`T::value_type`[br] +`boost::iterator_value::type`[br] +`A`[br] +`Char`] [compile time]] + [[`range_iterator::type`] [`T::iterator`[br] +`P::first_type`[br] +`A*`[br] +`Char*`] [compile time]] + [[`range_const_iterator::type`] [`T::const_iterator`[br] +`P::first_type`[br] +`const A*`[br] +`const Char*`] [compile time]] + [[`range_difference::type`] [`T::difference_type`[br] +`boost::iterator_difference::type`[br] +`std::ptrdiff_t`[br] +`std::ptrdiff_t`] [compile time]] + [[`range_size::type`] [`T::size_type`[br] +`std::size_t`[br] +`std::size_t`[br] +`std::size_t`] [compile time]] + [[`range_result_iterator::type`] [`range_const_iterator::type` if `X` is `const`[br] +`range_iterator::type` otherwise] [compile time]] + [[`range_reverse_iterator::type`] [`boost::reverse_iterator< typename range_iterator::type >`] [compile time]] + [[`range_const_reverse_iterator::type`] [`boost::reverse_iterator< typename range_const_iterator::type >`] [compile time]] + [[`range_reverse_result_iterator::type`] [`boost::reverse_iterator< typename range_result_iterator::type >`] [compile time]] +] + +The special metafunctions `range_result_iterator` and `range_reverse_result_iterator` are not part of any Range concept, but they are very useful when implementing certain Range classes like __sub_range__ because of their ability to select iterators based on constness. + +[endsect] + +[section Functions] + +[table + [[Expression] [Return type] [Returns] [Complexity]] + + [[`begin(x)`] [`range_result_iterator::type`] [`p.first` if `p` is of type `std::pair`[br] +`a` if `a` is an array[br] +`s` if `s` is a string literal[br] +`boost_range_begin(x)` if that expression would invoke a function found by ADL[br] +`t.begin()` otherwise] [constant time]] + + [[`end(x)`] [`range_result_iterator::type`] [`p.second` if `p` is of type `std::pair`[br] +`a + sz` if `a` is an array of size `sz`[br] +`s + std::char_traits::length( s )` if `s` is a `Char*`[br] +`s + sz - 1` if `s` is a string literal of size `sz`[br] +`boost_range_end(x)` if that expression would invoke a function found by ADL[br] +`t.end()` otherwise] [linear if `X` is `Char*` +constant time otherwise]] + + [[`empty(x)`] [`bool`] [`begin(x) == end( x )`] [linear if `X` is `Char*`[br] +constant time otherwise]] + + [[`size(x)`] [`range_size::type`] [`std::distance(p.first,p.second)` if `p` is of type `std::pair`[br] +`sz` if `a` is an array of size `sz`[br] +`end(s) - s` if `s` is a string literal or a `Char*`[br] +`boost_range_size(x)` if that expression would invoke a function found by ADL[br] +`t.size()` otherwise] [linear if `X` is `Char*` or if `std::distance()` is linear[br] +constant time otherwise]] + + [[`rbegin(x)`] [`range_reverse_result_iterator::type`] [`range_reverse_result_iterator::type( end(x) )`] [same as `end(x)`]] + + [[`rend(x)`] [`range_reverse_result_iterator::type`] [`range_reverse_result_iterator::type( begin(x) )`] [same as `begin(x)`]] + + [[`const_begin(x)`] [`range_const_iterator::type`] [`range_const_iterator::type( begin(x) )`] [same as `begin(x)`]] + + [[`const_end(x)`] [`range_const_iterator::type`] [`range_const_iterator::type( end(x) )`] [same as `end(x)`]] + + [[`const_rbegin(x)`] [`range_const_reverse_iterator::type`] [`range_const_reverse_iterator::type( rbegin(x) )`] [same as `rbegin(x)`]] + + [[`const_rend(x)`] [`range_const_reverse_iterator::type`] [`range_const_reverse_iterator::type( rend(x) )`] [same as `rend(x)`]] +] + +The special const functions are not part of any Range concept, but are very useful when you want to document clearly that your code is read-only. + +[endsect] + +[endsect] + +[section:extending Extending the library] + +[section:method_1 Method 1: provide member functions and nested types] + +This procedure assumes that you have control over the types that should be made conformant to a Range concept. If not, see [link boost.range.reference.extending.method_2 method 2]. + +The primary templates in this library are implemented such that standard containers will work automatically and so will __boost_array__. Below is given an overview of which member functions and member types a class must specify to be useable as a certain Range concept. + +[table + [[Member function] [Related concept ]] + [[`begin()` ] [__single_pass_range__]] + [[`end()` ] [__single_pass_range__]] + [[`size()` ] [__forward_range__ ]] +] + +Notice that `rbegin()` and `rend()` member functions are not needed even though the container can support bidirectional iteration. + +The required member types are: + +[table + [[Member type ] [Related concept ]] + [[`iterator` ] [__single_pass_range__]] + [[`const_iterator`] [__single_pass_range__]] + [[`size_type` ] [__forward_range__ ]] +] + +Again one should notice that member types `reverse_iterator` and `const_reverse_iterator` are not needed. + +[endsect] + +[section:method_2 Method 2: provide free-standing functions and specialize metafunctions] + +This procedure assumes that you cannot (or do not wish to) change the types that should be made conformant to a Range concept. If this is not true, see [link boost.range.reference.extending.method_1 method 1]. + +The primary templates in this library are implemented such that certain functions are found via argument-dependent-lookup (ADL). Below is given an overview of which free-standing functions a class must specify to be useable as a certain Range concept. Let `x` be a variable (`const` or `mutable`) of the class in question. + +[table + [[Function ] [Related concept ]] + [[`boost_range_begin(x)`] [__single_pass_range__]] + [[`boost_range_end(x)` ] [__single_pass_range__]] + [[`boost_range_size(x)` ] [__forward_range__ ]] +] + +`boost_range_begin()` and `boost_range_end()` must be overloaded for both `const` and `mutable` reference arguments. + +You must also specialize 3 metafunctions for your type `X`: + +[table + [[Metafunction ] [Related concept ]] + [[`boost::range_iterator` ] [__single_pass_range__]] + [[`boost::range_const_iterator`] [__single_pass_range__]] + [[`boost::range_size` ] [__forward_range__ ]] +] + +A complete example is given here: + +`` + #include + #include // for std::iterator_traits, std::distance() + + namespace Foo + { + // + // Our sample UDT. A 'Pair' + // will work as a range when the stored + // elements are iterators. + // + template< class T > + struct Pair + { + T first, last; + }; + + } // namespace 'Foo' + + namespace boost + { + // + // Specialize metafunctions. We must include the range.hpp header. + // We must open the 'boost' namespace. + // + + template< class T > + struct range_iterator< Foo::Pair > + { + typedef T type; + }; + + template< class T > + struct range_const_iterator< Foo::Pair > + { + // + // Remark: this is defined similar to 'range_iterator' + // because the 'Pair' type does not distinguish + // between an iterator and a const_iterator. + // + typedef T type; + }; + + template< class T > + struct range_size< Foo::Pair > + { + + typedef std::size_t type; + }; + + } // namespace 'boost' + + namespace Foo + { + // + // The required functions. These should be defined in + // the same namespace as 'Pair', in this case + // in namespace 'Foo'. + // + + template< class T > + inline T boost_range_begin( Pair& x ) + { + return x.first; + } + + template< class T > + inline T boost_range_begin( const Pair& x ) + { + return x.first; + } + + template< class T > + inline T boost_range_end( Pair& x ) + { + return x.last; + } + + template< class T > + inline T boost_range_end( const Pair& x ) + { + return x.last; + } + + template< class T > + inline typename boost::range_size< Pair >::type + boost_range_size( const Pair& x ) + { + return std::distance(x.first,x.last); + } + + } // namespace 'Foo' + + #include + + int main() + { + typedef std::vector::iterator iter; + std::vector vec; + Foo::Pair pair = { vec.begin(), vec.end() }; + const Foo::Pair& cpair = pair; + // + // Notice that we call 'begin' etc with qualification. + // + iter i = boost::begin( pair ); + iter e = boost::end( pair ); + i = boost::begin( cpair ); + e = boost::end( cpair ); + boost::range_size< Foo::Pair >::type s = boost::size( pair ); + s = boost::size( cpair ); + boost::range_const_reverse_iterator< Foo::Pair >::type + ri = boost::rbegin( cpair ), + re = boost::rend( cpair ); + } +`` + +[endsect] + +[endsect] + +[endsect] + + + +[section Utilities] + +Having an abstraction that encapsulates a pair of iterators is very useful. The standard library uses `std::pair` in some circumstances, but that class is cumbersome to use because we need to specify two template arguments, and for all range algorithm purposes we must enforce the two template arguments to be the same. Moreover, `std::pair` is hardly self-documenting whereas more domain specific class names are. Therefore these two classes are provided: + +* Class `iterator_range` +* Class `sub_range` + +The `iterator_range` class is templated on an __forward_traversal_iterator__ and should be used whenever fairly general code is needed. The `sub_range` class is templated on an __forward_range__ and it is less general, but a bit easier to use since its template argument is easier to specify. The biggest difference is, however, that a `sub_range` can propagate constness because it knows what a corresponding `const_iterator` is. + +Both classes can be used as ranges since they implement the __minimal_interface__ required for this to work automatically. + +[section:iterator_range Class `iterator_range`] + +The intention of the `iterator_range` class is to encapsulate two iterators so they fulfill the __forward_range__ concept. A few other functions are also provided for convenience. + +If the template argument is not a model of __forward_traversal_iterator__, one can still use a subset of the interface. In particular, `size()` requires Forward Traversal Iterators whereas `empty()` only requires Single Pass Iterators. + +Recall that many default constructed iterators are singular and hence can only be assigned, but not compared or incremented or anything. However, if one creates a default constructed `iterator_range`, then one can still call all its member functions. This means that the `iterator_range` will still be usable in many contexts even though the iterators underneath are not. + +[h4 Synopsis] + +`` +namespace boost +{ + template< class ForwardTraversalIterator > + class iterator_range + { + public: // Forward Range types + typedef ... value_type; + typedef ... difference_type; + typedef ... size_type; + typedef ForwardTraversalIterator iterator; + typedef ForwardTraversalIterator const_iterator; + + public: // construction, assignment + template< class ForwardTraversalIterator2 > + iterator_range( ForwardTraversalIterator2 Begin, ForwardTraversalIterator2 End ); + + template< class ForwardRange > + iterator_range( ForwardRange& r ); + + template< class ForwardRange > + iterator_range( const ForwardRange& r ); + + template< class ForwardRange > + iterator_range& operator=( ForwardRange& r ); + + template< class ForwardRange > + iterator_range& operator=( const ForwardRange& r ); + + public: // Forward Range functions + iterator begin() const; + iterator end() const; + size_type size() const; + bool empty() const; + + public: // convenience + operator unspecified_bool_type() const; + bool equal( const iterator_range& ) const; + value_type& front() const; + value_type& back() const; + // for Random Access Range only: + value_type& operator[]( size_type at ) const; + }; + + // stream output + template< class ForwardTraversalIterator, class T, class Traits > + std::basic_ostream& + operator<<( std::basic_ostream& Os, + const iterator_range& r ); + + // comparison + template< class ForwardTraversalIterator, class ForwardTraversalIterator2 > + bool operator==( const iterator_range& l, + const iterator_range& r ); + + template< class ForwardTraversalIterator, class ForwardRange > + bool operator==( const iterator_range& l, + const ForwardRange& r ); + + template< class ForwardTraversalIterator, class ForwardRange > + bool operator==( const ForwardRange& l, + const iterator_range& r ); + + template< class ForwardTraversalIterator, class ForwardTraversalIterator2 > + bool operator!=( const iterator_range& l, + const iterator_range& r ); + + template< class ForwardTraversalIterator, class ForwardRange > + bool operator!=( const iterator_range& l, + const ForwardRange& r ); + + template< class ForwardTraversalIterator, class ForwardRange > + bool operator!=( const ForwardRange& l, + const iterator_range& r ); + + template< class ForwardTraversalIterator, class ForwardTraversalIterator2 > + bool operator<( const iterator_range& l, + const iterator_range& r ); + + template< class ForwardTraversalIterator, class ForwardRange > + bool operator<( const iterator_range& l, + const ForwardRange& r ); + + template< class ForwardTraversalIterator, class ForwardRange > + bool operator<( const ForwardRange& l, + const iterator_range& r ); + + // external construction + template< class ForwardTraversalIterator > + iterator_range< ForwardTraversalIterator > + make_iterator_range( ForwardTraversalIterator Begin, + ForwardTraversalIterator End ); + + template< class ForwardRange > + iterator_range< typename iterator_of::type > + make_iterator_range( ForwardRange& r ); + + template< class ForwardRange > + iterator_range< typename const_iterator_of::type > + make_iterator_range( const ForwardRange& r ); + + template< class Range > + iterator_range< typename range_iterator::type > + make_iterator_range( Range& r, + typename range_difference::type advance_begin, + typename range_difference::type advance_end ); + + template< class Range > + iterator_range< typename range_const_iterator::type > + make_iterator_range( const Range& r, + typename range_difference::type advance_begin, + typename range_difference::type advance_end ); + + // convenience + template< class Sequence, class ForwardRange > + Sequence copy_range( const ForwardRange& r ); + +} // namespace 'boost' +`` + +If an instance of `iterator_range` is constructed by a client with two iterators, the client must ensure that the two iterators delimit a valid closed-open range [begin,end). + +It is worth noticing that the templated constructors and assignment operators allow conversion from `iterator_range` to `iterator_range`. Similarly, since the comparison operators have two template arguments, we can compare ranges whenever the iterators are comparable; for example when we are dealing with const and non-const iterators from the same container. + +[h4 Details member functions] + +`operator unspecified_bool_type() const;` + +[:['[*Returns]] `!empty();`] + +`bool equal( iterator_range& r ) const;` + +[:['[*Returns]] `begin() == r.begin() && end() == r.end();`] + +[h4 Details functions] + +`bool operator==( const ForwardRange1& l, const ForwardRange2& r );` + +[:['[*Returns]] `size(l) != size(r) ? false : std::equal( begin(l), end(l), begin(r) );`] + +`bool operator!=( const ForwardRange1& l, const ForwardRange2& r );` + +[:['[*Returns]] `!( l == r );`] + +`bool operator<( const ForwardRange1& l, const ForwardRange2& r );` + +[:['[*Returns]] `std::lexicographical_compare( begin(l), end(l), begin(r), end(r) );`] + +`` +iterator_range make_iterator_range( Range& r, + typename range_difference::type advance_begin, + typename range_difference::type advance_end ); +`` + +[:['[*Effects:]]] + +`` + iterator new_begin = begin( r ), + iterator new_end = end( r ); + std::advance( new_begin, advance_begin ); + std::advance( new_end, advance_end ); + return make_iterator_range( new_begin, new_end ); +`` + +`Sequence copy_range( const ForwardRange& r );` + +[:['[*Returns]] `Sequence( begin(r), end(r) );`] + +[endsect] + +[section:sub_range Class `sub_range`] + +The `sub_range` class inherits all its functionality from the __iterator_range__ class. The `sub_range` class is often easier to use because one must specify the __forward_range__ template argument instead of an iterator. Moreover, the sub_range class can propagate constness since it knows what a corresponding `const_iterator` is. + +[h4 Synopsis] + +`` +namespace boost +{ + template< class ForwardRange > + class sub_range : public iterator_range< typename range_result_iterator::type > + { + public: + typedef typename range_result_iterator::type iterator; + typedef typename range_const_iterator::type const_iterator; + + public: // construction, assignment + template< class ForwardTraversalIterator > + sub_range( ForwardTraversalIterator Begin, ForwardTraversalIterator End ); + + template< class ForwardRange2 > + sub_range( ForwardRange2& r ); + + template< class ForwardRange2 > + sub_range( const Range2& r ); + + template< class ForwardRange2 > + sub_range& operator=( ForwardRange2& r ); + + template< class ForwardRange2 > + sub_range& operator=( const ForwardRange2& r ); + + public: // Forward Range functions + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + + public: // convenience + value_type& front(); + const value_type& front() const; + value_type& back(); + const value_type& back() const; + // for Random Access Range only: + value_type& operator[]( size_type at ); + const value_type& operator[]( size_type at ) const; + + public: + // rest of interface inherited from iterator_range + }; + +} // namespace 'boost' +`` + +The class should be trivial to use as seen below. Imagine that we have an algorithm that searches for a sub-string in a string. The result is an iterator_range, that delimits the match. We need to store the result from this algorithm. Here is an example of how we can do it with and without `sub_range` + +`` +std::string str("hello"); +iterator_range ir = find_first( str, "ll" ); +sub_range sub = find_first( str, "ll" ); +`` + +[endsect] + +[endsect] + + + +[section:style_guide Terminology and style guidelines] + +The use of a consistent terminology is as important for __ranges__ and range-based algorithms as it is for iterators and iterator-based algorithms. If a conventional set of names are adopted, we can avoid misunderstandings and write generic function prototypes that are ['self-documenting]. + +Since ranges are characterized by a specific underlying iterator type, we get a type of range for each type of iterator. Hence we can speak of the following types of ranges: + +* ['Value access] category: + * Readable Range + * Writeable Range + * Swappable Range + * Lvalue Range +* ['Traversal] category: + * __single_pass_range__ + * __forward_range__ + * __bidirectional_range__ + * __random_access_range__ + +Notice how we have used the categories from the __new_style_iterators__. + +Notice that an iterator (and therefore an range) has one ['traversal] property and one or more properties from the ['value access] category. So in reality we will mostly talk about mixtures such as + +* Random Access Readable Writeable Range +* Forward Lvalue Range + +By convention, we should always specify the ['traversal] property first as done above. This seems reasonable since there will only be one ['traversal] property, but perhaps many ['value access] properties. + +It might, however, be reasonable to specify only one category if the other category does not matter. For example, the __iterator_range__ can be constructed from a Forward Range. This means that we do not care about what ['value access] properties the Range has. Similarly, a Readable Range will be one that has the lowest possible ['traversal] property (Single Pass). + +As another example, consider how we specify the interface of `std::sort()`. Algorithms are usually more cumbersome to specify the interface of since both traversal and value access properties must be exactly defined. The iterator-based version looks like this: + +`` + template< class RandomAccessTraversalReadableWritableIterator > + void sort( RandomAccessTraversalReadableWritableIterator first, + RandomAccessTraversalReadableWritableIterator last ); +`` + +For ranges the interface becomes + +`` + template< class RandomAccessReadableWritableRange > + void sort( RandomAccessReadableWritableRange& r ); +`` + +[endsect] + + + +[section Library Headers] + +[table + [[Header ] [Includes ] [Related Concept ]] + [[`` ] [everything ] [- ]] + [[`` ] [every metafunction ] [- ]] + [[`` ] [every function ] [- ]] + [[`` ] [`range_value` ] [__single_pass_range__ ]] + [[`` ] [`range_iterator` ] [__single_pass_range__ ]] + [[`` ] [`range_const_iterator` ] [__single_pass_range__ ]] + [[`` ] [`range_difference` ] [__forward_range__ ]] + [[`` ] [`range_size` ] [__forward_range__ ]] + [[`` ] [`range_result_iterator` ] [- ]] + [[``] [`range_reverse_iterator` ] [__bidirectional_range__ ]] + [[``] + [`range_const_reverse_iterator`] + [_bidirectional_range__ ]] + [[``] + [`range_reverse_result_iterator`] + [- ]] + [[`` ] [`begin` and `const_begin` ] [__single_pass_range__ ]] + [[`` ] [`end` and `const_end` ] [__single_pass_range__ ]] + [[`` ] [`empty` ] [__single_pass_range__ ]] + [[`` ] [`size` ] [__forward_range__ ]] + [[`` ] [`rbegin` and `const_rbegin`] [__bidirectional_range__ ]] + [[`` ] [`rend` and `const_rend` ] [__bidirectional_range__ ]] + [[`` ] [`iterator_range` ] [- ]] + [[`` ] [`sub_range` ] [- ]] + [[`` ] [`concept checks` ] [- ]] +] + +[endsect] + + + +[section Examples] + +Some examples are given in the accompanying test files: + +* [@http://www.boost.org/libs/range/test/string.cpp string.cpp][br] +shows how to implement a container version of `std::find()` that works with `char[]`,`wchar_t[]`,`char*`,`wchar_t*`. + +[:[*Warning: ['support for null-terminated strings is deprecated and will disappear in the next Boost release (1.34).]]] + +* [@http://www.boost.org/libs/range/test/algorithm_example.cpp algorithm_example.cpp][br]shows the replace example from the introduction. + +* [@http://www.boost.org/libs/range/test/iterator_range.cpp iterator_range.cpp] + +* [@http://www.boost.org/libs/range/test/sub_range.cpp sub_range.cpp] + +* [@http://www.boost.org/libs/range/test/iterator_pair.cpp iterator_pair.cpp] + +* [@http://www.boost.org/libs/range/test/reversible_range.cpp reversible_range.cpp] + +* [@http://www.boost.org/libs/range/test/std_container.cpp std_container.cpp] + +* [@http://www.boost.org/libs/range/test/array.cpp array.cpp] + +[endsect] + + + +[section Portability] + +A huge effort has been made to port the library to as many compilers as possible. + +Full support for built-in arrays require that the compiler supports class template partial specialization. For non-conforming compilers there might be a chance that it works anyway thanks to workarounds in the type traits library. +Visual C++ 6/7.0 has a limited support for arrays: as long as the arrays are of built-in type it should work. + +Notice also that some compilers cannot do function template ordering properly. In that case one must rely of __range_result_iterator__ and a single function definition instead of overloaded versions for const and non-const arguments. So if one cares about old compilers, one should not pass rvalues to the functions. + +For maximum portability you should follow these guidelines: + +# do not use built-in arrays, +# do not pass rvalues to `begin()`, `end()` and `iterator_range` Range constructors and assignment operators, +# use `const_begin()` and `const_end()` whenever your code by intention is read-only; this will also solve most rvalue problems, +# do not rely on ADL: + * if you overload functions, include that header before the headers in this library, + * put all overloads in namespace boost. + + + +[endsect] + + + +[section FAQ] + +1. ['[*Why is there no difference between `range_iterator::type` and `range_const_iterator::type` for `std::pair`?]] + +[:In general it is not possible nor desirable to find a corresponding `const_iterator`. When it is possible to come up with one, the client might choose to construct a `std::pair` object.] + +[:Note that an __iterator_range__ is somewhat more convenient than a `pair` and that a __sub_range__ does propagate const-ness.] + +2. ['[*Why is there not supplied more types or more functions?]] + +[:The library has been kept small because its current interface will serve most purposes. If and when a genuine need arises for more functionality, it can be implemented.] + +3. ['[*How should I implement generic algorithms for ranges?]] + +[:One should always start with a generic algorithm that takes two iterators (or more) as input. Then use Boost.Range to build handier versions on top of the iterator based algorithm. Please notice that once the range version of the algorithm is done, it makes sense not to expose the iterator version in the public interface.] + +4. ['[*Why is there no Incrementable Range concept?]] + +[:Even though we speak of incrementable iterators, it would not make much sense for ranges; for example, we cannot determine the size and emptiness of a range since we cannot even compare its iterators.] + +[:Note also that incrementable iterators are derived from output iterators and so there exist no output range.] + +[endsect] + +[section:history_ack History and Acknowledgement] + +The library have been under way for a long time. Dietmar Kühl originally intended to submit an `array_traits` class template which had most of the functionality present now, but only for arrays and standard containers. + +Meanwhile work on algorithms for containers in various contexts showed the need for handling pairs of iterators, and string libraries needed special treatment of character arrays. In the end it made sense to formalize the minimal requirements of these similar concepts. And the results are the Range concepts found in this library. + +The term Range was adopted because of paragraph 24.1/7 from the C++ standard: + +Most of the library's algorithmic templates that operate on data structures have interfaces that use ranges. A range is a pair of iterators that designate the beginning and end of the computation. A range [i, i) is an empty range; in general, a range [i, j) refers to the elements in the data structure starting with the one pointed to by i and up to but not including the one pointed to by j. Range [i, j) is valid if and only if j is reachable from i. The result of the application of functions in the library to invalid ranges is undefined. + +Special thanks goes to + +* Pavol Droba for help with documentation and implementation +* Pavel Vozenilek for help with porting the library +* Jonathan Turkanis and John Torjo for help with documentation +* Hartmut Kaiser for being review manager +* Jonathan Turkanis for porting the lib (as far sa possible) to vc6 and vc7. + +The concept checks and their documentation was provided by Daniel Walker. + +[endsect] \ No newline at end of file diff --git a/doc/example.cpp b/doc/example.cpp index a45bbcc..afe448f 100644 --- a/doc/example.cpp +++ b/doc/example.cpp @@ -1,10 +1,3 @@ -/* -// Copyright Thorsten Ottosen 2003-2005. Use, modification and -// distribution is subject to 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 #include // for std::iterator_traits, std::distance() diff --git a/doc/examples.html b/doc/examples.html index b0e4973..0ea235d 100755 --- a/doc/examples.html +++ b/doc/examples.html @@ -26,10 +26,6 @@ shows how to implement a container version of std::find() that works with char[],wchar_t[],char*,wchar_t*. -

- Warning: support for null-terminated strings is deprecated and will - disappear in the next Boost release (1.34). -

  • algorithm_example.cpp @@ -47,7 +43,7 @@

    - (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + (C) Copyright Thorsten Ottosen 2003-2004


    diff --git a/doc/faq.html b/doc/faq.html index 614725a..34304ef 100755 --- a/doc/faq.html +++ b/doc/faq.html @@ -116,7 +116,7 @@ Cool indeed!

    - (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + (C) Copyright Thorsten Ottosen 2003-2004


    diff --git a/doc/headers.html b/doc/headers.html index 4d320a1..69987ce 100755 --- a/doc/headers.html +++ b/doc/headers.html @@ -50,6 +50,12 @@ >range_iterator Single Pass Range + + <boost/range/mutable_iterator.hpp> + range_mutable_iterator + Single Pass Range + <boost/range/const_iterator.hpp> Forward Range - <boost/range/size_type.hpp> - range_size - Forward Range - - - <boost/range/result_iterator.hpp> - range_result_iterator + <boost/range/pointer.hpp> + range_pointer - + + <boost/range/category.hpp> + range_category + - + + <boost/range/reverse_iterator.hpp> range_reverse_iterator Bidirectional Range - - <boost/range/const_reverse_iterator.hpp> - range_const_reverse_iterator - Bidirectional Range - - - <boost/range/reverse_result_iterator.hpp> - range_reverse_result_iterator - - - <boost/range/begin.hpp> @@ -109,10 +107,16 @@ empty Single Pass Range + + <boost/range/distance.hpp> + distance + Forward Range + <boost/range/size.hpp> size - Forward Range + Random Access Range + <boost/range/rbegin.hpp> @@ -130,6 +134,21 @@ Bidirectional Range + + <boost/range/as_array.hpp> + + as_array + + - + + + <boost/range/as_literal.hpp> + + as_literal + + - + + <boost/range/iterator_range.hpp>

    - (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + (C) Copyright Thorsten Ottosen 2003-2007


    diff --git a/doc/history_ack.html b/doc/history_ack.html index ec3d887..40ee5dc 100755 --- a/doc/history_ack.html +++ b/doc/history_ack.html @@ -61,7 +61,7 @@ C++ standard:

    - (C) Copyright Thorsten Ottosen 2003-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + (C) Copyright Thorsten Ottosen 2003-2006


    diff --git a/doc/intro.html b/doc/intro.html index a2a6701..8478d3e 100755 --- a/doc/intro.html +++ b/doc/intro.html @@ -35,16 +35,14 @@ enough functionality to satisfy the needs of the generic code if a suitable layer of indirection is applied . For example, raw arrays are often suitable for use with generic code that - works with containers, provided a suitable adapter is used. Likewise, null - terminated strings can be treated as containers of characters, if suitably - adapted. + works with containers, provided a suitable adapter is used.

    This library therefore provides the means to adapt standard-like - containers, - null terminated strings, std::pairs of iterators, and raw - arrays (and more), such that the same generic code can work with them all. + containers, std::pairs of iterators, and raw arrays (and + more), such that + the same generic code can work with them all. The basic idea is to add another layer of indirection using metafunctions and free-standing functions so syntactic and/or semantic differences can be removed. @@ -60,22 +58,14 @@ free-standing functions so syntactic and/or semantic differences can be removed. more flexible, compact and maintainable client code

  • - correct handling of null-terminated strings -

    - Warning: support for null-terminated strings is deprecated and will - disappear in the next Boost release (1.34). -

    + safe use of built-in arrays
  • -
  • - safe use of built-in arrays (for legacy code; why else would you use - built-in arrays?)
  • - Below are given a small example (the complete example can be found here - ): -

    + Below are given a small example (the complete example can be found here):
     
         //
    @@ -89,7 +79,7 @@ free-standing functions so syntactic and/or semantic differences can be removed.
         }
     
         template< class ForwardReadableRange, class T >
    -    inline typename boost::range_const_iterator< inline typename boost::range_iterator< const ForwardReadableRange >::type
         find( const ForwardReadableRange& c, const T& value )
         {
    @@ -100,7 +90,7 @@ class=identifier>ForwardReadableRange >::template< class ForwardReadableWriteableRange, class T >
    -    inline typename boost::range_size< ForwardReadableWriteableRange >::type
    +    inline typename boost::range_difference< ForwardReadableWriteableRange >::type
         my_generic_replace( ForwardReadableWriteableRange& c, const T& value, const T& replacement )
         {
            typename boost::range_iterator< ForwardReadableWriteableRange >::type found = find( c, value );
    @@ -146,7 +136,7 @@ Notice that we have to
     
         

    - (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + (C) Copyright Thorsten Ottosen 2003-2007


    diff --git a/doc/mfc_atl.html b/doc/mfc_atl.html new file mode 100644 index 0000000..a022fe3 --- /dev/null +++ b/doc/mfc_atl.html @@ -0,0 +1,581 @@ + + + + + + +Boost Range MFC/ATL Extension + + + + + + +
    +

    Boost Range MFC/ATL Extension

    + +++ + + + + + + + + + +
    Author:Shunsuke Sogame
    Contact:mb2act@yahoo.co.jp
    Date:26th of May 2006
    Copyright:Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt).
    +
    +

    Overview

    +

    Boost.Range MFC/ATL Extension provides Boost.Range support for MFC/ATL collection and string types.

    +
    +CTypedPtrArray<CPtrArray, CList<CString> *> myArray;
    +...
    +BOOST_FOREACH (CList<CString> *theList, myArray)
    +{
    +    BOOST_FOREACH (CString& str, *theList)
    +    {
    +        boost::to_upper(str);
    +        std::sort(boost::begin(str), boost::end(str));
    +        ...
    +    }
    +}
    +
    + +
    +
    +

    Requirements

    + +
    +
    +

    MFC Ranges

    +

    If the <boost/range/mfc.hpp> is included before or after Boost.Range headers, +the MFC collections and strings become models of Range. +The table below lists the Traversal Category and range_reference of MFC ranges.

    + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    RangeTraversal Categoryrange_reference<Range>::type
    CArray<T,A>Random AccessT&
    CList<T,A>BidirectionalT&
    CMap<K,AK,M,AM>ForwardRange::CPair&
    CTypedPtrArray<B,T*>Random AccessT* const
    CTypedPtrList<B,T*>BidirectionalT* const
    CTypedPtrMap<B,T*,V*>Forwardstd::pair<T*,V*> const
    CByteArrayRandom AccessBYTE&
    CDWordArrayRandom AccessDWORD&
    CObArrayRandom AccessCObject* &
    CPtrArrayRandom Accessvoid* &
    CStringArrayRandom AccessCString&
    CUIntArrayRandom AccessUINT&
    CWordArrayRandom AccessWORD&
    CObListBidirectionalCObject* &
    CPtrListBidirectionalvoid* &
    CStringListBidirectionalCString&
    CMapPtrToWordForwardstd::pair<void*,WORD> const
    CMapPtrToPtrForwardstd::pair<void*,void*> const
    CMapStringToObForwardstd::pair<String,CObject*> const
    CMapStringToStringForwardRange::CPair&
    CMapWordToObForwardstd::pair<WORD,CObject*> const
    CMapWordToPtrForwardstd::pair<WORD,void*> const
    +

    Other Boost.Range metafunctions are defined by the following. +Let Range be any type listed above and ReF be the same as range_reference<Range>::type. +range_value<Range>::type is the same as remove_reference<remove_const<Ref>::type>::type, +range_difference<Range>::type is the same as std::ptrdiff_t, and +range_pointer<Range>::type is the same as add_pointer<remove_reference<Ref>::type>::type. +As for const Range, see const Ranges.

    +
    +
    +

    ATL Ranges

    +

    If the <boost/range/atl.hpp> is included before or after Boost.Range headers, +the ATL collections and strings become models of Range. +The table below lists the Traversal Category and range_reference of ATL ranges.

    + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    RangeTraversal Categoryrange_reference<Range>::type
    CAtlArray<E,ET>Random AccessE&
    CAutoPtrArray<E>Random AccessE&
    CInterfaceArray<I,pi>Random AccessCComQIPtr<I,pi>&
    CAtlList<E,ET>BidirectionalE&
    CAutoPtrList<E>BidirectionalE&
    CHeapPtrList<E,A>BidirectionalE&
    CInterfaceList<I,pi>BidirectionalCComQIPtr<I,pi>&
    CAtlMap<K,V,KT,VT>ForwardRange::CPair&
    CRBTree<K,V,KT,VT>BidirectionalRange::CPair&
    CRBMap<K,V,KT,VT>BidirectionalRange::CPair&
    CRBMultiMap<K,V,KT,VT>BidirectionalRange::CPair&
    CSimpleStringT<B,b>Random AccessB&
    CStringT<B,ST>Random AccessB&
    CFixedStringT<S,n>Random Accessrange_reference<S>::type
    CStringT<B,ST>Random AccessB&
    CComBSTRRandom AccessOLECHAR&
    CSimpleArray<T,TE>Random AccessT&
    +

    Other Boost.Range metafunctions are defined by the following. +Let Range be any type listed above and ReF be the same as range_reference<Range>::type. +range_value<Range>::type is the same as remove_reference<Ref>::type, +range_difference<Range>::type is the same as std::ptrdiff_t, and +range_pointer<Range>::type is the same as add_pointer<remove_reference<Ref>::type>::type. +As for const Range, see const Ranges.

    +
    +
    +

    const Ranges

    +

    range_reference<const Range>::type is defined by the following algorithm. +Let Range be any type listed above and ReF be the same as range_reference<Range>::type.

    +
    +if (Range is CObArray || Range is CObList)
    +    return CObject const * &
    +else if (Range is CPtrArray || Range is CPtrList)
    +    return void const * &
    +else if (there is a type X such that X& is the same as ReF)
    +    return X const &
    +else if (there is a type X such that X* const is the same as ReF)
    +    return X const * const
    +else
    +    return ReF
    +
    +

    Other Boost.Range metafunctions are defined by the following. +range_value<const Range>::type is the same as range_value<Range>::type, +range_difference<const Range>::type is the same as std::ptrdiff_t, and +range_pointer<const Range>::type is the same as add_pointer<remove_reference<range_reference<const Range>::type>::type>::type.

    +
    + +
    + + diff --git a/doc/mfc_atl.rst b/doc/mfc_atl.rst new file mode 100644 index 0000000..67498fb --- /dev/null +++ b/doc/mfc_atl.rst @@ -0,0 +1,232 @@ + +++++++++++++++++++++++++++++++++ + |Boost| Range MFC/ATL Extension +++++++++++++++++++++++++++++++++ + +.. |Boost| image:: http://www.boost.org/libs/ptr_container/doc/boost.png + + + +:Author: Shunsuke Sogame +:Contact: mb2act@yahoo.co.jp +:date: 26th of May 2006 +:copyright: Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt__). + +__ http://www.boost.org/LICENSE_1_0.txt + + + +======== +Overview +======== + +Boost.Range MFC/ATL Extension provides `Boost.Range`_ support for MFC/ATL collection and string types. + + +.. parsed-literal:: + + CTypedPtrArray \*> myArray; + ... + BOOST_FOREACH (CList \*theList, myArray) + { + BOOST_FOREACH (CString& str, \*theList) + { + boost::to_upper(str); + std::sort(boost::begin(str), boost::end(str)); + ... + } + } + + + +* `Requirements`_ +* `MFC Ranges`_ +* `ATL Ranges`_ +* `const Ranges`_ +* `References`_ + + + +============ +Requirements +============ + +- `Boost C++ Libraries Version 1.34.0`__ or later (no compilation required) +- Visual C++ 7.1 or Visual C++ 8.0 + +__ Boost_ + + + +========== +MFC Ranges +========== + +If the ```` is included before or after `Boost.Range`_ headers, +the MFC collections and strings become models of Range. +The table below lists the Traversal Category and ``range_reference`` of MFC ranges. + + +============================= ================== ======================================= +``Range`` Traversal Category ``range_reference::type`` +============================= ================== ======================================= +``CArray`` Random Access ``T&`` +----------------------------- ------------------ --------------------------------------- +``CList`` Bidirectional ``T&`` +----------------------------- ------------------ --------------------------------------- +``CMap`` Forward ``Range::CPair&`` +----------------------------- ------------------ --------------------------------------- +``CTypedPtrArray`` Random Access ``T* const`` +----------------------------- ------------------ --------------------------------------- +``CTypedPtrList`` Bidirectional ``T* const`` +----------------------------- ------------------ --------------------------------------- +``CTypedPtrMap`` Forward ``std::pair const`` +----------------------------- ------------------ --------------------------------------- +``CByteArray`` Random Access ``BYTE&`` +----------------------------- ------------------ --------------------------------------- +``CDWordArray`` Random Access ``DWORD&`` +----------------------------- ------------------ --------------------------------------- +``CObArray`` Random Access ``CObject* &`` +----------------------------- ------------------ --------------------------------------- +``CPtrArray`` Random Access ``void* &`` +----------------------------- ------------------ --------------------------------------- +``CStringArray`` Random Access ``CString&`` +----------------------------- ------------------ --------------------------------------- +``CUIntArray`` Random Access ``UINT&`` +----------------------------- ------------------ --------------------------------------- +``CWordArray`` Random Access ``WORD&`` +----------------------------- ------------------ --------------------------------------- +``CObList`` Bidirectional ``CObject* &`` +----------------------------- ------------------ --------------------------------------- +``CPtrList`` Bidirectional ``void* &`` +----------------------------- ------------------ --------------------------------------- +``CStringList`` Bidirectional ``CString&`` +----------------------------- ------------------ --------------------------------------- +``CMapPtrToWord`` Forward ``std::pair const`` +----------------------------- ------------------ --------------------------------------- +``CMapPtrToPtr`` Forward ``std::pair const`` +----------------------------- ------------------ --------------------------------------- +``CMapStringToOb`` Forward ``std::pair const`` +----------------------------- ------------------ --------------------------------------- +``CMapStringToString`` Forward ``Range::CPair&`` +----------------------------- ------------------ --------------------------------------- +``CMapWordToOb`` Forward ``std::pair const`` +----------------------------- ------------------ --------------------------------------- +``CMapWordToPtr`` Forward ``std::pair const`` +============================= ================== ======================================= + + +Other `Boost.Range`_ metafunctions are defined by the following. +Let ``Range`` be any type listed above and ``ReF`` be the same as ``range_reference::type``. +``range_value::type`` is the same as ``remove_reference::type>::type``, +``range_difference::type`` is the same as ``std::ptrdiff_t``, and +``range_pointer::type`` is the same as ``add_pointer::type>::type``. +As for ``const Range``, see `const Ranges`_. + + + +========== +ATL Ranges +========== + +If the ```` is included before or after `Boost.Range`_ headers, +the ATL collections and strings become models of Range. +The table below lists the Traversal Category and ``range_reference`` of ATL ranges. + + +============================= ================== ======================================= +``Range`` Traversal Category ``range_reference::type`` +============================= ================== ======================================= +``CAtlArray`` Random Access ``E&`` +----------------------------- ------------------ --------------------------------------- +``CAutoPtrArray`` Random Access ``E&`` +----------------------------- ------------------ --------------------------------------- +``CInterfaceArray`` Random Access ``CComQIPtr&`` +----------------------------- ------------------ --------------------------------------- +``CAtlList`` Bidirectional ``E&`` +----------------------------- ------------------ --------------------------------------- +``CAutoPtrList`` Bidirectional ``E&`` +----------------------------- ------------------ --------------------------------------- +``CHeapPtrList`` Bidirectional ``E&`` +----------------------------- ------------------ --------------------------------------- +``CInterfaceList`` Bidirectional ``CComQIPtr&`` +----------------------------- ------------------ --------------------------------------- +``CAtlMap`` Forward ``Range::CPair&`` +----------------------------- ------------------ --------------------------------------- +``CRBTree`` Bidirectional ``Range::CPair&`` +----------------------------- ------------------ --------------------------------------- +``CRBMap`` Bidirectional ``Range::CPair&`` +----------------------------- ------------------ --------------------------------------- +``CRBMultiMap`` Bidirectional ``Range::CPair&`` +----------------------------- ------------------ --------------------------------------- +``CSimpleStringT`` Random Access ``B&`` +----------------------------- ------------------ --------------------------------------- +``CStringT`` Random Access ``B&`` +----------------------------- ------------------ --------------------------------------- +``CFixedStringT`` Random Access ``range_reference::type`` +----------------------------- ------------------ --------------------------------------- +``CStringT`` Random Access ``B&`` +----------------------------- ------------------ --------------------------------------- +``CComBSTR`` Random Access ``OLECHAR&`` +----------------------------- ------------------ --------------------------------------- +``CSimpleArray`` Random Access ``T&`` +============================= ================== ======================================= + + +Other `Boost.Range`_ metafunctions are defined by the following. +Let ``Range`` be any type listed above and ``ReF`` be the same as ``range_reference::type``. +``range_value::type`` is the same as ``remove_reference::type``, +``range_difference::type`` is the same as ``std::ptrdiff_t``, and +``range_pointer::type`` is the same as ``add_pointer::type>::type``. +As for ``const Range``, see `const Ranges`_. + + + +============ +const Ranges +============ + +``range_reference::type`` is defined by the following algorithm. +Let ``Range`` be any type listed above and ``ReF`` be the same as ``range_reference::type``. + + +.. parsed-literal:: + + if (Range is CObArray || Range is CObList) + return CObject const \* & + else if (Range is CPtrArray || Range is CPtrList) + return void const \* & + else if (there is a type X such that X& is the same as ReF) + return X const & + else if (there is a type X such that X* const is the same as ReF) + return X const \* const + else + return ReF + + +Other `Boost.Range`_ metafunctions are defined by the following. +``range_value::type`` is the same as ``range_value::type``, +``range_difference::type`` is the same as ``std::ptrdiff_t``, and +``range_pointer::type`` is the same as ``add_pointer::type>::type>::type``. + + + +========== +References +========== +- `Boost.Range`_ +- `MFC Collections`__ +- `ATL Collection Classes`__ + +__ http://msdn2.microsoft.com/en-us/library/942860sh.aspx +__ http://msdn2.microsoft.com/en-US/library/15e672bd.aspx + + + +.. _Boost C++ Libraries: http://www.boost.org/ +.. _Boost: `Boost C++ Libraries`_ +.. _Boost.Range: ../index.html +.. _forward: range.html#forward_range +.. _bidirectional: range.html#forward_range +.. _random access: range.html#random_access_range + diff --git a/doc/portability.html b/doc/portability.html index 2461222..20b1355 100755 --- a/doc/portability.html +++ b/doc/portability.html @@ -36,7 +36,7 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here Notice also that some compilers cannot do function template ordering properly. In that case one must rely of range_result_iterator + href="boost_range.html#range_iterator">range_iterator and a single function definition instead of overloaded versions for const and non-const arguments. @@ -75,7 +75,7 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here

    - (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + (C) Copyright Thorsten Ottosen 2003-2004


    diff --git a/doc/range.html b/doc/range.html index 0fe4c88..dfe9345 100755 --- a/doc/range.html +++ b/doc/range.html @@ -50,7 +50,7 @@ Range provides iterators for accessing a half-open range [first,one_past_last) of elements and provides information about the number of elements in the Range. However, a Range has - fewer requirements than a Container. + much fewer requirements than a Container.

    The motivation for the Range concept is @@ -78,9 +78,9 @@ The operations that can be performed on a Range is dependent on the traversal category of the underlying iterator type. Therefore - the range concepts are named to reflect which traversal category its - iterators support. See also terminology and style guidelines. - for more information about naming of ranges.

    + the range concepts are named to reflect which traversal category their + iterators support. See also terminology and style + guidelines. for more information about naming of ranges.

    The concepts described below specifies associated types as metafunctions and all @@ -118,11 +118,7 @@ Single Pass Iterator

    Associated types

    - - - - + @@ -132,7 +128,7 @@ Single Pass Iterator - + @@ -161,20 +157,16 @@ Single Pass Iterator - - - - - +
    Value typeboost::range_value<X>::typeThe type of the object stored in a Range. -
    Iterator type boost::range_iterator<X>::type
    Const iterator typeboost::range_const_iterator<X>::typeboost::range_iterator<const X>::type A type of iterator that may be used to examine, but not to modify, a Range's elements.
    Beginning of range boost::begin(a) boost::range_iterator<X>::type if -a is mutable, boost::range_const_iterator<X>::type +a is mutable, boost::range_iterator<const X>::type otherwise
    End of range boost::end(a) boost::range_iterator<X>::type if -a is mutable, boost::range_const_iterator<X>::type +a is mutable, boost::range_iterator<const X>::type otherwise
    Is range empty?boost::empty(a)Convertible to bool

    Expression semantics

    @@ -188,7 +180,7 @@ otherwise boost::begin(a) Returns an iterator pointing to the first element in the Range. boost::begin(a) is either dereferenceable or past-the-end. - It is past-the-end if and only if boost::size(a) == 0. + It is past-the-end if and only if boost::distance(a) == 0. boost::end(a) @@ -196,19 +188,14 @@ otherwise Range. boost::end(a) is past-the-end. - - boost::empty(a) - Equivalent to boost::begin(a) == boost::end(a). (But possibly - faster.) -  -  - +

    Complexity guarantees

    - All three functions are at most amortized linear time. For most practical - purposes, one can expect boost::begin(a), boost::end(a) and boost::empty(a) - to be amortized constant time. + boost::end(a) is at most amortized linear time, boost::begin(a) is + amortized constant time. For most practical + purposes, one can expect both to be amortized constant time.

    Invariants

    @@ -227,14 +214,17 @@ otherwise

    See also

    -

    - Container -

    -

    implementation of +

    Extending the library for UDTs

    +

    Implementation of metafunctions

    -

    implementation of +

    Implementation of functions

    +

    + Container +

    +

    Forward Range

    @@ -261,76 +251,8 @@ href="../../iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-

    Refinement of

    Single Pass Range -

    Associated types

    - -
    - - - - - - - - - - -
    Distance typeboost::range_difference<X>::typeA signed integral type used to represent the distance between - two of the Range's iterators. This type must be the same as the iterator's - distance type.
    Size typeboost::range_size<X>::typeAn unsigned integral type that can represent any nonnegative - value of the Range's distance type.
    - -

    Valid expressions

    - - - - - - - - - - - - -
    NameExpressionReturn type
    Size of rangeboost::size(a)boost::range_size<X>::type
    - -

    Expression semantics

    - - - - - - - - - - - - -
    ExpressionSemanticsPostcondition
    boost::size(a)Returns the size of the Range, that is, its number -of elements. Note boost::size(a) == 0u is equivalent to -boost::empty(a).boost::size(a) >= 0
    - -

    Complexity guarantees

    - -

    boost::size(a) is at most amortized linear time.

    - -

    Invariants

    -

    - - - -
    Range sizeboost::size(a) is equal to the distance from boost::begin(a) - to boost::end(a).
    -

    - -

    See also

    -

    implementation of - metafunctions

    - -

    implementation of - functions

    - +

    +

    Bidirectional Range

    @@ -356,83 +278,8 @@ s-lib-bidirectional-traversal-iterators">Bidirectional Traversal Iterator.

    Refinement of

    Forward Range -

    Associated types

    - - - - - - - - - - - - -
    Reverse Iterator typeboost::range_reverse_iterator<X>::typeThe type of iterator used to iterate through a Range's elements - in reverse order. The iterator's value type is expected to be the Range's value - type. A conversion from the reverse iterator type to the const reverse iterator - type must exist.
    Const reverse iterator typeboost::range_const_reverse_iterator<X>::typeA type of reverse iterator that may be used to examine, but not - to modify, a Range's elements.
    - - -

    Valid expressions

    - - - - - - - - - - - - - - - - - - - -
    NameExpressionReturn typeSemantics
    Beginning of rangeboost::rbegin(a)boost::range_reverse_iterator<X>::type if -a is mutable, boost::range_const_reverse_iterator<X>::type -otherwise.Equivalent to -boost::range_reverse_iterator<X>::type(boost::end(a)).
    End of rangeboost::rend(a)boost::range_reverse_iterator<X>::type if -a is mutable, boost::range_const_reverse_iterator<X>::type -otherwise.Equivalent to -boost::range_reverse_iterator<X>::type(boost::begin(a)).
    - -

    Complexity guarantees

    - - boost::rbegin(a) has the same complexity as boost::end(a) and boost::rend(a) - has the same complexity as boost::begin(a) from Forward Range. - -

    Invariants

    -

    - - - - - - - - - -
    Valid reverse rangeFor any Bidirectional Range a, [boost::rbegin(a),boost::rend(a)) - is a valid range, that is, boost::rend(a) is reachable from boost::rbegin(a) - in a finite number of increments.
    CompletenessAn algorithm that iterates through the range [boost::rbegin(a),boost::rend(a)) - will pass through every element of a.
    -

    - -

    See also

    -

    implementation of metafunctions

    - -

    implementation of - functions

    + +


    @@ -455,7 +302,7 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator

    Concept Checking

    Each of the range concepts has a corresponding concept checking - class in the file boost/range/concepts.hpp. These classes may be + class in the file . These classes may be used in conjunction with the
    Boost Concept Check library to insure that the type of a template parameter @@ -529,8 +376,8 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator Jeremy Siek - Copyright © 2004 - Thorsten Ottosen. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + Copyright © 2004-2007 + Thorsten Ottosen.
    diff --git a/doc/style.css b/doc/style.css index 227040a..1890b52 100755 --- a/doc/style.css +++ b/doc/style.css @@ -1,10 +1,3 @@ -/* -#// Copyright Thorsten Ottosen 2003-2005. Use, modification and -#// distribution is subject to 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) -*/ - pre{ BORDER-RIGHT: gray 1pt solid; PADDING-RIGHT: 2pt; diff --git a/doc/style.html b/doc/style.html index 76a63f1..9a5617e 100755 --- a/doc/style.html +++ b/doc/style.html @@ -104,7 +104,7 @@

    - (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + (C) Copyright Thorsten Ottosen 2003-2004


    diff --git a/doc/utility_class.html b/doc/utility_class.html index 6dfa78b..f7b5535 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -59,19 +59,16 @@ corresponding const_iterator is.

    If the template argument is not a model of Forward Traversal Iterator, one can still use a subset of the interface. In particular, size() requires - Forward Traversal Iterators whereas empty() only requires Single + Random Access Iterators whereas empty() only requires Single Pass Iterators.

    Recall that many default constructed iterators are singular and hence can only be assigned, but not compared or - incremented or anything. However, if one creates a default constructed - iterator_range, then one - can still call all its member functions. This means that the - iterator_range will still be usable in many contexts even - though the iterators underneath are not. -

    + incremented or anything. Likewise, if one creates a default constructed + iterator_range, then one have to be careful about not doing + anything besides copying.

    Synopsis

    @@ -82,12 +79,10 @@ corresponding const_iterator is.

    class iterator_range { public: // Forward Range types - typedef ... value_type; - typedef ... difference_type; - typedef ... size_type; - typedef ForwardTraversalIterator iterator; - typedef ForwardTraversalIterator const_iterator; - + typedef ForwardTraversalIterator iterator; + typedef ForwardTraversalIterator const_iterator; + typedef iterator_difference<iterator>::type difference_type; +
    public: // construction, assignment template< class ForwardTraversalIterator2 > iterator_range( ForwardTraversalIterator2 Begin, ForwardTraversalIterator2 End ); @@ -105,22 +100,24 @@ corresponding const_iterator is.

    iterator_range& operator=( const ForwardRange& r ); public: // Forward Range functions - iterator begin() const; - iterator end() const; - size_type size() const; - bool empty() const; + iterator begin() const; + iterator end() const; + difference_type size() const; + bool empty() const; public: // convenience - operator unspecified_bool_type() const; - bool operator unspecified_bool_type() const; + bool equal( const iterator_range& ) ( const iterator_range& ) const; - value_type& front() const; - value_type& back() const; + reference front() const; + reference back() const; + iterator_range& advance_begin( difference_type n ); + iterator_range& advance_end( difference_type n ); // for Random Access Range only: - value_type& operator[]( size_type at ) const; + reference operator[]( difference_type at ) const; + value_type operator()( difference_type at ) const; }; // stream output @@ -173,11 +170,11 @@ class=keyword>const; ForwardTraversalIterator End ); template< class ForwardRange > - iterator_range< typename iterator_of<ForwardRange>::type > + iterator_range< typename range_iterator<ForwardRange>::type > make_iterator_range( ForwardRange& r ); template< class ForwardRange > - iterator_range< typename const_iterator_of<ForwardRange>::type > + iterator_range< typename range_iterator<const ForwardRange>::type > make_iterator_range( const ForwardRange& r ); template< class Range > @@ -187,7 +184,7 @@ class=keyword>const; typename range_difference<Range>::type advance_end ); template< class Range > - iterator_range< typename range_const_iterator<Range>::type > + iterator_range< typename range_iterator<const Range>::type > make_iterator_range( const Range& r, typename range_difference<Range>::type advance_begin, typename range_difference<Range>::type advance_end ); @@ -291,12 +288,14 @@ class can propagate constness since it knows what a corresponding namespace boost { template< class ForwardRange > - class sub_range : public iterator_range< typename range_result_iterator<ForwardRange>::type > + class sub_range : public iterator_range< typename range_iterator<ForwardRange>::type > { public: - typedef typename range_result_iterator<ForwardRange>::type iterator; - typedef typename range_const_iterator<ForwardRange>::type const_iterator; + typedef typename range_iterator<ForwardRange>::type iterator; + typedef typename range_iterator<const ForwardRange>::type const_iterator; + typedef typename iterator_difference<iterator>::type difference_type; + public: // construction, assignment template< class ForwardTraversalIterator > sub_range( ForwardTraversalIterator Begin, ForwardTraversalIterator End ); @@ -305,7 +304,7 @@ class can propagate constness since it knows what a corresponding sub_range( ForwardRange2& r ); template< class ForwardRange2 > - sub_range( const Range2& r ); + sub_range( const ForwardRange2& r ); template< class ForwardRange2 > sub_range& operator=( ForwardRange2& r ); @@ -325,8 +324,8 @@ class can propagate constness since it knows what a corresponding value_type& back(); const value_type& back() const; // for Random Access Range only: - value_type& operator[]( size_type at ); - const value_type& operator[]( size_type at ) const; + value_type& operator[]( difference_type at ); + const value_type& operator[]( difference_type at ) const; public: // rest of interface inherited from iterator_range @@ -344,15 +343,15 @@ store the result from this algorithm. Here is an example of how we can do it with and without sub_range
    -    std::string str("hello");
    -    iterator_range<std::string::iterator> ir = find_first( str, "ll" );
    -    sub_range<std::string>               sub = find_first( str, "ll" );
    +    std::string str("hello");
    +    iterator_range<std::string::iterator> ir = find_first( str, as_literal("ll") );
    +    sub_range<std::string>               sub = find_first( str, as_literal("ll") );
     


    - (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and distribution is subject to the Boost Software License, Version 1.0. + (C) Copyright Thorsten Ottosen 2003-2007


    diff --git a/index.html b/index.html index 05a90d3..5313690 100755 --- a/index.html +++ b/index.html @@ -18,7 +18,7 @@

    - Copyright © 2003-2004 Thorsten Ottosen + Copyright © 2003-2007 Thorsten Ottosen

    Use, modification and distribution is subject to the Boost Software License, Version 1.0 @@ -51,17 +51,15 @@

  • Terminology and style guidelines
  • Headers
  • -
  • Examples +
  • Examples +
  • MFC/ATL mapping (courtesy of Shunsuke + Sogame)
  • Portability
  • FAQ
  • History and acknowledgment -
    -

    - (C) Copyright Thorsten Ottosen 2003-2004 -



    diff --git a/test/TODO b/test/TODO new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/TODO @@ -0,0 +1 @@ + diff --git a/test/algorithm_example.cpp b/test/algorithm_example.cpp index cd6e0e0..85e2b22 100755 --- a/test/algorithm_example.cpp +++ b/test/algorithm_example.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,7 @@ namespace } template< typename Range, typename T > - inline typename boost::range_const_iterator::type + inline typename boost::range_iterator::type find( const Range& c, const T& value ) { return std::find( boost::begin( c ), boost::end( c ), value ); @@ -46,7 +47,7 @@ namespace // replace first value and return its index // template< class Range, class T > - inline typename boost::range_size::type + inline typename boost::range_difference::type my_generic_replace( Range& c, const T& value, const T& replacement ) { typename boost::range_iterator::type found = find( c, value ); @@ -63,19 +64,15 @@ void check_algorithm() // // usage // - const unsigned N = 5; + const int N = 5; std::vector my_vector; int values[] = { 1,2,3,4,5,6,7,8,9 }; my_vector.assign( values, values + 9 ); typedef std::vector::iterator iterator; std::pair my_view( boost::begin( my_vector ), boost::begin( my_vector ) + N ); - char str_val[] = "a string"; - char* str = str_val; - - BOOST_CHECK_EQUAL( my_generic_replace( my_vector, 4, 2 ), 3u ); + BOOST_CHECK_EQUAL( my_generic_replace( my_vector, 4, 2 ), 3 ); BOOST_CHECK_EQUAL( my_generic_replace( my_view, 4, 2 ), N ); - BOOST_CHECK_EQUAL( my_generic_replace( str, 'a', 'b' ), 0u ); } diff --git a/test/array.cpp b/test/array.cpp index d2f00b0..b438dce 100755 --- a/test/array.cpp +++ b/test/array.cpp @@ -42,16 +42,16 @@ void check_array() BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, const int* >::value )); BOOST_STATIC_ASSERT(( is_same< range_difference::type, std::ptrdiff_t >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, std::size_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, int* >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const int* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, int* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const int* >::value )); BOOST_STATIC_ASSERT(( is_same< range_value::type, const int >::value )); BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const int* >::value )); BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, const int* >::value )); BOOST_STATIC_ASSERT(( is_same< range_difference::type, std::ptrdiff_t >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, std::size_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const int* >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const int* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const int* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const int* >::value )); #endif BOOST_CHECK_EQUAL( begin( my_array ), my_array ); @@ -62,6 +62,8 @@ void check_array() BOOST_CHECK_EQUAL( end( ca ), ca + size( ca ) ); BOOST_CHECK_EQUAL( empty( ca ),false ); + const char A[] = "\0A"; + BOOST_CHECK_EQUAL( boost::size(A), 3 ); } using boost::unit_test::test_suite; diff --git a/test/atl.cpp b/test/atl.cpp new file mode 100644 index 0000000..50905b1 --- /dev/null +++ b/test/atl.cpp @@ -0,0 +1,623 @@ + + +// Boost.Range ATL Extension +// +// Copyright Shunsuke Sogame 2005-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 + +#include +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS +#define _ATL_NO_AUTOMATIC_NAMESPACE + +#define BOOST_LIB_NAME boost_test_exec_monitor +#include + +#define BOOST_RANGE_DETAIL_MICROSOFT_TEST +#include // can be placed first + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + + +#include // for ATL3 CSimpleArray/CSimpleValArray +#if !(_ATL_VER < 0x0700) + #include + #include + #include + #include +#endif + + +namespace brdm = boost::range_detail_microsoft; + + +#if !(_ATL_VER < 0x0700) + + +template< class ArrayT, class SampleRange > +bool test_init_auto_ptr_array(ArrayT& arr, SampleRange& sample) +{ + typedef typename boost::range_iterator::type iter_t; + + for (iter_t it = boost::begin(sample), last = boost::end(sample); it != last; ++it) { + arr.Add(*it); // moves ownership + } + + return boost::distance(arr) == boost::distance(sample); +} + + +template< class ListT, class SampleRange > +bool test_init_auto_ptr_list(ListT& lst, SampleRange& sample) +{ + typedef typename boost::range_iterator::type iter_t; + typedef typename boost::range_value::type val_t; + + for (iter_t it = boost::begin(sample), last = boost::end(sample); it != last; ++it) { + lst.AddTail(*it); // moves ownership + } + + return boost::distance(lst) == boost::distance(sample); +} + + +// Workaround: +// CRBTree provides no easy access function, but yes, it is the range! +// +template< class AtlMapT, class KeyT, class MappedT > +bool test_atl_map_has(AtlMapT& map, const KeyT& k, const MappedT m) +{ + typedef typename boost::range_iterator::type iter_t; + + for (iter_t it = boost::begin(map), last = boost::end(map); it != last; ++it) { + if (it->m_key == k && it->m_value == m) + return true; + } + + return false; +} + + +template< class AtlMapT, class MapT > +bool test_atl_map(AtlMapT& map, const MapT& sample) +{ + typedef typename boost::range_iterator::type iter_t; + typedef typename boost::range_const_iterator::type siter_t; + + bool result = true; + + result = result && (boost::distance(map) == boost::distance(sample)); + if (!result) + return false; + + { + for (iter_t it = boost::begin(map), last = boost::end(map); it != last; ++it) { + result = result && brdm::test_find_key_and_mapped(sample, std::make_pair(it->m_key, it->m_value)); + } + } + + { + for (siter_t it = boost::begin(sample), last = boost::end(sample); it != last; ++it) { + result = result && (test_atl_map_has)(map, it->first, it->second); + } + } + + return result; +} + + +template< class MapT, class SampleMap > +bool test_init_atl_multimap(MapT& map, const SampleMap& sample) +{ + typedef typename boost::range_const_iterator::type iter_t; + + for (iter_t it = boost::const_begin(sample), last = boost::const_end(sample); it != last; ++it) { + map.Insert(it->first, it->second); + } + + return boost::distance(map) == boost::distance(sample); +} + + +// arrays +// + +template< class Range > +void test_CAtlArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ATL::CAtlArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class ValT, class Range > +void test_CAutoPtrArray(Range& sample) +{ + typedef ValT val_t; + + typedef ATL::CAutoPtrArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter *> >::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter const*> >::value )); + + rng_t rng; + BOOST_CHECK( ::test_init_auto_ptr_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class I, class Range > +void test_CInterfaceArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ATL::CInterfaceArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter * >::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter const* >::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +// lists +// + +template< class Range > +void test_CAtlList(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ATL::CAtlList rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter< rng_t, brdm::list_iterator >::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_list(rng, sample) ); + BOOST_CHECK( brdm::test_bidirectional(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class ValT, class Range > +void test_CAutoPtrList(Range& sample) +{ + typedef ValT val_t; + + typedef ATL::CAutoPtrList rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter< rng_t, boost::indirect_iterator< brdm::list_iterator > > >::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, boost::indirect_iterator< brdm::list_iterator const> > >::value )); + + rng_t rng; + BOOST_CHECK( ::test_init_auto_ptr_list(rng, sample) ); + BOOST_CHECK( brdm::test_bidirectional(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class ValT, class Range > +void test_CHeapPtrList(const Range& sample) +{ + typedef ValT val_t; + + typedef ATL::CHeapPtrList rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter< rng_t, boost::indirect_iterator< brdm::list_iterator > > >::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, boost::indirect_iterator< brdm::list_iterator const> > >::value )); + + rng_t rng; + BOOST_CHECK( ::test_init_auto_ptr_list(rng, sample) ); + BOOST_CHECK( brdm::test_bidirectional(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class I, class Range > +void test_CInterfaceList(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ATL::CInterfaceList rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter< rng_t, brdm::list_iterator > >::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator const> >::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_list(rng, sample) ); + BOOST_CHECK( brdm::test_bidirectional(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +// strings +// + +template< class Range > +void test_CSimpleStringT(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef typename boost::mpl::if_< boost::is_same, + ATL::CAtlStringA, + ATL::CAtlStringW + >::type derived_t; + + typedef ATL::CSimpleStringT rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + derived_t drng; + rng_t& rng = drng; + BOOST_CHECK( brdm::test_init_string(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + // BOOST_CHECK( brdm::test_emptiness(rng) ); no default constructible +} + + +template< int n, class Range > +void test_CFixedStringT(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef typename boost::mpl::if_< boost::is_same, + ATL::CAtlStringA, + ATL::CAtlStringW + >::type base_t; + + typedef ATL::CFixedStringT rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_string(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CStringT(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef typename boost::mpl::if_< boost::is_same, + ATL::CAtlStringA, // == CStringT + ATL::CAtlStringW // == CStringT + >::type rng_t; + + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_string(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CStaticString(const Range& sample) +{ +#if !defined(BOOST_RANGE_ATL_NO_TEST_UNDOCUMENTED_RANGE) + { + typedef ATL::CStaticString rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng("hello static string"); + BOOST_CHECK( *(boost::begin(rng)+4) == 'o' ); + BOOST_CHECK( *(boost::end(rng)-3) == 'i' ); + } + + { + typedef ATL::CStaticString rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng(L"hello static string"); + BOOST_CHECK( *(boost::begin(rng)+4) == L'o' ); + BOOST_CHECK( *(boost::end(rng)-3) == L'i' ); + } +#endif + + (void)sample; // unused +} + + +#endif // !(_ATL_VER < 0x0700) + + +template< class Range > +void test_CComBSTR(const Range& sample) +{ + typedef ATL::CComBSTR rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng(OLESTR("hello CComBSTR range!")); + BOOST_CHECK( brdm::test_equals(rng, std::string("hello CComBSTR range!")) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); + + (void)sample; // unused +} + + +// simples +// + +template< class Range > +void test_CSimpleArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ATL::CSimpleArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CSimpleMap(const Range& sample) +{ +#if !defined(BOOST_RANGE_ATL_NO_TEST_UNDOCUMENTED_RANGE) + + typedef ATL::CSimpleMap rng_t; + + rng_t rng; + rng.Add(3, 3.0); + rng.Add(4, 2.0); + + BOOST_CHECK( boost::begin(rng)->get<0>() == 3.0 ); + BOOST_CHECK( (boost::end(rng)-1)->get<1>() == 2.0 ); + +#endif + + (void)sample; // unused +} + + +template< class Range > +void test_CSimpleValArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ATL::CSimpleArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +// maps +// + +template< class MapT > +void test_CAtlMap(const MapT& sample) +{ + typedef typename MapT::key_type k_t; + typedef typename MapT::mapped_type m_t; + + typedef ATL::CAtlMap rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); + BOOST_CHECK( ::test_atl_map(rng, sample) ); +} + + +template< class MapT > +void test_CRBTree(const MapT& sample) +{ + typedef typename MapT::key_type k_t; + typedef typename MapT::mapped_type m_t; + + typedef ATL::CRBMap derived_t; + typedef ATL::CRBTree rng_t; + + derived_t drng; + rng_t& rng = drng; + + boost::function_requires< boost::BidirectionalRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(drng, sample) ); + BOOST_CHECK( ::test_atl_map(rng, sample) ); +} + + +template< class MapT > +void test_CRBMap(const MapT& sample) +{ + typedef typename MapT::key_type k_t; + typedef typename MapT::mapped_type m_t; + + typedef ATL::CRBMap rng_t; + + rng_t rng; + boost::function_requires< boost::BidirectionalRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); + BOOST_CHECK( ::test_atl_map(rng, sample) ); +} + + +template< class MapT > +void test_CRBMultiMap(const MapT& sample) +{ + typedef typename MapT::key_type k_t; + typedef typename MapT::mapped_type m_t; + + typedef ATL::CRBMultiMap rng_t; + + rng_t rng; + boost::function_requires< boost::BidirectionalRangeConcept >(); + BOOST_CHECK( ::test_init_atl_multimap(rng, sample) ); + BOOST_CHECK( ::test_atl_map(rng, sample) ); +} + + +// main test +// + +void test_atl() +{ + + // ordinary ranges + // + { + std::string sample("rebecca judy and mary whiteberry chat monchy"); +#if !(_ATL_VER < 0x0700) + ::test_CAtlArray(sample); + ::test_CAtlList(sample); + ::test_CSimpleStringT(sample); + ::test_CFixedStringT<44>(sample); + ::test_CStringT(sample); + ::test_CStaticString(sample); +#endif + ::test_CComBSTR(sample); + ::test_CSimpleArray(sample); + ::test_CSimpleMap(sample); + ::test_CSimpleValArray(sample); + } + + + { + std::wstring sample(L"rebecca judy and mary whiteberry chat monchy"); +#if !(_ATL_VER < 0x0700) + ::test_CAtlArray(sample); + ::test_CAtlList(sample); + ::test_CSimpleStringT(sample); + ::test_CFixedStringT<44>(sample); + ::test_CStringT(sample); + ::test_CStaticString(sample); +#endif + ::test_CComBSTR(sample); + ::test_CSimpleArray(sample); + ::test_CSimpleMap(sample); + ::test_CSimpleValArray(sample); + } + + // pointer ranges + // +#if !(_ATL_VER < 0x0700) + { + typedef ATL::CAutoPtr ptr_t; + ptr_t + ptr0(new int(3)), ptr1(new int(4)), ptr2(new int(5)), ptr3(new int(4)), + ptr4(new int(1)), ptr5(new int(2)), ptr6(new int(4)), ptr7(new int(0)); + + ptr_t ptrs[8] = { + ptr0, ptr1, ptr2, ptr3, ptr4, ptr5, ptr6, ptr7 + }; + + boost::iterator_range< ptr_t * > workaround(ptrs, ptrs+8); + ::test_CAutoPtrArray(workaround); + } + + { + typedef ATL::CAutoPtr ptr_t; + ptr_t + ptr0(new int(3)), ptr1(new int(4)), ptr2(new int(5)), ptr3(new int(4)), + ptr4(new int(1)), ptr5(new int(2)), ptr6(new int(4)), ptr7(new int(0)); + + ptr_t ptrs[8] = { + ptr0, ptr1, ptr2, ptr3, ptr4, ptr5, ptr6, ptr7 + }; + + boost::iterator_range< ptr_t * > workaround(ptrs, ptrs+8); + ::test_CAutoPtrList(workaround); + } + + { + typedef ATL::CHeapPtr ptr_t; + ptr_t ptrs[5]; { + ptrs[0].AllocateBytes(sizeof(int)); + ptrs[1].AllocateBytes(sizeof(int)); + ptrs[2].AllocateBytes(sizeof(int)); + ptrs[3].AllocateBytes(sizeof(int)); + ptrs[4].AllocateBytes(sizeof(int)); + } + + boost::iterator_range< ptr_t * > workaround(ptrs, ptrs+5); + ::test_CHeapPtrList(workaround); + } + + + { + typedef ATL::CComQIPtr ptr_t; + ptr_t ptrs[8]; + + boost::iterator_range< ptr_t * > workaround(ptrs, ptrs+8); + ::test_CInterfaceArray(workaround); + ::test_CInterfaceList(workaround); + } +#endif + + // maps + // + { +#if !(_ATL_VER < 0x0700) + std::map sample; { + sample[0] = "hello"; + sample[1] = "range"; + sample[2] = "atl"; + sample[3] = "mfc"; + sample[4] = "collections"; + } + + ::test_CAtlMap(sample); + ::test_CRBTree(sample); + ::test_CRBMap(sample); + ::test_CRBMultiMap(sample); +#endif + } + + +} // test_atl + + +#include +using boost::unit_test::test_suite; + + +test_suite * +init_unit_test_suite(int argc, char* argv[]) +{ + test_suite *test = BOOST_TEST_SUITE("ATL Range Test Suite"); + test->add(BOOST_TEST_CASE(&test_atl)); + + (void)argc, (void)argv; // unused + return test; +} diff --git a/test/compat1.cpp b/test/compat1.cpp new file mode 100755 index 0000000..e69de29 diff --git a/test/extension_mechanism.cpp b/test/extension_mechanism.cpp index d355e4e..a206afb 100755 --- a/test/extension_mechanism.cpp +++ b/test/extension_mechanism.cpp @@ -25,7 +25,7 @@ // Generic range algorithm // template< class Rng > -typename boost::range_result_iterator::type foo_algo( Rng& r ) +typename boost::range_iterator::type foo_algo( Rng& r ) { // // This will only compile for Rng = UDT if the qualified calls @@ -44,7 +44,6 @@ namespace Foo typedef std::vector data_t; typedef data_t::iterator iterator; typedef data_t::const_iterator const_iterator; - typedef data_t::size_type size_type; data_t vec; @@ -57,32 +56,28 @@ namespace Foo // to be defined because X defines the proper set of // nested types. // - inline X::iterator boost_range_begin( X& x ) + inline X::iterator range_begin( X& x ) { return x.vec.begin(); } - inline X::const_iterator boost_range_begin( const X& x ) + inline X::const_iterator range_begin( const X& x ) { return x.vec.begin(); } - inline X::iterator boost_range_end( X& x ) + inline X::iterator range_end( X& x ) { return x.vec.end(); } - inline X::const_iterator boost_range_end( const X& x ) + inline X::const_iterator range_end( const X& x ) { return x.vec.end(); } - inline X::size_type boost_range_size( const X& x ) - { - return x.vec.size(); - } } void check_extension() diff --git a/test/iterator_pair.cpp b/test/iterator_pair.cpp index 74358ef..2546817 100755 --- a/test/iterator_pair.cpp +++ b/test/iterator_pair.cpp @@ -15,6 +15,7 @@ # pragma warn -8057 // unused argument argc/argv in Boost.Test #endif +#include #include #include #include @@ -46,33 +47,35 @@ void check_iterator_pair() BOOST_STATIC_ASSERT(( is_same< range_difference::type, detail::iterator_traits::difference_type >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, std::size_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, pair_t::first_type >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const_pair_t::first_type >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, pair_t::first_type >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const_pair_t::first_type >::value )); BOOST_STATIC_ASSERT(( is_same< range_value::type, detail::iterator_traits::value_type>::value )); BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const_pair_tt::first_type >::value )); - BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, const_pair_tt::first_type >::value )); + // + // This behavior is not supported with v2. + //BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, const_pair_tt::first_type >::value )); BOOST_STATIC_ASSERT(( is_same< range_difference::type, detail::iterator_traits::difference_type >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, std::size_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const_pair_tt::first_type >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const_pair_tt::first_type >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const_pair_tt::first_type >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const_pair_tt::first_type >::value )); BOOST_CHECK( begin( pair ) == pair.first ); BOOST_CHECK( end( pair ) == pair.second ); BOOST_CHECK( empty( pair ) == (pair.first == pair.second) ); - BOOST_CHECK( size( pair ) == std::size_t( std::distance( pair.first, pair.second ) ) ); + BOOST_CHECK( size( pair ) == std::distance( pair.first, pair.second ) ); BOOST_CHECK( begin( const_pair ) == const_pair.first ); BOOST_CHECK( end( const_pair ) == const_pair.second ); BOOST_CHECK( empty( const_pair ) == (const_pair.first == const_pair.second) ); - BOOST_CHECK( size( const_pair ) == std::size_t( std::distance( const_pair.first, const_pair.second ) ) ); + BOOST_CHECK( size( const_pair ) == std::distance( const_pair.first, const_pair.second ) ); BOOST_CHECK( begin( constness_pair ) == constness_pair.first ); BOOST_CHECK( end( constness_pair ) == constness_pair.second ); BOOST_CHECK( empty( constness_pair ) == (constness_pair.first == const_pair.second) ); - BOOST_CHECK( size( constness_pair ) == std::size_t( std::distance( constness_pair.first, constness_pair.second ) ) ); + BOOST_CHECK( size( constness_pair ) == std::distance( constness_pair.first, constness_pair.second ) ); } diff --git a/test/iterator_range.cpp b/test/iterator_range.cpp index 7e036ab..db531d3 100755 --- a/test/iterator_range.cpp +++ b/test/iterator_range.cpp @@ -8,6 +8,7 @@ // For more information, see http://www.boost.org/libs/range/ // +//#include #include @@ -16,9 +17,9 @@ # pragma warn -8057 // unused argument argc/argv in Boost.Test #endif - #include #include +#include #include #include #include @@ -65,6 +66,12 @@ void check_iterator_range() BOOST_CHECK_EQUAL( distance( r.begin(), r.end() ), distance( begin( r2 ), end( r2 ) ) ); cout << r << r2; + + +#ifndef BOOST_NO_STD_WSTRING + wcout << make_iterator_range( wstring( L"a wide string" ) ) + << make_iterator_range( L"another wide string" ); +#endif string res = copy_range( r ); BOOST_CHECK( equal( res.begin(), res.end(), r.begin() ) ); @@ -73,12 +80,12 @@ void check_iterator_range() BOOST_CHECK( rr.equal( r ) ); rr = make_iterator_range( str.begin(), str.begin() + 5 ); - BOOST_CHECK( rr == "hello" ); - BOOST_CHECK( rr != "hell" ); - BOOST_CHECK( rr < "hello dude" ); - BOOST_CHECK( "hello" == rr ); - BOOST_CHECK( "hell" != rr ); - BOOST_CHECK( ! ("hello dude" < rr ) ); + BOOST_CHECK( rr == as_literal("hello") ); + BOOST_CHECK( rr != as_literal("hell") ); + BOOST_CHECK( rr < as_literal("hello dude") ); + BOOST_CHECK( as_literal("hello") == rr ); + BOOST_CHECK( as_literal("hell") != rr ); + BOOST_CHECK( ! (as_literal("hello dude") < rr ) ); irange rrr = rr; BOOST_CHECK( rrr == rr ); BOOST_CHECK( !( rrr != rr ) ); @@ -88,9 +95,10 @@ void check_iterator_range() BOOST_CHECK_EQUAL( cr.front(), 'h' ); BOOST_CHECK_EQUAL( cr.back(), 'd' ); BOOST_CHECK_EQUAL( cr[1], 'e' ); + BOOST_CHECK_EQUAL( cr(1), 'e' ); rrr = make_iterator_range( str, 1, -1 ); - BOOST_CHECK( rrr == "ello worl" ); + BOOST_CHECK( rrr == as_literal("ello worl") ); rrr = make_iterator_range( rrr, -1, 1 ); BOOST_CHECK( rrr == str ); @@ -121,7 +129,7 @@ test_suite* init_unit_test_suite( int argc, char* argv[] ) template< class Container > int test_iter_range( Container& a_cont ) { - typedef BOOST_DEDUCED_TYPENAME range_result_iterator::type citer_type; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type citer_type; typedef iterator_range riter_type; riter_type a_riter( make_iterator_range( a_cont ) ); a_riter.front(); diff --git a/test/mfc.cpp b/test/mfc.cpp index c429993..7a13e8e 100755 --- a/test/mfc.cpp +++ b/test/mfc.cpp @@ -1,86 +1,743 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to 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) -// -// For more information, see http://www.boost.org/libs/range/ +// Boost.Range MFC Extension // +// Copyright Shunsuke Sogame 2005-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) -#define _MSL_USING_NAMESPACE 1 -#include +#include // must be here -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -# pragma warn -8091 // supress warning in Boost.Test -# pragma warn -8057 // unused argument argc/argv in Boost.Test -#endif - -#define BOOST_RANGE_ENABLE_MFC -#define BOOST_RANGE_ENABLE_MCF_CARRAY - -/* -#define WIN32 -#define _WINDOWS -#define _MBCS -#define _AFXDLL -#define _ATL_DLL -*/ - -///Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_MBCS" /D "_AFXDLL" /D "_ATL_DLL" /Gm /EHsc /RTC1 -// /MDd /Zc:wchar_t /Yu"stdafx.h" /Fp"Debug/Foo.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Wp64 /ZI /TP - -#include -#include -#include +// #include #include -#include +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS +#define _ATL_NO_AUTOMATIC_NAMESPACE + +#define BOOST_LIB_NAME boost_test_exec_monitor +#include + +#define BOOST_RANGE_DETAIL_MICROSOFT_TEST +#include // can be placed first -void check_mfc() +#include +#include +// #include +#include +#include +#include +#include +#include + + +#include +#include +#include + +#if !(_ATL_VER < 0x0700) + #include + #include + #include +#endif + + +namespace brdm = boost::range_detail_microsoft; + + +// helpers +// + +template< class MfcMapT, class MapT > +bool test_mfc_map(MfcMapT& map, const MapT& sample) { - CString s = "hello world"; - BOOST_CHECK( boost::begin( s ) + boost::size( s ) == boost::end( s ) ); - BOOST_CHECK( boost::size( s ) == boost::size( "hello world" ) ); - BOOST_CHECK( !boost::empty( s ) ); - const CString cs( s ); - BOOST_CHECK( boost::begin( cs ) + boost::size( cs ) == boost::end( cs ) ); - BOOST_CHECK( boost::size( cs ) == boost::size( "hello world" ) ); - BOOST_CHECK( !boost::empty( cs ) ); - - CArray a; - BOOST_CHECK( boost::empty( a ) ); - a.Add( 5 ); - a.Add( 10 ); - BOOST_CHECK( boost::begin( a ) + boost::size( a ) == boost::end( a ) ); - BOOST_CHECK( boost::size( a ) == 2 ); - BOOST_CHECK( !boost::empty( a ) ); - const CArray& ca = a; - BOOST_CHECK( boost::begin( ca ) + boost::size( ca ) == boost::end( ca ) ); - BOOST_CHECK( boost::size( ca ) == 2 ); - BOOST_CHECK( !boost::empty( ca ) ); - + typedef typename boost::range_iterator::type iter_t; + typedef typename boost::range_const_iterator::type siter_t; + + bool result = true; + + result = result && (boost::distance(map) == boost::distance(sample)); + if (!result) + return false; + + { + for (iter_t it = boost::begin(map), last = boost::end(map); it != last; ++it) { + result = result && brdm::test_find_key_and_mapped(sample, *it); + } + } + + { + for (siter_t it = boost::begin(sample), last = boost::end(sample); it != last; ++it) { + result = result && (map[it->first] == it->second); + } + } + + return result; } +template< class MfcMapT, class MapT > +bool test_mfc_cpair_map(MfcMapT& map, const MapT& sample) +{ + typedef typename boost::range_iterator::type iter_t; + typedef typename boost::range_const_iterator::type siter_t; + + bool result = true; + + result = result && (boost::distance(map) == boost::distance(sample)); + if (!result) + return false; + + { + for (iter_t it = boost::begin(map), last = boost::end(map); it != last; ++it) { + result = result && brdm::test_find_key_and_mapped(sample, std::make_pair(it->key, it->value)); + } + } + + { + for (siter_t it = boost::begin(sample), last = boost::end(sample); it != last; ++it) { + result = result && (map[it->first] == it->second); + } + } + + return result; +} + + +// arrays +// +template< class Range > +void test_CByteArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CByteArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CDWordArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CDWordArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CObArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CObArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter >::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter >::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CPtrArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CPtrArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter >::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter >::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CStringArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CStringArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CUIntArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CUIntArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CWordArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CWordArray rng_t; + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +// lists +// + +template< class Range > +void test_CObList(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CObList rng_t; + + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter< rng_t, brdm::list_iterator >::value )); +#if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); +#else + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); +#endif + + rng_t rng; + BOOST_CHECK( brdm::test_init_list(rng, sample) ); + BOOST_CHECK( brdm::test_bidirectional(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CPtrList(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CPtrList rng_t; + + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter< rng_t, brdm::list_iterator >::value )); +#if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); +#else + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); +#endif + + rng_t rng; + BOOST_CHECK( brdm::test_init_list(rng, sample) ); + BOOST_CHECK( brdm::test_bidirectional(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CStringList(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CStringList rng_t; + + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter< rng_t, brdm::list_iterator >::value )); +#if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); +#else + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); +#endif + + rng_t rng; + BOOST_CHECK( brdm::test_init_list(rng, sample) ); + BOOST_CHECK( brdm::test_bidirectional(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +// maps +// + +template< class MapT > +void test_CMapPtrToWord(const MapT& sample) +{ + typedef ::CMapPtrToWord rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); + BOOST_CHECK( ::test_mfc_map(rng, sample) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class MapT > +void test_CMapPtrToPtr(const MapT& sample) +{ + typedef ::CMapPtrToPtr rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); + BOOST_CHECK( ::test_mfc_map(rng, sample) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class MapT > +void test_CMapStringToOb(const MapT& sample) +{ + typedef ::CMapStringToOb rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); + BOOST_CHECK( ::test_mfc_map(rng, sample) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class MapT > +void test_CMapStringToPtr(const MapT& sample) +{ + typedef ::CMapStringToPtr rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); + BOOST_CHECK( ::test_mfc_map(rng, sample) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class MapT > +void test_CMapStringToString(const MapT& sample) +{ + typedef ::CMapStringToString rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); +#if !defined(BOOST_RANGE_MFC_NO_CPAIR) + BOOST_CHECK( ::test_mfc_cpair_map(rng, sample) ); +#endif + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class MapT > +void test_CMapWordToOb(const MapT& sample) +{ + typedef ::CMapWordToOb rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); + BOOST_CHECK( ::test_mfc_map(rng, sample) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class MapT > +void test_CMapWordToPtr(const MapT& sample) +{ + typedef ::CMapWordToPtr rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); + BOOST_CHECK( ::test_mfc_map(rng, sample) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +// templates +// + +template< class Range > +void test_CArray(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CArray rng_t; // An old MFC needs the second template argument. + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_array(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class Range > +void test_CList(const Range& sample) +{ + typedef typename boost::range_value::type val_t; + + typedef ::CList rng_t; + + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter< rng_t, brdm::list_iterator >::value )); +#if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF) + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); +#else + BOOST_STATIC_ASSERT(( brdm::test_const_iter < rng_t, brdm::list_iterator >::value )); +#endif + + rng_t rng; + BOOST_CHECK( brdm::test_init_list(rng, sample) ); + BOOST_CHECK( brdm::test_bidirectional(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +template< class MapT > +void test_CMap(const MapT& sample) +{ + typedef typename MapT::key_type k_t; + typedef typename MapT::mapped_type m_t; + + typedef ::CMap rng_t; + + rng_t rng; + boost::function_requires< boost::ForwardRangeConcept >(); + BOOST_CHECK( brdm::test_init_map(rng, sample) ); +#if !defined(BOOST_RANGE_MFC_NO_CPAIR) + BOOST_CHECK( ::test_mfc_cpair_map(rng, sample) ); +#endif + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +void test_CTypedPtrArray() +{ + typedef ::CTypedPtrArray< ::CPtrArray, int * > rng_t; + boost::function_requires< boost::RandomAccessRangeConcept >(); + + rng_t rng; + int o1, o2, o3, o4, o5; + int *data[] = { &o1, &o2, &o3, &o4, &o5 }; + BOOST_CHECK( brdm::test_init_array(rng, boost::make_iterator_range(data, data+5)) ); + + BOOST_CHECK( *(boost::begin(rng) + 2) == &o3 ); + BOOST_CHECK( *(boost::end(rng) - 1) == &o5 ); + + // BOOST_CHECK( brdm::test_random_access(rng) ); this range is not mutable + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +void test_CTypedPtrList() +{ + typedef ::CTypedPtrList< ::CObList, ::CObList * > rng_t; + boost::function_requires< boost::BidirectionalRangeConcept >(); + + rng_t rng; + + ::CObList o1, o2, o3, o4, o5; + ::CObList *data[] = { &o1, &o2, &o3, &o4, &o5 }; + BOOST_CHECK( brdm::test_init_list(rng, data) ); + + boost::range_iterator::type it = boost::begin(rng); + std::advance(it, 1); + BOOST_CHECK( *it == &o2 ); + std::advance(it, 2); + BOOST_CHECK( *it == &o4 ); + + // BOOST_CHECK( brdm::test_bidirectional(rng) ); this range is not mutable + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +void test_CTypedPtrMap() +{ + typedef ::CTypedPtrMap< ::CMapStringToPtr, ::CString, int *> rng_t; + boost::function_requires< boost::ForwardRangeConcept >(); + + rng_t rng; + ::CString o0(_T('a')), o1(_T('c')), o2(_T('f')), o3(_T('q')), o4(_T('g')); + int d0, d1, d2, d3, d4; + std::map< ::CString, int * > data; + data[o0] = &d0, data[o1] = &d1, data[o2] = &d2, data[o3] = &d3, data[o4] = &d4; + + BOOST_CHECK( brdm::test_init_map(rng, data) ); + BOOST_CHECK( ::test_mfc_map(rng, data) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); +} + + +// strings +// +#if defined(BOOST_RANGE_MFC_HAS_LEGACY_STRING) + + template< class Range > + void test_CString(const Range& sample) + { + typedef typename boost::range_value::type val_t; + + typedef ::CString rng_t; // An old MFC needs the second template argument. + BOOST_STATIC_ASSERT(( brdm::test_mutable_iter::value )); + BOOST_STATIC_ASSERT(( brdm::test_const_iter ::value )); + + rng_t rng; + BOOST_CHECK( brdm::test_init_string(rng, sample) ); + BOOST_CHECK( brdm::test_random_access(rng) ); + BOOST_CHECK( brdm::test_emptiness(rng) ); + } + +#endif + + +struct CPerson +{ + void hello_range() { }; +}; + + +void test_mfc() +{ +#if 0 + // overview + // + { + CTypedPtrArray *> myArray; + // ... + BOOST_FOREACH (CList *theList, myArray) + { + BOOST_FOREACH (CString& str, *theList) + { + boost::to_upper(str); + std::sort(boost::begin(str), boost::end(str)); + // ... + } + } + } +#endif + + // arrays + // + { + BYTE data[] = { 4,5,1,3,5,12,3,1,3,1,6,1,3,60,1,1,5,1,3,1,10 }; + + ::test_CByteArray(boost::make_iterator_range(data, data+22)); + } + + { + DWORD data[] = { 4,5,1,3,5,12,3,1,3,1,6,1,3,60,1,1,5,1,3,1,10 }; + + test_CDWordArray(boost::make_iterator_range(data, data+22)); + } + + { + ::CObArray o1, o2, o3, o4, o5; + ::CObject *data[] = { &o1, &o2, &o3, &o4, &o5 }; + + ::test_CObArray(boost::make_iterator_range(data, data+5)); + } + + { + ::CPtrArray o1, o2, o3, o4, o5; + void *data[] = { &o1, &o2, &o3, &o4, &o5 }; + + ::test_CPtrArray(boost::make_iterator_range(data, data+5)); + } + + { + ::CString data[] = { + ::CString(_T('0')), ::CString(_T('1')), ::CString(_T('2')), ::CString(_T('3')), + ::CString(_T('4')), ::CString(_T('5')), ::CString(_T('6')), ::CString(_T('7')) + }; + + ::test_CStringArray(boost::make_iterator_range(data, data+8)); + } + + { + ::CUIntArray rng; + UINT data[] = { 4,5,1,3,5,12,3,1,3,1,6,1,3,60,1,1,5,1,3,1,10 }; + + ::test_CUIntArray(boost::make_iterator_range(data, data+22)); + } + + { + ::CWordArray rng; + WORD data[] = { 4,5,1,3,5,12,3,1,3,1,6,1,3,60,1,1,5,1,3,1,10 }; + + ::test_CWordArray(boost::make_iterator_range(data, data+22)); + } + + + // lists + // + { + ::CObList rng; + ::CObList o1, o2, o3, o4, o5; + ::CObject *data[] = { &o1, &o2, &o3, &o4, &o5 }; + + ::test_CObList(boost::make_iterator_range(data, data+5)); + } + + { + ::CPtrList rng; + ::CPtrList o1, o2, o3, o4, o5; + void *data[] = { &o1, &o2, &o3, &o4, &o5 }; + + ::test_CPtrList(boost::make_iterator_range(data, data+5)); + } + + { + ::CString data[] = { + ::CString(_T('0')), ::CString(_T('1')), ::CString(_T('2')), ::CString(_T('3')), + ::CString(_T('4')), ::CString(_T('5')), ::CString(_T('6')), ::CString(_T('7')) + }; + + ::test_CStringList(boost::make_iterator_range(data, data+8)); + } + + + // maps + // + { + std::map data; + int o0, o1, o2, o3, o4; + data[&o0] = 15, data[&o1] = 14, data[&o2] = 3, data[&o3] = 6, data[&o4] = 1; + + ::test_CMapPtrToWord(data); + } + + { + std::map data; + int o0, o1, o2, o3, o4; + data[&o0] = &o3, data[&o1] = &o2, data[&o2] = &o1, data[&o3] = &o0, data[&o4] = &o4; + + ::test_CMapPtrToPtr(data); + } + + { + std::map< ::CString, CObject * > data; + CObArray o0, o1, o2, o3, o4; + data[ ::CString('0') ] = &o0, data[ ::CString('1') ] = &o1, data[ ::CString('2') ] = &o2, + data[ ::CString('3') ] = &o3, data[ ::CString('4') ] = &o4; + + ::test_CMapStringToOb(data); + } + + { + std::map< ::CString, void * > data; + CObArray o0, o1, o2, o3, o4; + data[ ::CString('0') ] = &o0, data[ ::CString('1') ] = &o1, data[ ::CString('2') ] = &o2, + data[ ::CString('3') ] = &o3, data[ ::CString('4') ] = &o4; + + ::test_CMapStringToPtr(data); + } + + { + std::map< ::CString, ::CString > data; + CString o0('a'), o1('b'), o2('c'), o3('d'), o4('e'); + data[ ::CString('0') ] = o0, data[ ::CString('1') ] = o1, data[ ::CString('2') ] = o2, + data[ ::CString('3') ] = o3, data[ ::CString('4') ] = o4; + + ::test_CMapStringToString(data); + } + + { + std::map< WORD, CObject * > data; + ::CDWordArray o0, o1, o2, o3, o4; + data[21] = &o3, data[52] = &o2, data[12] = &o1, data[76] = &o0, data[54] = &o4; + + ::test_CMapWordToOb(data); + } + + { + std::map< WORD, void * > data; + ::CDWordArray o0, o1, o2, o3, o4; + data[21] = &o3, data[52] = &o2, data[12] = &o1, data[76] = &o0, data[54] = &o4; + + ::test_CMapWordToPtr(data); + } + + // templates + // + { + std::string data("0987654321qwertyuiop"); + ::test_CArray(data); + ::test_CList(data); + } + + { + std::wstring data(L"asdfghjklzxcvbnm"); + ::test_CArray(data); + ::test_CList(data); + } + + { + std::map< int, std::string > data; + data[0] = "abcde", data[1] = "ajfie", data[2] = "lij", data[3] = "abc", data[4] = "ioiu"; + + ::test_CMap(data); + } + + + // typed + // + { + ::test_CTypedPtrArray(); + ::test_CTypedPtrList(); + ::test_CTypedPtrMap(); + } + + + // strings + // +#if defined(BOOST_RANGE_MFC_HAS_LEGACY_STRING) + { + std::string data("123456789 abcdefghijklmn"); + ::test_CString(data); + } +#endif + + +} // test_mfc + #include using boost::unit_test::test_suite; -test_suite* init_unit_test_suite( int argc, char* argv[] ) +test_suite * +init_unit_test_suite(int argc, char* argv[]) { - test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" ); - - test->add( BOOST_TEST_CASE( &check_mfc ) ); + test_suite *test = BOOST_TEST_SUITE("MFC Range Test Suite"); + test->add(BOOST_TEST_CASE(&test_mfc)); + (void)argc, (void)argv; // unused return test; } - - - - - - diff --git a/test/partial_workaround.cpp b/test/partial_workaround.cpp index ba014ae..8ac6f66 100755 --- a/test/partial_workaround.cpp +++ b/test/partial_workaround.cpp @@ -17,18 +17,15 @@ #endif #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +//#define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION 1 #include #include #include #include #include -#include -#include -#include -#include -#include +#include #include #include diff --git a/test/reversible_range.cpp b/test/reversible_range.cpp index 26d953a..9dfe8d0 100755 --- a/test/reversible_range.cpp +++ b/test/reversible_range.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -31,7 +32,7 @@ using namespace std; void check_iterator() { - typedef vector vec_t; + typedef vector vec_t; typedef vec_t::iterator iterator; typedef pair pair_t; typedef range_reverse_iterator::type rev_iterator; @@ -40,15 +41,8 @@ void check_iterator() vec_t vec; pair_t p = make_pair( vec.begin(), vec.end() ); rev_pair_t rp = make_pair( rbegin( p ), rend( p ) ); - char* str = "mutable"; - const char* cstr = "not mutable"; - char a[] = "mutable"; - const char ca[] = "not mutable"; - wchar_t* wstr = L"mutable"; - const wchar_t* cwstr= L"not mutable"; - wchar_t wa[] = L"mutable"; - const wchar_t cwa[]= L"not mutable"; - + int a[] = {1,2,3,4,5,6,7,8,9,10}; + const int ca[] = {1,2,3,4,5,6,7,8,9,10,11,12}; BOOST_CHECK( rbegin( vec ) == range_reverse_iterator::type( vec.end() ) ); BOOST_CHECK( rend( vec ) == range_reverse_iterator::type( vec.begin() ) ); BOOST_CHECK( std::distance( rbegin( vec ), rend( vec ) ) == std::distance( begin( vec ), end( vec ) ) ); @@ -58,33 +52,16 @@ void check_iterator() BOOST_CHECK( std::distance( rbegin( p ), rend( p ) ) == std::distance( begin( rp ), end( rp ) ) ); BOOST_CHECK( std::distance( begin( p ), end( p ) ) == std::distance( rbegin( rp ), rend( rp ) ) ); - BOOST_CHECK_EQUAL( &*begin( str ), &*( rend( str ) - 1 ) ); - BOOST_CHECK_EQUAL( &*( end( str ) - 1 ), &*rbegin( str ) ); - BOOST_CHECK_EQUAL( &*begin( cstr ), &*( rend( cstr ) - 1 ) ); - BOOST_CHECK_EQUAL( &*( end( cstr ) - 1 ), &*rbegin( cstr ) ); BOOST_CHECK_EQUAL( &*begin( a ), &*( rend( a ) - 1 ) ); BOOST_CHECK_EQUAL( &*( end( a ) - 1 ), &*rbegin( a ) ); BOOST_CHECK_EQUAL( &*begin( ca ), &*( rend( ca ) - 1 ) ); BOOST_CHECK_EQUAL( &*( end( ca ) - 1 ), &*rbegin( ca ) ); - - BOOST_CHECK_EQUAL( &*begin( wstr ), &*( rend( wstr ) - 1 ) ); - BOOST_CHECK_EQUAL( &*( end( wstr ) - 1 ), &*rbegin( wstr ) ); - BOOST_CHECK_EQUAL( &*begin( cwstr ), &*( rend( cwstr ) - 1 ) ); - BOOST_CHECK_EQUAL( &*( end( cwstr ) - 1 ), &*rbegin( cwstr ) ); - - BOOST_CHECK_EQUAL( &*begin( wa ), &*( rend( wa ) - 1 ) ); - BOOST_CHECK_EQUAL( &*( end( wa ) - 1 ), &*rbegin( wa ) ); - BOOST_CHECK_EQUAL( &*begin( cwa ), &*( rend( cwa ) - 1 ) ); - BOOST_CHECK_EQUAL( &*( end( cwa ) - 1 ), &*rbegin( cwa ) ); - } -#include using boost::unit_test::test_suite; - test_suite* init_unit_test_suite( int argc, char* argv[] ) { test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" ); diff --git a/test/std_container.cpp b/test/std_container.cpp index a61e8d1..e2ee692 100755 --- a/test/std_container.cpp +++ b/test/std_container.cpp @@ -35,27 +35,25 @@ void check_std_container() BOOST_STATIC_ASSERT(( is_same< range_value::type, vec_t::value_type >::value )); BOOST_STATIC_ASSERT(( is_same< range_iterator::type, vec_t::iterator >::value )); - BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, vec_t::const_iterator >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, vec_t::const_iterator >::value )); BOOST_STATIC_ASSERT(( is_same< range_difference::type, vec_t::difference_type >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, vec_t::size_type >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, vec_t::iterator >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, vec_t::const_iterator >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, vec_t::iterator >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, vec_t::const_iterator >::value )); BOOST_STATIC_ASSERT(( is_same< range_value::type, vec_t::value_type >::value )); - BOOST_STATIC_ASSERT(( is_same< range_iterator::type, vec_t::iterator >::value )); - BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, vec_t::const_iterator >::value )); BOOST_STATIC_ASSERT(( is_same< range_difference::type, vec_t::difference_type >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, vec_t::size_type >::value )); BOOST_CHECK( begin( vec ) == vec.begin() ); BOOST_CHECK( end( vec ) == vec.end() ); BOOST_CHECK( empty( vec ) == vec.empty() ); - BOOST_CHECK( size( vec ) == vec.size() ); + BOOST_CHECK( (std::size_t)size( vec ) == vec.size() ); BOOST_CHECK( begin( cvec ) == cvec.begin() ); BOOST_CHECK( end( cvec ) == cvec.end() ); BOOST_CHECK( empty( cvec ) == cvec.empty() ); - BOOST_CHECK( size( cvec ) == cvec.size() ); + BOOST_CHECK( (std::size_t)size( cvec ) == cvec.size() ); } diff --git a/test/string.cpp b/test/string.cpp index 36f103b..9a2e5a8 100755 --- a/test/string.cpp +++ b/test/string.cpp @@ -17,7 +17,10 @@ # pragma warn -8057 // unused argument argc/argv in Boost.Test #endif -#include +#include +#include +#include +#include #include #include #include @@ -26,36 +29,66 @@ #include #include +template< class T > +inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type +str_begin( T& r ) +{ + return boost::begin( boost::as_literal(r) ); +} + +template< class T > +inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type +str_end( T& r ) +{ + return boost::end( boost::as_literal(r) ); +} + +template< class T > +inline BOOST_DEDUCED_TYPENAME boost::range_size::type +str_size( const T& r ) +{ + return boost::size( boost::as_literal(r) ); +} + +template< class T > +inline bool +str_empty( T& r ) +{ + return boost::empty( boost::as_literal(r) ); +} + template< typename Container, typename T > BOOST_DEDUCED_TYPENAME boost::range_iterator::type find( Container& c, T value ) { - return std::find( boost::begin( c ), boost::end( c ), value ); + return std::find( str_begin(c), str_end(c), + value ); } template< typename Container, typename T > -BOOST_DEDUCED_TYPENAME boost::range_const_iterator::type +BOOST_DEDUCED_TYPENAME boost::range_iterator::type find( const Container& c, T value ) { - return std::find( boost::begin( c ), boost::end( c ), value ); + return std::find( str_begin(c), str_end(c), + value ); } template< typename Container, typename T > BOOST_DEDUCED_TYPENAME boost::range_iterator::type find_mutable( Container& c, T value ) -{ - boost::size( c ); - boost::end( c ); - return std::find( boost::begin( c ), boost::end( c ), value ); +{ + str_size( c ); + return std::find( str_begin(c), str_end(c), + value ); } template< typename Container, typename T > -BOOST_DEDUCED_TYPENAME boost::range_const_iterator::type +BOOST_DEDUCED_TYPENAME boost::range_iterator::type find_const( const Container& c, T value ) { - boost::size( c ); - boost::end( c ); - return std::find( boost::begin( c ), boost::end( c ), value ); + str_size( c ); + return std::find( str_begin(c), str_end(c), + value ); } @@ -72,62 +105,66 @@ void check_char() { typedef char* char_iterator_t; typedef char char_array_t[10]; - const char* char_s = "a string"; - char my_string[] = "another string"; - const unsigned my_string_length = 14; - char* char_s2 = "a string"; + const char* char_s = "a string"; + char my_string[] = "another string"; + const char my_const_string[] = "another string"; + const unsigned my_string_length = 14; + char* char_s2 = "a string"; BOOST_STATIC_ASSERT(( is_same< range_value::type, detail::iterator_traits::value_type>::value )); BOOST_STATIC_ASSERT(( is_same< range_iterator::type, char_iterator_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, const char* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_difference::type, ::std::ptrdiff_t >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, std::size_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, char_iterator_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const char* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, char_iterator_t >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const char* >::value )); BOOST_STATIC_ASSERT(( is_same< range_value::type, char>::value )); BOOST_STATIC_ASSERT(( is_same< range_iterator::type, char* >::value )); - BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, const char* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const char* >::value )); BOOST_STATIC_ASSERT(( is_same< range_difference::type, ::std::ptrdiff_t >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, std::size_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, char* >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const char* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, char* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const char* >::value )); - BOOST_CHECK_EQUAL( begin( char_s ), char_s ); - std::size_t sz = size( char_s ); - const char* end1 = begin( char_s ) + sz; - BOOST_CHECK_EQUAL( end( char_s ), end1 ); - BOOST_CHECK_EQUAL( empty( char_s ), (char_s == 0 || char_s[0] == char()) ); + BOOST_CHECK_EQUAL( str_begin( char_s ), char_s ); + std::size_t sz = str_size(char_s); + const char* str_end1 = str_begin( char_s ) + sz; + 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( sz, std::char_traits::length( char_s ) ); /* - BOOST_CHECK_EQUAL( begin( char_s2 ), char_s2 ); + BOOST_CHECK_EQUAL( str_begin( char_s2 ), char_s2 ); std::size_t sz2 = size( char_s2 ); - const char* end12 = begin( char_s2 ) + sz; - BOOST_CHECK_EQUAL( end( char_s2 ), end12 ); + 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::length( char_s2 ) ); */ - BOOST_CHECK_EQUAL( begin( my_string ), my_string ); - range_iterator::type end2 = begin( my_string ) + size( my_string ); - range_iterator::type end3 = end( my_string ); - BOOST_CHECK_EQUAL( end3, end2 ); - BOOST_CHECK_EQUAL( empty( my_string ), (my_string == 0 || my_string[0] == char()) ); - BOOST_CHECK_EQUAL( size( my_string ), my_string_length ); - BOOST_CHECK_EQUAL( size( my_string ), std::char_traits::length( my_string ) ); + BOOST_CHECK_EQUAL( str_begin( my_string ), my_string ); + range_iterator::type str_end2 = str_begin( my_string ) + str_size(my_string); + range_iterator::type str_end3 = str_end(my_string); + BOOST_CHECK_EQUAL( str_end3, str_end2 ); + BOOST_CHECK_EQUAL( str_empty( my_string ), (my_string == 0 || my_string[0] == char()) ); + BOOST_CHECK_EQUAL( str_size( my_string ), my_string_length ); + BOOST_CHECK_EQUAL( str_size( my_string ), std::char_traits::length( my_string ) ); char to_search = 'n'; - BOOST_CHECK( find_mutable( char_s, to_search ) != end( char_s ) ); - BOOST_CHECK( find_const( char_s, to_search ) != end( char_s ) ); + BOOST_CHECK( find_mutable( char_s, to_search ) != str_end( char_s ) ); + BOOST_CHECK( find_const( char_s, to_search ) != str_end(char_s) ); - BOOST_CHECK( find_mutable( my_string, to_search ) != end( my_string ) ); - BOOST_CHECK( find_const( my_string, to_search ) != end( my_string ) ); + BOOST_CHECK( find_mutable( my_string, to_search ) != str_end(my_string) ); + BOOST_CHECK( find_const( my_string, to_search ) != str_end(my_string) ); - BOOST_CHECK( find_mutable( char_s2, to_search ) != end( char_s2 ) ); - BOOST_CHECK( find_const( char_s2, to_search ) != end( char_s2 ) ); + BOOST_CHECK( find_mutable( char_s2, to_search ) != str_end(char_s) ); + BOOST_CHECK( find_const( char_s2, to_search ) != str_end(char_s2) ); + + 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) ); } @@ -148,31 +185,31 @@ void check_string() BOOST_STATIC_ASSERT(( is_same< range_value::type, detail::iterator_traits::value_type>::value )); BOOST_STATIC_ASSERT(( is_same< range_iterator::type, wchar_iterator_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_const_iterator::type, const wchar_t* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const wchar_t* >::value )); BOOST_STATIC_ASSERT(( is_same< range_difference::type, detail::iterator_traits::difference_type >::value )); BOOST_STATIC_ASSERT(( is_same< range_size::type, std::size_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, wchar_iterator_t >::value )); - BOOST_STATIC_ASSERT(( is_same< range_result_iterator::type, const wchar_t* >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, wchar_iterator_t >::value )); + BOOST_STATIC_ASSERT(( is_same< range_iterator::type, const wchar_t* >::value )); - std::size_t sz = size( char_ws ); - BOOST_CHECK_EQUAL( begin( char_ws ), char_ws ); - BOOST_CHECK_EQUAL( end( char_ws ), (begin( char_ws ) + sz) ); - BOOST_CHECK_EQUAL( empty( char_ws ), (char_ws == 0 || char_ws[0] == wchar_t()) ); + std::size_t sz = str_size( char_ws ); + BOOST_CHECK_EQUAL( str_begin( char_ws ), char_ws ); + 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( sz, std::char_traits::length( char_ws ) ); /* std::size_t sz2 = size( char_ws2 ); - BOOST_CHECK_EQUAL( begin( char_ws2 ), char_ws2 ); - BOOST_CHECK_EQUAL( end( char_ws2 ), (begin( char_ws2 ) + sz2) ); + 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::length( char_ws2 ) ); */ wchar_t to_search = L'n'; - BOOST_CHECK( find( char_ws, to_search ) != end( char_ws ) ); + BOOST_CHECK( find( char_ws, to_search ) != str_end(char_ws) ); #if BOOST_WORKAROUND(_MSC_VER, BOOST_TESTED_AT(1300)) - BOOST_CHECK( find( my_wstring, to_search ) != end( my_wstring ) ); + BOOST_CHECK( find( my_wstring, to_search ) != str_end(my_wstring) ); #endif #endif @@ -181,7 +218,6 @@ void check_string() } - #include using boost::unit_test::test_suite; diff --git a/test/sub_range.cpp b/test/sub_range.cpp index f590b53..7d5bf05 100755 --- a/test/sub_range.cpp +++ b/test/sub_range.cpp @@ -17,6 +17,7 @@ #endif #include +#include #include #include #include @@ -91,16 +92,31 @@ void check_sub_range() r.size(); s.size(); + // + // As of range v2 not legal anymore. + // + //irange singular_irange; + //BOOST_CHECK( singular_irange.empty() ); + //BOOST_CHECK( singular_irange.size() == 0 ); + // + //srange singular_srange; + //BOOST_CHECK( singular_srange.empty() ); + //BOOST_CHECK( singular_srange.size() == 0 ); + // + //BOOST_CHECK( empty( singular_irange ) ); + //BOOST_CHECK( empty( singular_srange ) ); + // + srange rr = make_iterator_range( str ); BOOST_CHECK( rr.equal( r ) ); rr = make_iterator_range( str.begin(), str.begin() + 5 ); - BOOST_CHECK( rr == "hello" ); - BOOST_CHECK( rr != "hell" ); - BOOST_CHECK( rr < "hello dude" ); - BOOST_CHECK( "hello" == rr ); - BOOST_CHECK( "hell" != rr ); - BOOST_CHECK( ! ("hello dude" < rr ) ); + BOOST_CHECK( rr == as_literal("hello") ); + BOOST_CHECK( rr != as_literal("hell") ); + BOOST_CHECK( rr < as_literal("hello dude") ); + BOOST_CHECK( as_literal("hello") == rr ); + BOOST_CHECK( as_literal("hell") != rr ); + BOOST_CHECK( ! (as_literal("hello dude") < rr ) ); irange rrr = rr; BOOST_CHECK( rrr == rr ); @@ -111,15 +127,16 @@ void check_sub_range() BOOST_CHECK_EQUAL( cr.front(), 'h' ); BOOST_CHECK_EQUAL( cr.back(), 'd' ); BOOST_CHECK_EQUAL( cr[1], 'e' ); + BOOST_CHECK_EQUAL( cr(1), 'e' ); rrr = make_iterator_range( str, 1, -1 ); - BOOST_CHECK( rrr == "ello worl" ); + BOOST_CHECK( rrr == as_literal("ello worl") ); rrr = make_iterator_range( rrr, -1, 1 ); BOOST_CHECK( rrr == str ); rrr.front() = 'H'; rrr.back() = 'D'; rrr[1] = 'E'; - BOOST_CHECK( rrr == "HEllo worlD" ); + BOOST_CHECK( rrr == as_literal("HEllo worlD") ); } #include From 5afec2b74f2e34d60d57e943c015569a5c955fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Mon, 3 Dec 2007 08:51:22 +0000 Subject: [PATCH 14/73] merge from truck (boost::size()->boost::distance()) [SVN r41635] --- include/boost/range/iterator_range.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/range/iterator_range.hpp b/include/boost/range/iterator_range.hpp index 4304ecc..31b8ea8 100755 --- a/include/boost/range/iterator_range.hpp +++ b/include/boost/range/iterator_range.hpp @@ -77,8 +77,8 @@ namespace boost { typedef BOOST_DEDUCED_TYPENAME boost::range_difference::type sz_type; - sz_type l_size = boost::size( l ), - r_size = boost::size( r ); + sz_type l_size = boost::distance( l ), + r_size = boost::distance( r ); if( l_size != r_size ) return false; From dbfa1df08817cf28b68264d63b1be4ddaf848d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Mon, 3 Dec 2007 09:01:03 +0000 Subject: [PATCH 15/73] missing include (Ticket #1463) [SVN r41637] --- include/boost/range/sub_range.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/range/sub_range.hpp b/include/boost/range/sub_range.hpp index 802454b..35dfb27 100755 --- a/include/boost/range/sub_range.hpp +++ b/include/boost/range/sub_range.hpp @@ -11,6 +11,8 @@ #ifndef BOOST_RANGE_SUB_RANGE_HPP #define BOOST_RANGE_SUB_RANGE_HPP +#include + #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) #pragma warning( disable : 4996 ) #endif From 8291ce67fcf1c9c98f354f314e728383f5140f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Wed, 5 Dec 2007 17:30:23 +0000 Subject: [PATCH 16/73] minor changes from trunk [SVN r41751] --- include/boost/range/detail/sizer.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/boost/range/detail/sizer.hpp b/include/boost/range/detail/sizer.hpp index 5d75437..b4c1c91 100755 --- a/include/boost/range/detail/sizer.hpp +++ b/include/boost/range/detail/sizer.hpp @@ -25,12 +25,10 @@ namespace boost ////////////////////////////////////////////////////////////////////// template< typename T, std::size_t sz > - char& - sizer( const T BOOST_RANGE_ARRAY_REF()[sz] )[sz]; + char (& sizer( const T BOOST_RANGE_ARRAY_REF()[sz] ) )[sz]; template< typename T, std::size_t sz > - char& - sizer( T BOOST_RANGE_ARRAY_REF()[sz] )[sz]; + char (& sizer( T BOOST_RANGE_ARRAY_REF()[sz] ) )[sz]; } // namespace 'boost' From fd00cc129fc989c8f4e2c5f194ee4d189f17912b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Sat, 12 Jan 2008 12:38:46 +0000 Subject: [PATCH 17/73] doc fixes [SVN r42692] --- doc/boost_range.html | 2 +- doc/history_ack.html | 8 ++++---- doc/intro.html | 3 +-- doc/portability.html | 2 +- doc/utility_class.html | 9 +++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/boost_range.html b/doc/boost_range.html index ace1901..ed84e1a 100644 --- a/doc/boost_range.html +++ b/doc/boost_range.html @@ -493,7 +493,7 @@ class=identifier>T&

    as_literal() can be used internally in string - algorithm librararies to such that arrays of characters are + algorithm librararies such that arrays of characters are handled correctly.

    diff --git a/doc/history_ack.html b/doc/history_ack.html index 40ee5dc..81f27b7 100755 --- a/doc/history_ack.html +++ b/doc/history_ack.html @@ -18,10 +18,10 @@

    History and Acknowledgement

    - The library have been under way for a long time. Dietmar Kühl originally - intended to submit an array_traits class template which - had most of the functionality present now, but only for arrays and standard - containers. + The library was under way for a long time. Dietmar Kühl originally intended + to submit an array_traits class template which had most of + the functionality present now, but only for arrays and standard containers. + I believe this was back in 2001 or 2002.

    diff --git a/doc/intro.html b/doc/intro.html index 8478d3e..4ed653b 100755 --- a/doc/intro.html +++ b/doc/intro.html @@ -63,8 +63,7 @@ free-standing functions so syntactic and/or semantic differences can be removed.

    -

    - Below are given a small example (the complete example can be found Below is given a small example (the complete example can be found here):

     
    diff --git a/doc/portability.html b/doc/portability.html
    index 20b1355..506d5b2 100755
    --- a/doc/portability.html
    +++ b/doc/portability.html
    @@ -35,7 +35,7 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here
         

    Notice also that some compilers cannot do function template ordering properly. - In that case one must rely of range_iterator and a single function definition instead of overloaded versions for const and non-const arguments. diff --git a/doc/utility_class.html b/doc/utility_class.html index f7b5535..c4afe54 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -33,11 +33,12 @@ - The iterator_range class is templated on an - Forward + The iterator_range class is templated on a Forward Traversal Iterator and should be used whenever fairly general code is needed. - The sub_range class is templated on an Forward - Range and it is less general, but a bit easier to use since its template + The sub_range class is templated on a Forward Range and it is less general, + but a bit easier to use since its template argument is easier to specify. The biggest difference is, however, that a sub_range can propagate constness because it knows what a corresponding const_iterator is.

    From 4d381e856432e034353609845de319a7bdb8c487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Sun, 13 Jan 2008 11:38:13 +0000 Subject: [PATCH 18/73] fixed #if -> #ifdef [SVN r42716] --- include/boost/range/as_literal.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/range/as_literal.hpp b/include/boost/range/as_literal.hpp index 72f0eb5..b0d7593 100755 --- a/include/boost/range/as_literal.hpp +++ b/include/boost/range/as_literal.hpp @@ -15,7 +15,7 @@ # pragma once #endif -#if BOOST_NO_FUNCTION_TEMPLATE_ORDERING +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING #include #else @@ -116,14 +116,14 @@ namespace boost template< class Char, std::size_t sz > - inline iterator_range as_literal( const Char (&arr)[sz] ) + inline iterator_range as_literal( const Char (&arr)[sz] ) { #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590 return boost::make_iterator_range( arr, arr + sz - 1 ); #else return boost::make_iterator_range( arr, arr + sz - 1 ); #endif - } + } } #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING From 062e820882ffbde1959c7d74857dd5ce29db2bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Thu, 7 Feb 2008 08:38:07 +0000 Subject: [PATCH 19/73] cleanup to pass inspection tool [SVN r43139] --- doc/Jamfile.v2 | 10 ++++++++++ doc/boost_range.html | 8 +++++++- doc/example.cpp | 10 ++++++++++ doc/examples.html | 9 ++++++++- doc/faq.html | 11 +++++++++-- doc/headers.html | 9 ++++++++- doc/history_ack.html | 9 ++++++++- doc/intro.html | 9 ++++++++- doc/portability.html | 11 +++++++++-- doc/range.html | 36 +++++++++--------------------------- doc/style.css | 11 +++++++++++ doc/style.html | 8 +++++++- doc/utility_class.html | 15 +++++++++++---- test/TODO | 1 - test/compat1.cpp | 0 15 files changed, 115 insertions(+), 42 deletions(-) delete mode 100644 test/TODO delete mode 100755 test/compat1.cpp diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 0fafdd7..bfe0908 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -1,3 +1,13 @@ +#// Boost.Range library +#// +#// Copyright Thorsten Ottosen 2003-2008. Use, modification and +#// distribution is subject to 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) +#// +#// For more information, see http://www.boost.org/libs/range/ +#// + use-project boost : $(BOOST_ROOT) ; diff --git a/doc/boost_range.html b/doc/boost_range.html index ed84e1a..465bd18 100644 --- a/doc/boost_range.html +++ b/doc/boost_range.html @@ -745,7 +745,13 @@ class=identifier>T
    &

    - (C) Copyright Thorsten Ottosen 2003-2007 + © Copyright Thorsten Ottosen 2008. +

    + +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)



    diff --git a/doc/example.cpp b/doc/example.cpp index afe448f..d3dec7c 100644 --- a/doc/example.cpp +++ b/doc/example.cpp @@ -1,3 +1,13 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2008. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + #include #include // for std::iterator_traits, std::distance() diff --git a/doc/examples.html b/doc/examples.html index 0ea235d..0d24509 100755 --- a/doc/examples.html +++ b/doc/examples.html @@ -41,9 +41,16 @@
  • array.cpp +

    - (C) Copyright Thorsten Ottosen 2003-2004 + © Copyright Thorsten Ottosen 2008. +

    + +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)


    diff --git a/doc/faq.html b/doc/faq.html index 34304ef..244df80 100755 --- a/doc/faq.html +++ b/doc/faq.html @@ -114,9 +114,16 @@ Cool indeed! -
    +

    - (C) Copyright Thorsten Ottosen 2003-2004 + © Copyright Thorsten Ottosen 2008. +

    + +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy + at www.boost.org/LICENSE_1_0.txt)


    diff --git a/doc/headers.html b/doc/headers.html index 69987ce..7628591 100755 --- a/doc/headers.html +++ b/doc/headers.html @@ -173,7 +173,14 @@

    - (C) Copyright Thorsten Ottosen 2003-2007 + © Copyright Thorsten Ottosen 2008. +

    + +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy + at www.boost.org/LICENSE_1_0.txt)


    diff --git a/doc/history_ack.html b/doc/history_ack.html index 81f27b7..c8527ba 100755 --- a/doc/history_ack.html +++ b/doc/history_ack.html @@ -61,7 +61,14 @@ C++ standard:

    - (C) Copyright Thorsten Ottosen 2003-2006 + © Copyright Thorsten Ottosen 2008. +

    + +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy + at www.boost.org/LICENSE_1_0.txt)


    diff --git a/doc/intro.html b/doc/intro.html index 4ed653b..9f41c72 100755 --- a/doc/intro.html +++ b/doc/intro.html @@ -135,7 +135,14 @@ Notice that we have to

    - (C) Copyright Thorsten Ottosen 2003-2007 + © Copyright Thorsten Ottosen 2008. +

    + +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy + at www.boost.org/LICENSE_1_0.txt)


    diff --git a/doc/portability.html b/doc/portability.html index 506d5b2..9e63978 100755 --- a/doc/portability.html +++ b/doc/portability.html @@ -73,11 +73,18 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here

    -
    +

    - (C) Copyright Thorsten Ottosen 2003-2004 + © Copyright Thorsten Ottosen 2008.

    +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy + at www.boost.org/LICENSE_1_0.txt) +

    > +


    diff --git a/doc/range.html b/doc/range.html index dfe9345..b140888 100755 --- a/doc/range.html +++ b/doc/range.html @@ -352,34 +352,16 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator

    Boost Concept Check library


    +

    + © Copyright Thorsten Ottosen 2008. +

    - - - - - - - - -
    Copyright © 2000Jeremy Siek -
    Copyright © 2004-2007Thorsten Ottosen. -
    - +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy + at www.boost.org/LICENSE_1_0.txt) +




    diff --git a/doc/style.css b/doc/style.css index 1890b52..ce44c30 100755 --- a/doc/style.css +++ b/doc/style.css @@ -1,3 +1,14 @@ +/* +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2008. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// +*/ pre{ BORDER-RIGHT: gray 1pt solid; PADDING-RIGHT: 2pt; diff --git a/doc/style.html b/doc/style.html index 9a5617e..cd82c94 100755 --- a/doc/style.html +++ b/doc/style.html @@ -104,9 +104,15 @@

    - (C) Copyright Thorsten Ottosen 2003-2004 + © Copyright Thorsten Ottosen 2008.

    +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy + at www.boost.org/LICENSE_1_0.txt) +




    diff --git a/doc/utility_class.html b/doc/utility_class.html index c4afe54..ea51503 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -350,10 +350,17 @@ store the result
  • -
    -

    - (C) Copyright Thorsten Ottosen 2003-2007 -

    +
    +

    + © Copyright Thorsten Ottosen 2008. +

    + +

    + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy + at www.boost.org/LICENSE_1_0.txt) +



    diff --git a/test/TODO b/test/TODO deleted file mode 100644 index 8b13789..0000000 --- a/test/TODO +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/compat1.cpp b/test/compat1.cpp deleted file mode 100755 index e69de29..0000000 From d1c2c5ce3fe69f52bfe6065fedfe759c6a821445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 24 Jun 2008 15:37:59 +0000 Subject: [PATCH 20/73] bug-fixes from trunk [SVN r46647] --- include/boost/range/as_literal.hpp | 24 ++++------ include/boost/range/begin.hpp | 8 ++-- include/boost/range/detail/as_literal.hpp | 4 +- .../range/detail/implementation_help.hpp | 4 ++ include/boost/range/end.hpp | 8 ++-- include/boost/range/iterator_range.hpp | 46 +++++++++++++------ include/boost/range/sub_range.hpp | 26 ++++++++--- 7 files changed, 74 insertions(+), 46 deletions(-) mode change 100755 => 100644 include/boost/range/as_literal.hpp mode change 100755 => 100644 include/boost/range/begin.hpp mode change 100755 => 100644 include/boost/range/detail/as_literal.hpp mode change 100755 => 100644 include/boost/range/detail/implementation_help.hpp mode change 100755 => 100644 include/boost/range/end.hpp mode change 100755 => 100644 include/boost/range/iterator_range.hpp mode change 100755 => 100644 include/boost/range/sub_range.hpp diff --git a/include/boost/range/as_literal.hpp b/include/boost/range/as_literal.hpp old mode 100755 new mode 100644 index b0d7593..38cc9cf --- a/include/boost/range/as_literal.hpp +++ b/include/boost/range/as_literal.hpp @@ -8,8 +8,8 @@ // For more information, see http://www.boost.org/libs/range/ // -#ifndef BOOST_RANGE_DETAIL_AS_LITERAL_HPP -#define BOOST_RANGE_DETAIL_AS_LITERAL_HPP +#ifndef BOOST_RANGE_AS_LITERAL_HPP +#define BOOST_RANGE_AS_LITERAL_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once @@ -25,7 +25,9 @@ #include #include +#ifndef BOOST_NO_CWCHAR #include +#endif namespace boost { @@ -36,10 +38,12 @@ namespace boost return strlen( s ); } +#ifndef BOOST_NO_INTRINSIC_WCHAR_T inline std::size_t length( const wchar_t* s ) { return wcslen( s ); } +#endif // // Remark: the compiler cannot choose between T* and T[sz] @@ -57,7 +61,7 @@ namespace boost return true; } - +#ifndef BOOST_NO_INTRINSIC_WCHAR_T inline bool is_char_ptr( wchar_t* ) { return true; @@ -67,6 +71,7 @@ namespace boost { return true; } +#endif template< class T > inline long is_char_ptr( T /* r */ ) @@ -107,22 +112,13 @@ namespace boost template< class Char, std::size_t sz > inline iterator_range as_literal( Char (&arr)[sz] ) { -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590 - return boost::make_iterator_range( arr, arr + sz - 1 ); -#else - return boost::make_iterator_range( arr, arr + sz - 1 ); -#endif + return range_detail::make_range( arr, range_detail::is_char_ptr(arr) ); } - template< class Char, std::size_t sz > inline iterator_range as_literal( const Char (&arr)[sz] ) { -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590 - return boost::make_iterator_range( arr, arr + sz - 1 ); -#else - return boost::make_iterator_range( arr, arr + sz - 1 ); -#endif + return range_detail::make_range( arr, range_detail::is_char_ptr(arr) ); } } diff --git a/include/boost/range/begin.hpp b/include/boost/range/begin.hpp old mode 100755 new mode 100644 index 9abf313..a4a5e10 --- a/include/boost/range/begin.hpp +++ b/include/boost/range/begin.hpp @@ -73,15 +73,15 @@ namespace range_detail // May this be discarded? Or is it needed for bad compilers? // template< typename T, std::size_t sz > - inline const T* range_begin( const T (&array)[sz] ) + inline const T* range_begin( const T (&a)[sz] ) { - return array; + return a; } template< typename T, std::size_t sz > - inline T* range_begin( T (&array)[sz] ) + inline T* range_begin( T (&a)[sz] ) { - return array; + return a; } diff --git a/include/boost/range/detail/as_literal.hpp b/include/boost/range/detail/as_literal.hpp old mode 100755 new mode 100644 index b4fd925..0bd9a15 --- a/include/boost/range/detail/as_literal.hpp +++ b/include/boost/range/detail/as_literal.hpp @@ -8,8 +8,8 @@ // For more information, see http://www.boost.org/libs/range/ // -#ifndef BOOST_RANGE_AS_LITERAL_HPP -#define BOOST_RANGE_AS_LITERAL_HPP +#ifndef BOOST_RANGE_DETAIL_AS_LITERAL_HPP +#define BOOST_RANGE_DETAIL_AS_LITERAL_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once diff --git a/include/boost/range/detail/implementation_help.hpp b/include/boost/range/detail/implementation_help.hpp old mode 100755 new mode 100644 index da086f0..ca12fa4 --- a/include/boost/range/detail/implementation_help.hpp +++ b/include/boost/range/detail/implementation_help.hpp @@ -25,6 +25,8 @@ namespace boost { namespace range_detail { + template + inline void boost_range_silence_warning( const T& ) { } ///////////////////////////////////////////////////////////////////// // end() help @@ -82,12 +84,14 @@ namespace boost template< class T, std::size_t sz > inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] ) { + boost_range_silence_warning( boost_range_array ); return sz; } template< class T, std::size_t sz > inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] ) { + boost_range_silence_warning( boost_range_array ); return sz; } diff --git a/include/boost/range/end.hpp b/include/boost/range/end.hpp old mode 100755 new mode 100644 index b777a55..3063c02 --- a/include/boost/range/end.hpp +++ b/include/boost/range/end.hpp @@ -71,15 +71,15 @@ namespace range_detail ////////////////////////////////////////////////////////////////////// template< typename T, std::size_t sz > - inline const T* range_end( const T (&array)[sz] ) + inline const T* range_end( const T (&a)[sz] ) { - return range_detail::array_end( array ); + return range_detail::array_end( a ); } template< typename T, std::size_t sz > - inline T* range_end( T (&array)[sz] ) + inline T* range_end( T (&a)[sz] ) { - return range_detail::array_end( array ); + return range_detail::array_end( a ); } #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ diff --git a/include/boost/range/iterator_range.hpp b/include/boost/range/iterator_range.hpp old mode 100755 new mode 100644 index 31b8ea8..d118224 --- a/include/boost/range/iterator_range.hpp +++ b/include/boost/range/iterator_range.hpp @@ -11,8 +11,15 @@ #ifndef BOOST_RANGE_ITERATOR_RANGE_HPP #define BOOST_RANGE_ITERATOR_RANGE_HPP -// From boost/dynamic_bitset.hpp; thanks to Matthias Troyer for Cray X1 patch. #include // Define __STL_CONFIG_H, if appropriate. +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500)) + #pragma warning( push ) + #pragma warning( disable : 4996 ) +#endif + +// From boost/dynamic_bitset.hpp; thanks to Matthias Troyer for Cray X1 patch. #ifndef BOOST_OLD_IOSTREAMS # if defined(__STL_CONFIG_H) && \ !defined (__STL_USE_NEW_IOSTREAMS) && !defined(__crayx1) \ @@ -21,12 +28,13 @@ # endif #endif // #ifndef BOOST_OLD_IOSTREAMS -#include +#include +#include +#include #include #include #include -#include -#include +#include #include #include #ifndef _STLP_NO_IOSTREAMS @@ -38,10 +46,6 @@ #endif // _STLP_NO_IOSTREAMS #include -#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) - #pragma warning( disable : 4996 ) -#endif - /*! \file Defines the \c iterator_class and related functions. \c iterator_range is a simple wrapper of iterator pair idiom. It provides @@ -163,6 +167,12 @@ namespace boost //! iterator type typedef IteratorT iterator; + private: // for return value of operator()() + typedef BOOST_DEDUCED_TYPENAME + boost::mpl::if_< boost::is_abstract, + reference, value_type >::type abstract_value_type; + + public: iterator_range() : m_Begin( iterator() ), m_End( iterator() ) #ifndef NDEBUG , singular( true ) @@ -175,7 +185,7 @@ namespace boost m_Begin(Begin), m_End(End) #ifndef NDEBUG , singular(false) - #endif + #endif {} //! Constructor from a Range @@ -200,7 +210,7 @@ namespace boost template< class Range > iterator_range( const Range& r, iterator_range_detail::const_range_tag ) : m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ) - #ifndef NDEBUG + #ifndef NDEBUG , singular(false) #endif {} @@ -209,7 +219,7 @@ namespace boost template< class Range > iterator_range( Range& r, iterator_range_detail::range_tag ) : m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ) - #ifndef NDEBUG + #ifndef NDEBUG , singular(false) #endif {} @@ -350,8 +360,8 @@ namespace boost // When storing transform iterators, operator[]() // fails because it returns by reference. Therefore // operator()() is provided for these cases. - // - value_type operator()( difference_type at ) const + // + abstract_value_type operator()( difference_type at ) const { BOOST_ASSERT( at >= 0 && at < size() ); return m_Begin[at]; @@ -380,13 +390,15 @@ namespace boost bool singular; #endif - #ifndef NDEBUG public: bool is_singular() const { + #ifndef NDEBUG return singular; + #else + return false; + #endif } - #endif protected: // @@ -639,5 +651,9 @@ namespace boost #undef BOOST_OLD_IOSTREAMS +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500)) + #pragma warning( pop ) +#endif + #endif diff --git a/include/boost/range/sub_range.hpp b/include/boost/range/sub_range.hpp old mode 100755 new mode 100644 index 35dfb27..dc66692 --- a/include/boost/range/sub_range.hpp +++ b/include/boost/range/sub_range.hpp @@ -11,18 +11,20 @@ #ifndef BOOST_RANGE_SUB_RANGE_HPP #define BOOST_RANGE_SUB_RANGE_HPP -#include - -#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500)) + #pragma warning( push ) #pragma warning( disable : 4996 ) #endif +#include #include #include #include #include #include #include +#include +#include namespace boost { @@ -41,12 +43,18 @@ namespace boost typedef BOOST_DEDUCED_TYPENAME range_difference::type difference_type; typedef BOOST_DEDUCED_TYPENAME range_size::type size_type; typedef BOOST_DEDUCED_TYPENAME base::reference reference; + + public: // for return value of front/back + typedef BOOST_DEDUCED_TYPENAME + boost::mpl::if_< boost::is_reference, + const BOOST_DEDUCED_TYPENAME boost::remove_reference::type&, + reference >::type const_reference; public: sub_range() : base() { } -#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500) ) sub_range( const sub_range& r ) : base( static_cast( r ) ) { } @@ -112,7 +120,7 @@ namespace boost return base::front(); } - const value_type& front() const + const_reference front() const { return base::front(); } @@ -122,7 +130,7 @@ namespace boost return base::back(); } - const value_type& back() const + const_reference back() const { return base::back(); } @@ -132,7 +140,7 @@ namespace boost return base::operator[](sz); } - const value_type& operator[]( difference_type sz ) const + const_reference operator[]( difference_type sz ) const { return base::operator[](sz); } @@ -163,5 +171,9 @@ namespace boost } // namespace 'boost' +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500)) + #pragma warning( pop ) +#endif + #endif From b4f99d66b590ad1d8bb66211450fd62ed202b873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 24 Jun 2008 15:38:50 +0000 Subject: [PATCH 21/73] bug-fixes from trunk [SVN r46649] --- doc/history_ack.html | 4 ++-- doc/intro.html | 2 +- doc/style.html | 2 +- doc/utility_class.html | 6 +++--- index.html | 2 +- test/Jamfile.v2 | 4 ++-- test/partial_workaround.cpp | 8 +++++++- test/string.cpp | 34 ++++++++++++++++------------------ 8 files changed, 33 insertions(+), 29 deletions(-) mode change 100755 => 100644 doc/history_ack.html mode change 100755 => 100644 doc/intro.html mode change 100755 => 100644 doc/style.html mode change 100755 => 100644 index.html mode change 100755 => 100644 test/partial_workaround.cpp mode change 100755 => 100644 test/string.cpp diff --git a/doc/history_ack.html b/doc/history_ack.html old mode 100755 new mode 100644 index c8527ba..3191dd0 --- a/doc/history_ack.html +++ b/doc/history_ack.html @@ -19,9 +19,9 @@

    History and Acknowledgement

    The library was under way for a long time. Dietmar Kühl originally intended - to submit an array_traits class template which had most of + to submit an array_traits class template which had most of the functionality present now, but only for arrays and standard containers. - I believe this was back in 2001 or 2002. + I believe this was back in 2001 or 2002.

    diff --git a/doc/intro.html b/doc/intro.html old mode 100755 new mode 100644 index 9f41c72..82f10dc --- a/doc/intro.html +++ b/doc/intro.html @@ -24,7 +24,7 @@ to a somewhat clumsy use of the algorithms with redundant specification of container names. Therefore we would like to raise the abstraction level for algorithms so they specify their interface in terms of Ranges as much as possible. + href="range.html">Ranges as much as possible.

    diff --git a/doc/style.html b/doc/style.html old mode 100755 new mode 100644 index cd82c94..4240a8c --- a/doc/style.html +++ b/doc/style.html @@ -53,7 +53,7 @@ Bidirectional Range

  • Random Access Range - Notice how we have used the categories from the new + Notice how we have used the categories from the new style iterators.

    diff --git a/doc/utility_class.html b/doc/utility_class.html index ea51503..e100859 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -27,9 +27,9 @@

    @@ -329,7 +329,7 @@ class can propagate constness since it knows what a corresponding const value_type& operator[]( difference_type at ) const; public: - // rest of interface inherited from iterator_range + // rest of interface inherited from iterator_range }; } // namespace 'boost' diff --git a/index.html b/index.html old mode 100755 new mode 100644 index 5313690..56ba4eb --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@

    Use, modification and distribution is subject to the Boost Software License, Version 1.0 - (see + (see http://www.boost.org/LICENSE_1_0.txt).

    diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index b6942ca..c82a6c9 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -12,9 +12,9 @@ rule range-test ( name : includes * ) { return [ run $(name).cpp /boost/test//boost_unit_test_framework/static + : : - : - : $(includes) + : gcc:"-Wall -Wunused " ] ; } diff --git a/test/partial_workaround.cpp b/test/partial_workaround.cpp old mode 100755 new mode 100644 index 8ac6f66..76d902f --- a/test/partial_workaround.cpp +++ b/test/partial_workaround.cpp @@ -10,6 +10,8 @@ #include #include +#include +#include #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) # pragma warn -8091 // supress warning in Boost.Test @@ -30,7 +32,6 @@ #include #include -#include #include #include @@ -91,6 +92,11 @@ void check_partial_workaround() void check_partial_workaround() { + // + // test if warnings are generated + // + std::size_t s = boost::range_detail::array_size( "foo" ); + BOOST_CHECK_EQUAL( s, 4u ); } #endif diff --git a/test/string.cpp b/test/string.cpp old mode 100755 new mode 100644 index 9a2e5a8..127f70a --- a/test/string.cpp +++ b/test/string.cpp @@ -137,14 +137,7 @@ void check_char() 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( sz, std::char_traits::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::length( char_s2 ) ); -*/ + BOOST_CHECK_EQUAL( str_begin( my_string ), my_string ); range_iterator::type str_end2 = str_begin( my_string ) + str_size(my_string); range_iterator::type str_end3 = str_end(my_string); @@ -165,6 +158,20 @@ void check_char() 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) ); + + // + // 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 ); + } @@ -172,9 +179,6 @@ void check_char() void check_string() { check_char(); -// check_char(); -// check_char(); -// check_char(); #ifndef BOOST_NO_STD_WSTRING typedef wchar_t* wchar_iterator_t; @@ -197,13 +201,7 @@ void check_string() 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( sz, std::char_traits::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::length( char_ws2 ) ); - */ + wchar_t to_search = L'n'; BOOST_CHECK( find( char_ws, to_search ) != str_end(char_ws) ); From e7902d439b1e86d1df5038001e0142b59ebb7e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 24 Jun 2008 15:42:48 +0000 Subject: [PATCH 22/73] more changes from trunk [SVN r46652] --- doc/boost_range.html | 110 ++++++++++++++++++++--------------------- doc/examples.html | 8 +-- doc/faq.html | 4 +- doc/headers.html | 2 +- doc/intro.html | 2 +- doc/portability.html | 5 +- doc/range.html | 14 +++--- doc/utility_class.html | 27 +++++----- index.html | 2 +- 9 files changed, 87 insertions(+), 87 deletions(-) mode change 100755 => 100644 doc/examples.html mode change 100755 => 100644 doc/faq.html mode change 100755 => 100644 doc/headers.html mode change 100755 => 100644 doc/portability.html mode change 100755 => 100644 doc/range.html diff --git a/doc/boost_range.html b/doc/boost_range.html index 465bd18..b9fd0ca 100644 --- a/doc/boost_range.html +++ b/doc/boost_range.html @@ -152,7 +152,7 @@ class=identifier>range_reverse_iterator; rend( const T& r ); - // + // // Random Access Range functions // @@ -235,7 +235,7 @@ class=identifier>T& A[sz] a denotes an array of type A of size sz - + Char* s @@ -259,9 +259,9 @@ class=identifier>T& Complexity - - - range_iterator<X>::type + + + range_iterator<X>::type T::iterator
    P::first_type
    A*
    @@ -269,8 +269,8 @@ class=identifier>T
    & compile time - - range_iterator<const X>::type + + range_iterator<const X>::type T::const_iterator
    P::first_type
    const A*
    @@ -278,54 +278,53 @@ class=identifier>T
    & compile time - - range_value<X>::type + + range_value<X>::type boost::iterator_value<range_iterator<X>::type>::type compile time - - range_reference<X>::type + + range_reference<X>::type boost::iterator_reference<range_iterator<X>::type>::type compile time - - range_pointer<X>::type + + range_pointer<X>::type boost::iterator_pointer<range_iterator<X>::type>::type compile time - - range_category<X>::type + + range_category<X>::type boost::iterator_category<range_iterator<X>::type>::type compile time - - range_difference<X>::type + + range_difference<X>::type boost::iterator_difference<range_iterator<X>::type>::type compile time - - - range_reverse_iterator<X>::type + + range_reverse_iterator<X>::type boost::reverse_iterator<range_iterator<X>::type>
    compile time - - range_reverse_iterator<const X>::type + + range_reverse_iterator<const X>::type boost::reverse_iterator<range_iterator<const X>::type>
    compile time @@ -346,11 +345,11 @@ class=identifier>T
    & - - begin(x) + + begin(x) range_iterator<X>::type - p.first if p is of type std::pair<T>
    + p.first if p is of type std::pair<T>
    a if a is an array
    range_begin(x) if that expression would invoke a function found by ADL
    t.begin() otherwise @@ -358,11 +357,11 @@ class=identifier>T
    & constant time - - end(x) + + end(x) range_iterator<X>::type - p.second if p is of type std::pair<T>
    + p.second if p is of type std::pair<T>
    a + sz if a is an array of size sz
    @@ -373,16 +372,16 @@ class=identifier>T
    & - - empty(x) + + empty(x) bool boost::begin(x) == boost::end(x)
    constant time
    - - distance(x) + + distance(x) range_difference<X>::type @@ -394,16 +393,16 @@ class=identifier>T
    & - - size(x) + + size(x) range_difference<X>::type boost::end(x) - boost::begin(x) constant time - - rbegin(x) + + rbegin(x) range_reverse_iterator<X>::type range_reverse_iterator<X>::type( boost::end(x) )
    @@ -411,15 +410,15 @@ class=identifier>T
    & - - rend(x) + + rend(x) range_reverse_iterator<X>::type range_reverse_iterator<X>::type( boost::begin(x) ) constant time - - const_begin(x) + + const_begin(x) range_iterator<const X>::type range_iterator<const X>::type( boost::begin(x) )
    @@ -427,15 +426,15 @@ class=identifier>T
    & - - const_end(x) + + const_end(x) range_iterator<const X>::type range_iterator<const X>::type( boost::end(x) ) constant time - - const_rbegin(x) + + const_rbegin(x) range_reverse_iterator<const X>::type range_reverse_iterator<const X>::type( boost::rbegin(x) )
    @@ -443,16 +442,16 @@ class=identifier>T
    & - - const_rend(x) + + const_rend(x) range_reverse_iterator<const X>::type range_reverse_iterator<const X>::type( boost::rend(x) ) constant time - - as_literal(x) + + as_literal(x) iterator_range<U> where U is Char* if x is a pointer to a string and U is @@ -460,20 +459,21 @@ class=identifier>T& - [a,a+sz-1) if a is an array of size sz
    - [s,s + std::char_traits<X>::length(s)) if s is a Char* + + [s,s + std::char_traits<X>::length(s)) if s is a Char* or an array of Char
    [boost::begin(x),boost::end(x)) otherwise - linear time for pointers to a string, constant time - otherwise + linear time for pointers to a string or arrays of + Char, constant time otherwise - - as_array(x) + + as_array(x) iterator_range<X> [boost::begin(x),boost::end(x)) @@ -561,7 +561,7 @@ class=identifier>T
    & Related concept - + iterator Single Pass Range diff --git a/doc/examples.html b/doc/examples.html old mode 100755 new mode 100644 index 0d24509..d1f9887 --- a/doc/examples.html +++ b/doc/examples.html @@ -23,16 +23,16 @@
    • string.cpp -
    • + shows how to implement a container version of std::find() that works with char[],wchar_t[],char*,wchar_t*. - +
    • algorithm_example.cpp -
    • + shows the replace example from the introduction. - +
    • iterator_range.cpp
    • sub_range.cpp
    • iterator_pair.cpp diff --git a/doc/faq.html b/doc/faq.html old mode 100755 new mode 100644 index 244df80..fcacf98 --- a/doc/faq.html +++ b/doc/faq.html @@ -22,7 +22,7 @@
    • Why is there no difference between range_iterator<C>::type and range_const_iterator<C>::type for std::pair<iterator, iterator>. -
    • +

      In general it is not possible nor desirable to find a corresponding const_iterator. When it is possible to come up with one, the client might choose to construct a std::pair<const_iterator,const_iterator> @@ -33,7 +33,7 @@ is somewhat more convenient than a pair and that a sub_range does propagate const-ness.

      - +
    • Why is there not supplied more types or more functions?

      diff --git a/doc/headers.html b/doc/headers.html old mode 100755 new mode 100644 index 7628591..c896bff --- a/doc/headers.html +++ b/doc/headers.html @@ -167,7 +167,7 @@ -

      diff --git a/doc/intro.html b/doc/intro.html index 82f10dc..89d3504 100644 --- a/doc/intro.html +++ b/doc/intro.html @@ -108,7 +108,7 @@ class=identifier>ForwardReadableRange >:: my_vector.assign( values, boost::end( values ) ); - typedef std::vector<int>::iterator iterator; + typedef std::vector<int>::iterator iterator; std::pair<iterator,iterator> my_view( boost::begin( my_vector ), boost::begin( my_vector ) + N ); char str_val[] = "a string"; diff --git a/doc/portability.html b/doc/portability.html old mode 100755 new mode 100644 index 9e63978..bb73e78 --- a/doc/portability.html +++ b/doc/portability.html @@ -29,9 +29,8 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here - - Visual C++ 6/7.0 has a limited support for arrays: as long as the arrays are - of built-in type it should work. +

      Visual C++ 6/7.0 has a limited support for arrays: as long as the arrays + are of built-in type it should work.

      Notice also that some compilers cannot do function template ordering properly. diff --git a/doc/range.html b/doc/range.html old mode 100755 new mode 100644 index b140888..8646141 --- a/doc/range.html +++ b/doc/range.html @@ -1,3 +1,4 @@ +


      - +

      Single Pass Range

      Notation

      @@ -227,7 +228,7 @@ otherwise
      -

      Forward Range

      +

      Forward Range

      Notation

      @@ -255,7 +256,7 @@ Range
      -

      Bidirectional Range

      +

      Bidirectional Range

      Notation

      @@ -283,7 +284,8 @@ s-lib-bidirectional-traversal-iterators">Bidirectional Traversal Iterator.
      -

      Random Access Range

      Description

      +

      Random Access Range

      +

      Description

      A range X where boost::range_iterator<X>::type is a model of Boost Concept Check library to insure that the type of a template parameter diff --git a/doc/utility_class.html b/doc/utility_class.html index e100859..956bf99 100644 --- a/doc/utility_class.html +++ b/doc/utility_class.html @@ -31,7 +31,6 @@

    • Class sub_range - The iterator_range class is templated on a Forward @@ -84,7 +83,7 @@ corresponding const_iterator is.

      typedef ForwardTraversalIterator const_iterator; typedef iterator_difference<iterator>::type difference_type; - public: // construction, assignment + public: // construction, assignment template< class ForwardTraversalIterator2 > iterator_range( ForwardTraversalIterator2 Begin, ForwardTraversalIterator2 End ); @@ -110,7 +109,7 @@ corresponding const_iterator is.

      operator
      unspecified_bool_type() const; bool equal( const iterator_range& ) ( const iterator_range& ) const; reference front() const; reference back() const; @@ -119,7 +118,7 @@ class=keyword>const; // for Random Access Range only: reference operator[]( difference_type at ) const; value_type operator()( difference_type at ) const; - }; + }; // stream output template< class ForwardTraversalIterator, class T, class Traits > @@ -164,7 +163,7 @@ class=keyword>const; bool operator<( const ForwardRange& l, const iterator_range<ForwardTraversalIterator>& r ); - // external construction + // external construction template< class ForwardTraversalIterator > iterator_range< ForwardTraversalIterator > make_iterator_range( ForwardTraversalIterator Begin, @@ -190,7 +189,7 @@ class=keyword>const; typename range_difference<Range>::type advance_begin, typename range_difference<Range>::type advance_end ); - // convenience + // convenience template< class Sequence, class ForwardRange > Sequence copy_range(

      -bool equal( iterator_range& r ) const; +bool equal( iterator_range& r ) const;

      - Returns begin() == r.begin() && end() == r.end(); + Returns begin() == r.begin() && end() == r.end();

      @@ -236,21 +235,21 @@ non-const iterators from the same container.

      -bool operator==( const ForwardRange1& l, const ForwardRange2& r ); +bool operator==( const ForwardRange1& l, const ForwardRange2& r );

      Returns size(l) != size(r) ? false : std::equal( begin(l), end(l), begin(r) );

      -bool operator!=( const ForwardRange1& l, const ForwardRange2& r ); +bool operator!=( const ForwardRange1& l, const ForwardRange2& r );
      Returns !( l == r );
      -bool operator<( const ForwardRange1& l, const ForwardRange2& r ); +bool operator<( const ForwardRange1& l, const ForwardRange2& r );
      Returns std::lexicographical_compare( begin(l), end(l), begin(r), end(r) );

      -iterator_range make_iterator_range( Range& r, 
      +iterator_range make_iterator_range( Range& r, 
                                           typename range_difference<Range>::type advance_begin, 
                                           typename range_difference<Range>::type advance_end );
       
      @@ -266,7 +265,7 @@ return make_iterator_range( new_begin, new_end );

      -Sequence copy_range( const ForwardRange& r ); +Sequence copy_range( const ForwardRange& r );

      Returns Sequence( begin(r), end(r) );
      @@ -292,7 +291,7 @@ class can propagate constness since it knows what a corresponding
      class sub_range : public iterator_range< typename range_iterator<ForwardRange>::type > { public: - typedef typename range_iterator<ForwardRange>::
      type iterator; + typedef typename range_iterator<ForwardRange>::type iterator; typedef typename range_iterator<const ForwardRange>::type const_iterator; typedef typename iterator_difference<iterator>::type difference_type; diff --git a/index.html b/index.html index 56ba4eb..e846421 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@

        -
      • Introduction +
      • Introduction
      • Range concepts:
          From a85afbe470c500497e994d78c7988320f9cfa1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Wed, 16 Jul 2008 21:05:16 +0000 Subject: [PATCH 23/73] doc update [SVN r47495] --- doc/upgrading.html | 78 ++++++++++++++++++++++++++++++++++++++++++++++ index.html | 2 ++ 2 files changed, 80 insertions(+) create mode 100644 doc/upgrading.html diff --git a/doc/upgrading.html b/doc/upgrading.html new file mode 100644 index 0000000..fdab5ab --- /dev/null +++ b/doc/upgrading.html @@ -0,0 +1,78 @@ + + + + + + Boost.Range Upgrading + + + + +
    • + + + + +

      Boost.Range

      + +

      Upgrading from Boost v. 1.34.*

      +

      + Boost v. 1.35 introduced some larger refactorings of the library: +

      +
        +
      • Direct support for character arrays was abandoned in favor of + uniform treatment of all arrays. Instead string algorithms can use + the new function as_literal().
      • +
      • boost::size() now requires a Random Access Range. The old behavior is provided as boost::distance()
      • +
      • range_size<T>::type has been completely removed + in favor of range_difference<T>::type +
      • + boost_range_begin() and boost_range_end() + have been renamed range_begin() and range_begin(), respectively.
      • + + +
      • range_result_iterator<T>::type and + range_reverse_result_iterator<T>::type are have + been renamed + range_iterator<T>::type and + range_reverse_iterator<T>::type. +
      • +
      • The procedure that makes a custom type work with the library + has been greatly simplified. See extending the library + for details.
      • +
      + + +
      +

      + © Copyright Thorsten Ottosen 2008. +

      + +

      + Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt) +

      + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + + + + diff --git a/index.html b/index.html index e846421..3e5f4bb 100644 --- a/index.html +++ b/index.html @@ -55,6 +55,8 @@
    • MFC/ATL mapping (courtesy of Shunsuke Sogame)
    • Portability +
    • Upgrading from Boost v. + 1.34.*
    • FAQ
    • History and acknowledgment From 26b096f65db8b158f03b564f6df7c17d8e09ac14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Tue, 22 Jul 2008 09:29:56 +0000 Subject: [PATCH 24/73] update in response to inspection report [SVN r47681] --- doc/upgrading.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/upgrading.html b/doc/upgrading.html index fdab5ab..f94e73b 100644 --- a/doc/upgrading.html +++ b/doc/upgrading.html @@ -26,8 +26,8 @@ the new function as_literal().
    • boost::size() now requires a Random Access Range. The old behavior is provided as boost::distance()
    • + href="boost_range.html#size">boost::size() now requires a Random Access Range. The old behavior is provided as boost::distance()
    • range_size<T>::type has been completely removed in favor of range_difference<T>::type
    • From 12d904a5e416ca92df6232b2ca377e9773644a16 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 24 Jan 2009 18:57:20 +0000 Subject: [PATCH 25/73] merge of cmake build files from trunk per beman [SVN r50756] --- CMakeLists.txt | 22 ++++++++++++++++++++++ doc/CMakeLists.txt | 1 + module.cmake | 1 + test/CMakeLists.txt | 19 +++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 doc/CMakeLists.txt create mode 100644 module.cmake create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f0c2263 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +#---------------------------------------------------------------------------- +# This file was automatically generated from the original CMakeLists.txt file +# Add a variable to hold the headers for the library +set (lib_headers + range.hpp + range +) + +# Add a library target to the build system +boost_library_project( + range + # SRCDIRS + TESTDIRS test + HEADERS ${lib_headers} + DOCDIRS doc + DESCRIPTION "A new infrastructure for generic algorithms that builds on top of the new iterator concepts." + MODULARIZED + AUTHORS "Thorsten Ottosen " + # MAINTAINERS +) + + diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..3aea8c0 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1 @@ +boost_add_documentation(boost_range.qbk) \ No newline at end of file diff --git a/module.cmake b/module.cmake new file mode 100644 index 0000000..49c9bc9 --- /dev/null +++ b/module.cmake @@ -0,0 +1 @@ +boost_module(range DEPENDS algorithm) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..83d1210 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,19 @@ +boost_additional_test_dependencies(range BOOST_DEPENDS test) + +message(STATUS "libs/range/test: need -Wall -Wunused here when under gcc") +set( test_compile_flags "") +IF(CMAKE_COMPILER_IS_GNUCC) + SET(test_compile_flags "-Wall -Wunused") +ENDIF(CMAKE_COMPILER_IS_GNUCC) + +boost_test_run(array DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(iterator_pair DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(std_container DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(string DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(iterator_range DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(sub_range DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(partial_workaround DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(algorithm_example DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(reversible_range DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(const_ranges DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) +boost_test_run(extension_mechanism DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) From deefb61ec654371eedee92a29741265f95be0e74 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 23 Feb 2009 18:39:32 +0000 Subject: [PATCH 26/73] Merge PDF build changes from Trunk. [SVN r51417] --- doc/Jamfile.v2 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index bfe0908..fd54f7a 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -28,5 +28,6 @@ boostbook standalone # generate.section.toc.level=4 # chunk.first.sections=7 # toc.section.depth=10 + pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html ; From c8c808b04efa04c5f35a20da7973cb3412d46414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20J=C3=B8rgen=20Ottosen?= Date: Sun, 5 Apr 2009 20:49:47 +0000 Subject: [PATCH 27/73] fix for bug Ticket #2903 [SVN r52204] --- include/boost/range/as_literal.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/range/as_literal.hpp b/include/boost/range/as_literal.hpp index 38cc9cf..2f04ca8 100644 --- a/include/boost/range/as_literal.hpp +++ b/include/boost/range/as_literal.hpp @@ -38,7 +38,7 @@ namespace boost return strlen( s ); } -#ifndef BOOST_NO_INTRINSIC_WCHAR_T +#ifndef BOOST_NO_CWCHAR inline std::size_t length( const wchar_t* s ) { return wcslen( s ); @@ -61,7 +61,7 @@ namespace boost return true; } -#ifndef BOOST_NO_INTRINSIC_WCHAR_T +#ifndef BOOST_NO_CWCHAR inline bool is_char_ptr( wchar_t* ) { return true; From 90f4eca5cde90d98cddfc33f892bc6c1ee8010f6 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 16 May 2009 13:45:21 +0000 Subject: [PATCH 28/73] Merge in inspect checks for links in CSS files and external content. And fix a few of these issues. Merged revisions 52663-52664,52666-52668,52712 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r52663 | danieljames | 2009-04-29 22:12:08 +0100 (Wed, 29 Apr 2009) | 1 line Check for invalid css links in html files as well as css files. ........ r52664 | danieljames | 2009-04-29 22:12:32 +0100 (Wed, 29 Apr 2009) | 1 line Check for external links. ........ r52666 | danieljames | 2009-04-29 22:19:12 +0100 (Wed, 29 Apr 2009) | 1 line Use local copies of the boost logo. ........ r52667 | danieljames | 2009-04-29 22:19:40 +0100 (Wed, 29 Apr 2009) | 1 line Remove unused copy of boostbook.css ........ r52668 | danieljames | 2009-04-29 22:19:56 +0100 (Wed, 29 Apr 2009) | 3 lines Fix a link to a header on trac. IMO it would be better to link to the local copy. ........ r52712 | danieljames | 2009-05-01 21:51:10 +0100 (Fri, 01 May 2009) | 1 line Better inspect error for external content. ........ [SVN r53044] --- doc/mfc_atl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/mfc_atl.html b/doc/mfc_atl.html index a022fe3..cc8eeb0 100644 --- a/doc/mfc_atl.html +++ b/doc/mfc_atl.html @@ -291,7 +291,7 @@ ul.auto-toc {
      -

      Boost Range MFC/ATL Extension

      +

      Boost Range MFC/ATL Extension

      From a39946c55de83e91b116a49c5f96fe378a31adca Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Wed, 22 Jul 2009 21:51:01 +0000 Subject: [PATCH 29/73] Add basic copyright/license to keep cmake out of the inspection report [SVN r55095] --- CMakeLists.txt | 6 ++++++ doc/CMakeLists.txt | 6 ++++++ test/CMakeLists.txt | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0c2263..44214cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# 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 diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 3aea8c0..2a15cc3 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1 +1,7 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# boost_add_documentation(boost_range.qbk) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 83d1210..0907adc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# 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(range BOOST_DEPENDS test) message(STATUS "libs/range/test: need -Wall -Wunused here when under gcc") From 29fa8779495f16770e288f0050e2fec6ce97d646 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 17 Oct 2009 01:10:45 +0000 Subject: [PATCH 30/73] rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release. [SVN r56941] --- CMakeLists.txt | 28 ---------------------------- doc/CMakeLists.txt | 7 ------- module.cmake | 1 - test/CMakeLists.txt | 25 ------------------------- 4 files changed, 61 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 doc/CMakeLists.txt delete mode 100644 module.cmake delete mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 44214cf..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# -# 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 - range.hpp - range -) - -# Add a library target to the build system -boost_library_project( - range - # SRCDIRS - TESTDIRS test - HEADERS ${lib_headers} - DOCDIRS doc - DESCRIPTION "A new infrastructure for generic algorithms that builds on top of the new iterator concepts." - MODULARIZED - AUTHORS "Thorsten Ottosen " - # MAINTAINERS -) - - diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt deleted file mode 100644 index 2a15cc3..0000000 --- a/doc/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -boost_add_documentation(boost_range.qbk) \ No newline at end of file diff --git a/module.cmake b/module.cmake deleted file mode 100644 index 49c9bc9..0000000 --- a/module.cmake +++ /dev/null @@ -1 +0,0 @@ -boost_module(range DEPENDS algorithm) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 0907adc..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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(range BOOST_DEPENDS test) - -message(STATUS "libs/range/test: need -Wall -Wunused here when under gcc") -set( test_compile_flags "") -IF(CMAKE_COMPILER_IS_GNUCC) - SET(test_compile_flags "-Wall -Wunused") -ENDIF(CMAKE_COMPILER_IS_GNUCC) - -boost_test_run(array DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(iterator_pair DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(std_container DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(string DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(iterator_range DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(sub_range DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(partial_workaround DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(algorithm_example DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(reversible_range DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(const_ranges DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) -boost_test_run(extension_mechanism DEPENDS boost_unit_test_framework COMPILE_FLAGS ${test_compile_flags}) From eea32403ef6affe4f7e558e5ab1f5c78e1f324c0 Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Thu, 8 Apr 2010 19:34:17 +0000 Subject: [PATCH 31/73] Boost.Range merge of fixes from the trunk. [SVN r61146] --- doc/Jamfile.v2 | 18 +- doc/boost_range.qbk | 18 +- doc/html/index.html | 6 +- doc/html/quickbook_HTML.manifest | 1 + doc/html/range/concepts.html | 2 +- .../range/concepts/bidirectional_range.html | 20 +- doc/html/range/concepts/concept_checking.html | 10 +- doc/html/range/concepts/forward_range.html | 14 +- doc/html/range/concepts/overview.html | 2 +- .../range/concepts/random_access_range.html | 16 +- .../range/concepts/single_pass_range.html | 20 +- doc/html/range/examples.html | 2 +- doc/html/range/faq.html | 2 +- doc/html/range/history_ack.html | 2 +- doc/html/range/introduction.html | 6 +- doc/html/range/library_headers.html | 2 +- doc/html/range/mfc_atl.html | 6 +- doc/html/range/mfc_atl/atl_ranges.html | 2 +- doc/html/range/mfc_atl/const_ranges.html | 2 +- doc/html/range/mfc_atl/mfc_ranges.html | 2 +- doc/html/range/mfc_atl/references.html | 2 +- doc/html/range/mfc_atl/requirements.html | 2 +- doc/html/range/portability.html | 2 +- doc/html/range/reference.html | 2 +- doc/html/range/reference/adaptors.html | 2 +- .../adaptors_general_requirements.html | 2 +- .../adaptors/adaptors_introduction.html | 8 +- .../adaptors/adaptors_reference.html | 2 +- .../adaptors_reference/adjacent_filtered.html | 2 +- .../adaptors/adaptors_reference/copied.html | 2 +- .../adaptors/adaptors_reference/filtered.html | 2 +- .../adaptors/adaptors_reference/indexed.html | 2 +- .../adaptors_reference/indirected.html | 2 +- .../adaptors/adaptors_reference/map_keys.html | 2 +- .../adaptors_reference/map_values.html | 2 +- .../adaptors/adaptors_reference/replaced.html | 2 +- .../adaptors_reference/replaced_if.html | 2 +- .../adaptors/adaptors_reference/reversed.html | 2 +- .../adaptors/adaptors_reference/sliced.html | 2 +- .../adaptors/adaptors_reference/strided.html | 2 +- .../adaptors_reference/tokenized.html | 2 +- .../adaptors_reference/transformed.html | 2 +- .../adaptors/adaptors_reference/uniqued.html | 2 +- .../reference/adaptors/adaptors_synopsis.html | 2 +- doc/html/range/reference/algorithms.html | 2 +- .../reference/algorithms/heap_algorithms.html | 2 +- .../algorithms/heap_algorithms/make_heap.html | 12 +- .../algorithms/heap_algorithms/pop_heap.html | 14 +- .../algorithms/heap_algorithms/push_heap.html | 14 +- .../algorithms/permutation_algorithms.html | 2 +- .../next_permutation.html | 12 +- .../prev_permutation.html | 12 +- .../range_algorithm_introduction.html | 2 +- .../range_algorithm_mutating_algorithms.html | 2 +- .../copy.html | 14 +- .../copy_backward.html | 14 +- .../fill.html | 12 +- .../generate.html | 14 +- .../inplace_merge.html | 18 +- .../merge.html | 18 +- .../nth_element.html | 12 +- .../partial_sort.html | 12 +- .../partition.html | 12 +- .../random_shuffle.html | 14 +- .../remove.html | 12 +- .../remove_if.html | 12 +- .../replace.html | 12 +- .../replace_if.html | 12 +- .../rotate.html | 14 +- .../sort.html | 12 +- .../stable_partition.html | 12 +- .../stable_sort.html | 12 +- .../transform.html | 14 +- .../unique.html | 12 +- .../range_algorithm_new_algorithms.html | 4 +- .../range_algorithm_new_algorithms/erase.html | 12 +- .../for_each.html | 12 +- .../insert.html | 18 +- .../range_algorithm_new_algorithms/iota.html | 96 +++++++ .../overwrite.html | 18 +- .../push_back.html | 12 +- .../push_front.html | 12 +- .../remove_erase.html | 12 +- .../remove_erase_if.html | 12 +- ...nge_algorithm_non_mutating_algorithms.html | 2 +- .../adjacent_find.html | 12 +- .../binary_search.html | 14 +- .../count.html | 12 +- .../equal.html | 12 +- .../equal_range.html | 14 +- .../find.html | 24 +- .../find_end.html | 42 +-- .../find_first_of.html | 42 +-- .../find_if.html | 26 +- .../for_each.html | 12 +- .../lexicographical_compare.html | 12 +- .../lower_bound.html | 26 +- .../max_element.html | 12 +- .../min_element.html | 12 +- .../mismatch.html | 14 +- .../search.html | 12 +- .../upper_bound.html | 26 +- .../reference/algorithms/range_numeric.html | 2 +- .../algorithms/range_numeric/accumulate.html | 16 +- .../range_numeric/adjacent_difference.html | 18 +- .../range_numeric/inner_product.html | 18 +- .../algorithms/range_numeric/partial_sum.html | 18 +- .../reference/algorithms/set_algorithms.html | 2 +- .../algorithms/set_algorithms/includes.html | 14 +- .../set_algorithms/set_difference.html | 14 +- .../set_algorithms/set_intersection.html | 14 +- .../set_symmetric_difference.html | 14 +- .../algorithms/set_algorithms/set_union.html | 14 +- doc/html/range/reference/extending.html | 2 +- .../range/reference/extending/method_1.html | 4 +- .../range/reference/extending/method_2.html | 2 +- .../range/reference/extending/method_3.html | 2 +- .../extending/method_3/method_3_1.html | 2 +- .../extending/method_3/method_3_2.html | 2 +- doc/html/range/reference/overview.html | 2 +- doc/html/range/reference/ranges.html | 2 +- .../reference/ranges/counting_range.html | 10 +- doc/html/range/reference/ranges/irange.html | 12 +- .../range/reference/ranges/istream_range.html | 8 +- doc/html/range/reference/semantics.html | 4 +- .../range/reference/semantics/functions.html | 2 +- .../reference/semantics/metafunctions.html | 2 +- doc/html/range/reference/synopsis.html | 2 +- doc/html/range/style_guide.html | 4 +- doc/html/range/upgrade.html | 2 +- doc/html/range/upgrade/upgrade_from_1_34.html | 2 +- doc/html/range/upgrade/upgrade_from_1_42.html | 2 +- doc/html/range/utilities.html | 4 +- doc/html/range/utilities/iterator_range.html | 10 +- doc/html/range/utilities/join.html | 6 +- doc/html/range/utilities/sub_range.html | 4 +- doc/reference/algorithm_ext/iota.qbk | 2 +- .../boost/range/adaptor/adjacent_filtered.hpp | 198 ++++++------- include/boost/range/adaptor/uniqued.hpp | 42 +-- include/boost/range/combine.hpp | 272 +++++++++--------- include/boost/range/size_type.hpp | 3 +- test/combine.cpp | 20 +- test/iterator_range.cpp | 2 +- 143 files changed, 903 insertions(+), 951 deletions(-) create mode 100644 doc/html/range/reference/algorithms/range_algorithm_new_algorithms/iota.html mode change 100755 => 100644 include/boost/range/size_type.hpp diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index e286110..5195b32 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -8,20 +8,12 @@ #// For more information, see http://www.boost.org/libs/range/ #// - -#use-project boost : $(BOOST_ROOT) ; - project boost/libs/range/doc ; -import boostbook : boostbook ; -#import quickbook ; +using boostbook ; using quickbook ; path-constant images_location : html ; -#xml boost_range : boost_range.qbk ; - -#boostbook standalone - boostbook quickbook : boost_range.qbk @@ -34,11 +26,7 @@ boostbook quickbook toc.section.depth=3 toc.max.depth=3 generate.section.toc.level=4 - -# generate.section.toc.level=4 -# chunk.first.sections=7 -# toc.section.depth=10 - pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html - pdf:img.src.path=$(images_location)/ + pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html + pdf:img.src.path=$(images_location)/ ; diff --git a/doc/boost_range.qbk b/doc/boost_range.qbk index 45af6c4..1d56b82 100644 --- a/doc/boost_range.qbk +++ b/doc/boost_range.qbk @@ -64,17 +64,17 @@ [def __range_adaptors__ [link range.reference.adaptors Range adaptors]] [def __range_algorithms__ [link range.reference.algorithms Range algorithms]] -[def __single_pass_iterator__ [@../../libs/iterator/doc/new-iter-concepts.html#singls-pass-iterators-lib-single-pass-iterators Single Pass Iterator]] -[def __forward_traversal_iterator__ [@../../libs/iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators Forward Traversal Iterator]] -[def __bidirectional_traversal_iterator__ [@../../libs/iterator/doc/new-iter-concepts.html#bidirectional-traversal-iterators-lib-bidirectional-traversal-iterators Bidirectional Traversal Iterator]] -[def __random_access_traversal_iterator__ [@../../libs/iterator/doc/new-iter-concepts.html#random-access-traversal-iterators-lib-random-access-traversal-iterators Random Access Traversal Iterator]] -[def __new_style_iterators__ [@../../libs/iterator/doc/new-iter-concepts.html new style iterators]] -[def __iterator_concepts__ [@../../libs/iterator/doc/iterator_concepts.html Iterator concepts]] +[def __single_pass_iterator__ [@boost:/libs/iterator/doc/new-iter-concepts.html#singls-pass-iterators-lib-single-pass-iterators Single Pass Iterator]] +[def __forward_traversal_iterator__ [@boost:/libs/iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators Forward Traversal Iterator]] +[def __bidirectional_traversal_iterator__ [@boost:/libs/iterator/doc/new-iter-concepts.html#bidirectional-traversal-iterators-lib-bidirectional-traversal-iterators Bidirectional Traversal Iterator]] +[def __random_access_traversal_iterator__ [@boost:/libs/iterator/doc/new-iter-concepts.html#random-access-traversal-iterators-lib-random-access-traversal-iterators Random Access Traversal Iterator]] +[def __new_style_iterators__ [@boost:/libs/iterator/doc/new-iter-concepts.html new style iterators]] +[def __iterator_concepts__ [@boost:/libs/iterator/doc/iterator_concepts.html Iterator concepts]] [def __container__ [@http://www.sgi.com/Technology/STL/Container.html Container]] -[def __metafunctions__ [@../../libs/mpl/doc/refmanual/metafunction.html metafunctions]] -[def __concept_check__ [@../../libs/concept_check/index.html Boost Concept Check library]] -[def __boost_array__ [@../../libs/array/index.html boost::array]] +[def __metafunctions__ [@boost:/libs/mpl/doc/refmanual/metafunction.html metafunctions]] +[def __concept_check__ [@boost:/libs/concept_check/index.html Boost Concept Check library]] +[def __boost_array__ [@boost:/libs/array/index.html boost::array]] [def __the_forwarding_problem__ [@http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm The Forwarding Problem]] [def __sgi_inner_product__ [@http://www.sgi.com/tech/stl/inner_product.html inner_product]] diff --git a/doc/html/index.html b/doc/html/index.html index 4f1a4a1..f5bb91c 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Range 2.0 - + @@ -30,7 +30,7 @@
      -

      +

      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)

      @@ -135,7 +135,7 @@

      - +

      Last revised: April 03, 2010 at 08:56:46 GMT

      Last revised: April 05, 2010 at 17:25:33 GMT


      diff --git a/doc/html/quickbook_HTML.manifest b/doc/html/quickbook_HTML.manifest index b3be8f5..67e69fa 100644 --- a/doc/html/quickbook_HTML.manifest +++ b/doc/html/quickbook_HTML.manifest @@ -91,6 +91,7 @@ range/reference/algorithms/range_algorithm_new_algorithms.html range/reference/algorithms/range_algorithm_new_algorithms/erase.html range/reference/algorithms/range_algorithm_new_algorithms/for_each.html range/reference/algorithms/range_algorithm_new_algorithms/insert.html +range/reference/algorithms/range_algorithm_new_algorithms/iota.html range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html range/reference/algorithms/range_algorithm_new_algorithms/push_back.html range/reference/algorithms/range_algorithm_new_algorithms/push_front.html diff --git a/doc/html/range/concepts.html b/doc/html/range/concepts.html index c384122..c43b67c 100644 --- a/doc/html/range/concepts.html +++ b/doc/html/range/concepts.html @@ -3,7 +3,7 @@ Range Concepts - + diff --git a/doc/html/range/concepts/bidirectional_range.html b/doc/html/range/concepts/bidirectional_range.html index 796ca14..0fc965b 100644 --- a/doc/html/range/concepts/bidirectional_range.html +++ b/doc/html/range/concepts/bidirectional_range.html @@ -3,7 +3,7 @@ Bidirectional Range - + @@ -27,7 +27,7 @@ Bidirectional Range
      - + Notation
      @@ -65,17 +65,17 @@
      - + Description

      This concept provides access to iterators that traverse in both directions (forward and reverse). The boost::range_iterator<X>::type iterator must meet all of the requirements - of Bidirectional + of Bidirectional Traversal Iterator.

      - + Refinement of
      @@ -83,7 +83,7 @@ Forward Range

      - + Associated types
      @@ -136,7 +136,7 @@
      - + Valid expressions
      @@ -221,7 +221,7 @@
      - + Complexity guarantees
      @@ -232,7 +232,7 @@ Forward Range.

      - + Invariants
      @@ -272,7 +272,7 @@
      - + See also

      diff --git a/doc/html/range/concepts/concept_checking.html b/doc/html/range/concepts/concept_checking.html index 37175b4..a4aa1d9 100644 --- a/doc/html/range/concepts/concept_checking.html +++ b/doc/html/range/concepts/concept_checking.html @@ -3,7 +3,7 @@ Concept Checking - + @@ -29,7 +29,7 @@

      Each of the range concepts has a corresponding concept checking class in the file <boost/range/concepts.hpp>. - These classes may be used in conjunction with the Boost + These classes may be used in conjunction with the Boost Concept Check library to ensure that the type of a template parameter is compatible with a range concept. If not, a meaningful compile time error is generated. Checks are provided for the range concepts related to iterator @@ -79,17 +79,17 @@

    - + See also

    Range Terminology and style guidelines

    - Iterator concepts + Iterator concepts

    - Boost Concept Check library + Boost Concept Check library

    diff --git a/doc/html/range/concepts/forward_range.html b/doc/html/range/concepts/forward_range.html index 9076b68..f82d8c5 100644 --- a/doc/html/range/concepts/forward_range.html +++ b/doc/html/range/concepts/forward_range.html @@ -3,7 +3,7 @@ Forward Range - + @@ -27,7 +27,7 @@ Forward Range
    - + Notation
    @@ -65,22 +65,22 @@
    - + Description

    - A range X where boost::range_iterator<X>::type is a model of Forward + A range X where boost::range_iterator<X>::type is a model of Forward Traversal Iterator.

    - + Refinement of

    Single Pass Range

    - + Associated types
    @@ -132,7 +132,7 @@
    - + See also

    diff --git a/doc/html/range/concepts/overview.html b/doc/html/range/concepts/overview.html index 7cd19e8..c2bb4d1 100644 --- a/doc/html/range/concepts/overview.html +++ b/doc/html/range/concepts/overview.html @@ -3,7 +3,7 @@ Overview - + diff --git a/doc/html/range/concepts/random_access_range.html b/doc/html/range/concepts/random_access_range.html index 97b3171..cc5d88e 100644 --- a/doc/html/range/concepts/random_access_range.html +++ b/doc/html/range/concepts/random_access_range.html @@ -3,7 +3,7 @@ Random Access Range - + @@ -27,15 +27,15 @@ Random Access Range

    - + Description

    - A range X where boost::range_iterator<X>::type is a model of Random + A range X where boost::range_iterator<X>::type is a model of Random Access Traversal Iterator.

    - + Refinement of
    @@ -43,7 +43,7 @@ Bidirectional Range

    - + Valid expressions
    @@ -89,7 +89,7 @@
    - + Expression semantics
    @@ -139,7 +139,7 @@
    - + Complexity guarantees
    @@ -147,7 +147,7 @@ boost::size(a) completes in amortized constant time.

    - + Invariants
    diff --git a/doc/html/range/concepts/single_pass_range.html b/doc/html/range/concepts/single_pass_range.html index 10669d1..9cb3123 100644 --- a/doc/html/range/concepts/single_pass_range.html +++ b/doc/html/range/concepts/single_pass_range.html @@ -3,7 +3,7 @@ Single Pass Range - + @@ -27,7 +27,7 @@ Single Pass Range
    - + Notation
    @@ -65,15 +65,15 @@
    - + Description

    - A range X where boost::range_iterator<X>::type is a model of Single + A range X where boost::range_iterator<X>::type is a model of Single Pass Iterator.

    - + Associated types
    @@ -126,7 +126,7 @@
    - + Valid expressions
    @@ -198,7 +198,7 @@
    - + Expression semantics
    @@ -266,7 +266,7 @@
    - + Complexity guarantees
    @@ -276,7 +276,7 @@ constant time.

    - + Invariants
    @@ -316,7 +316,7 @@
    - + See also

    diff --git a/doc/html/range/examples.html b/doc/html/range/examples.html index b272df8..f517040 100644 --- a/doc/html/range/examples.html +++ b/doc/html/range/examples.html @@ -3,7 +3,7 @@ Examples - + diff --git a/doc/html/range/faq.html b/doc/html/range/faq.html index 0c9d40b..a5ea15d 100644 --- a/doc/html/range/faq.html +++ b/doc/html/range/faq.html @@ -3,7 +3,7 @@ FAQ - + diff --git a/doc/html/range/history_ack.html b/doc/html/range/history_ack.html index 930b6b6..2401db3 100644 --- a/doc/html/range/history_ack.html +++ b/doc/html/range/history_ack.html @@ -3,7 +3,7 @@ History and Acknowledgement - + diff --git a/doc/html/range/introduction.html b/doc/html/range/introduction.html index 8bce31d..e41a60c 100644 --- a/doc/html/range/introduction.html +++ b/doc/html/range/introduction.html @@ -3,7 +3,7 @@ Introduction - + @@ -50,7 +50,7 @@ null terminated strings, std::pairs of iterators, and raw arrays (and more), such that the same generic code can work with them all. The basic idea is to add another layer of indirection using - metafunctions + metafunctions and free-standing functions so syntactic and/or semantic differences can be removed.

    @@ -130,7 +130,7 @@

    - By using the free-standing functions and metafunctions, + By using the free-standing functions and metafunctions, the code automatically works for all the types supported by this library; now and in the future. Notice that we have to provide two versions of find() since we cannot forward a non-const rvalue with reference arguments (see this article diff --git a/doc/html/range/library_headers.html b/doc/html/range/library_headers.html index a5bd095..8f28283 100644 --- a/doc/html/range/library_headers.html +++ b/doc/html/range/library_headers.html @@ -3,7 +3,7 @@ Library Headers - + diff --git a/doc/html/range/mfc_atl.html b/doc/html/range/mfc_atl.html index 8d5ed19..338e860 100644 --- a/doc/html/range/mfc_atl.html +++ b/doc/html/range/mfc_atl.html @@ -3,7 +3,7 @@ MFC/ATL (courtesy of Shunsuke Sogame) - + @@ -34,7 +34,7 @@

    References
    - + Introduction

    @@ -100,7 +100,7 @@

    - + Overview

    diff --git a/doc/html/range/mfc_atl/atl_ranges.html b/doc/html/range/mfc_atl/atl_ranges.html index 65ee355..766375d 100644 --- a/doc/html/range/mfc_atl/atl_ranges.html +++ b/doc/html/range/mfc_atl/atl_ranges.html @@ -3,7 +3,7 @@ ATL Ranges - + diff --git a/doc/html/range/mfc_atl/const_ranges.html b/doc/html/range/mfc_atl/const_ranges.html index 2e047f6..222c6d8 100644 --- a/doc/html/range/mfc_atl/const_ranges.html +++ b/doc/html/range/mfc_atl/const_ranges.html @@ -3,7 +3,7 @@ const Ranges - + diff --git a/doc/html/range/mfc_atl/mfc_ranges.html b/doc/html/range/mfc_atl/mfc_ranges.html index af0c6e9..9e6d001 100644 --- a/doc/html/range/mfc_atl/mfc_ranges.html +++ b/doc/html/range/mfc_atl/mfc_ranges.html @@ -3,7 +3,7 @@ MFC Ranges - + diff --git a/doc/html/range/mfc_atl/references.html b/doc/html/range/mfc_atl/references.html index 124a538..8afe82a 100644 --- a/doc/html/range/mfc_atl/references.html +++ b/doc/html/range/mfc_atl/references.html @@ -3,7 +3,7 @@ References - + diff --git a/doc/html/range/mfc_atl/requirements.html b/doc/html/range/mfc_atl/requirements.html index 131433f..c49ac8c 100644 --- a/doc/html/range/mfc_atl/requirements.html +++ b/doc/html/range/mfc_atl/requirements.html @@ -3,7 +3,7 @@ Requirements - + diff --git a/doc/html/range/portability.html b/doc/html/range/portability.html index 901e0b1..63e3621 100644 --- a/doc/html/range/portability.html +++ b/doc/html/range/portability.html @@ -3,7 +3,7 @@ Portability - + diff --git a/doc/html/range/reference.html b/doc/html/range/reference.html index 70c17dc..a76673a 100644 --- a/doc/html/range/reference.html +++ b/doc/html/range/reference.html @@ -3,7 +3,7 @@ Reference - + diff --git a/doc/html/range/reference/adaptors.html b/doc/html/range/reference/adaptors.html index 5ab0ecd..bc68382 100644 --- a/doc/html/range/reference/adaptors.html +++ b/doc/html/range/reference/adaptors.html @@ -3,7 +3,7 @@ Range Adaptors - + diff --git a/doc/html/range/reference/adaptors/adaptors_general_requirements.html b/doc/html/range/reference/adaptors/adaptors_general_requirements.html index a815bae..ce2b17b 100644 --- a/doc/html/range/reference/adaptors/adaptors_general_requirements.html +++ b/doc/html/range/reference/adaptors/adaptors_general_requirements.html @@ -3,7 +3,7 @@ General Requirements - + diff --git a/doc/html/range/reference/adaptors/adaptors_introduction.html b/doc/html/range/reference/adaptors/adaptors_introduction.html index efa54fd..3d61175 100644 --- a/doc/html/range/reference/adaptors/adaptors_introduction.html +++ b/doc/html/range/reference/adaptors/adaptors_introduction.html @@ -3,7 +3,7 @@ Introduction and motivation - + @@ -122,7 +122,7 @@ situations, you will really appreciate the succinctness of operator|().

    - + Composition of Adaptors
    @@ -159,7 +159,7 @@ is the design solution to this problem.

    - + Range Adaptor alternative to copy_if algorithm
    @@ -176,7 +176,7 @@

    - + Range Adaptor alternative to count_if algorithm
    diff --git a/doc/html/range/reference/adaptors/adaptors_reference.html b/doc/html/range/reference/adaptors/adaptors_reference.html index d284888..5a3dae6 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference.html +++ b/doc/html/range/reference/adaptors/adaptors_reference.html @@ -3,7 +3,7 @@ Reference - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/adjacent_filtered.html b/doc/html/range/reference/adaptors/adaptors_reference/adjacent_filtered.html index fa763c8..df72e28 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/adjacent_filtered.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/adjacent_filtered.html @@ -3,7 +3,7 @@ adjacent_filtered - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/copied.html b/doc/html/range/reference/adaptors/adaptors_reference/copied.html index 650e29a..b488800 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/copied.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/copied.html @@ -3,7 +3,7 @@ copied - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/filtered.html b/doc/html/range/reference/adaptors/adaptors_reference/filtered.html index 1551a9f..04d418d 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/filtered.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/filtered.html @@ -3,7 +3,7 @@ filtered - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/indexed.html b/doc/html/range/reference/adaptors/adaptors_reference/indexed.html index d8c8674..03ec01b 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/indexed.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/indexed.html @@ -3,7 +3,7 @@ indexed - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/indirected.html b/doc/html/range/reference/adaptors/adaptors_reference/indirected.html index adcd57a..391abcc 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/indirected.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/indirected.html @@ -3,7 +3,7 @@ indirected - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/map_keys.html b/doc/html/range/reference/adaptors/adaptors_reference/map_keys.html index 95c1746..7af39c9 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/map_keys.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/map_keys.html @@ -3,7 +3,7 @@ map_keys - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/map_values.html b/doc/html/range/reference/adaptors/adaptors_reference/map_values.html index 553a8f3..810ba7a 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/map_values.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/map_values.html @@ -3,7 +3,7 @@ map_values - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/replaced.html b/doc/html/range/reference/adaptors/adaptors_reference/replaced.html index 0990ede..6af8257 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/replaced.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/replaced.html @@ -3,7 +3,7 @@ replaced - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/replaced_if.html b/doc/html/range/reference/adaptors/adaptors_reference/replaced_if.html index abcf00f..f916472 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/replaced_if.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/replaced_if.html @@ -3,7 +3,7 @@ replaced_if - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/reversed.html b/doc/html/range/reference/adaptors/adaptors_reference/reversed.html index 52f4cda..2ef6d5d 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/reversed.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/reversed.html @@ -3,7 +3,7 @@ reversed - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/sliced.html b/doc/html/range/reference/adaptors/adaptors_reference/sliced.html index 9793092..8901fa0 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/sliced.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/sliced.html @@ -3,7 +3,7 @@ sliced - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/strided.html b/doc/html/range/reference/adaptors/adaptors_reference/strided.html index 6fcc281..ca37e60 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/strided.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/strided.html @@ -3,7 +3,7 @@ strided - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/tokenized.html b/doc/html/range/reference/adaptors/adaptors_reference/tokenized.html index fc4bc42..0b294b2 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/tokenized.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/tokenized.html @@ -3,7 +3,7 @@ tokenized - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/transformed.html b/doc/html/range/reference/adaptors/adaptors_reference/transformed.html index 56a6170..1947b6d 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/transformed.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/transformed.html @@ -3,7 +3,7 @@ transformed - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/uniqued.html b/doc/html/range/reference/adaptors/adaptors_reference/uniqued.html index 3b314ab..1f7d9fb 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/uniqued.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/uniqued.html @@ -3,7 +3,7 @@ uniqued - + diff --git a/doc/html/range/reference/adaptors/adaptors_synopsis.html b/doc/html/range/reference/adaptors/adaptors_synopsis.html index d0fea59..202a114 100644 --- a/doc/html/range/reference/adaptors/adaptors_synopsis.html +++ b/doc/html/range/reference/adaptors/adaptors_synopsis.html @@ -3,7 +3,7 @@ Synopsis - + diff --git a/doc/html/range/reference/algorithms.html b/doc/html/range/reference/algorithms.html index fc70d02..99e1dad 100644 --- a/doc/html/range/reference/algorithms.html +++ b/doc/html/range/reference/algorithms.html @@ -3,7 +3,7 @@ Range Algorithm - + diff --git a/doc/html/range/reference/algorithms/heap_algorithms.html b/doc/html/range/reference/algorithms/heap_algorithms.html index 25c45e4..2cdbaaa 100644 --- a/doc/html/range/reference/algorithms/heap_algorithms.html +++ b/doc/html/range/reference/algorithms/heap_algorithms.html @@ -3,7 +3,7 @@ Heap algorithms - + diff --git a/doc/html/range/reference/algorithms/heap_algorithms/make_heap.html b/doc/html/range/reference/algorithms/heap_algorithms/make_heap.html index d8d4033..083df4a 100644 --- a/doc/html/range/reference/algorithms/heap_algorithms/make_heap.html +++ b/doc/html/range/reference/algorithms/heap_algorithms/make_heap.html @@ -3,7 +3,7 @@ make_heap - + @@ -28,7 +28,7 @@ make_heap
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -61,14 +61,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -119,7 +119,7 @@

  • - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap_algorithms/pop_heap.html b/doc/html/range/reference/algorithms/heap_algorithms/pop_heap.html index f1588b7..2e45c55 100644 --- a/doc/html/range/reference/algorithms/heap_algorithms/pop_heap.html +++ b/doc/html/range/reference/algorithms/heap_algorithms/pop_heap.html @@ -3,7 +3,7 @@ pop_heap - + @@ -28,7 +28,7 @@ pop_heap

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -63,14 +63,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -121,7 +121,7 @@

  • - + Precondition:
      @@ -131,7 +131,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap_algorithms/push_heap.html b/doc/html/range/reference/algorithms/heap_algorithms/push_heap.html index 35b64ca..9bcf219 100644 --- a/doc/html/range/reference/algorithms/heap_algorithms/push_heap.html +++ b/doc/html/range/reference/algorithms/heap_algorithms/push_heap.html @@ -3,7 +3,7 @@ push_heap - + @@ -28,7 +28,7 @@ push_heap

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -63,14 +63,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -121,7 +121,7 @@

    - + Precondition:
      @@ -131,7 +131,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/permutation_algorithms.html b/doc/html/range/reference/algorithms/permutation_algorithms.html index 12e33f9..a9e2392 100644 --- a/doc/html/range/reference/algorithms/permutation_algorithms.html +++ b/doc/html/range/reference/algorithms/permutation_algorithms.html @@ -3,7 +3,7 @@ Permutation algorithms - + diff --git a/doc/html/range/reference/algorithms/permutation_algorithms/next_permutation.html b/doc/html/range/reference/algorithms/permutation_algorithms/next_permutation.html index 8521343..0a212cf 100644 --- a/doc/html/range/reference/algorithms/permutation_algorithms/next_permutation.html +++ b/doc/html/range/reference/algorithms/permutation_algorithms/next_permutation.html @@ -3,7 +3,7 @@ next_permutation - + @@ -28,7 +28,7 @@ next_permutation

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -67,14 +67,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -125,7 +125,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/permutation_algorithms/prev_permutation.html b/doc/html/range/reference/algorithms/permutation_algorithms/prev_permutation.html index a1e0d1d..06b9d1d 100644 --- a/doc/html/range/reference/algorithms/permutation_algorithms/prev_permutation.html +++ b/doc/html/range/reference/algorithms/permutation_algorithms/prev_permutation.html @@ -3,7 +3,7 @@ prev_permutation - + @@ -28,7 +28,7 @@ prev_permutation

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -67,14 +67,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -125,7 +125,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_introduction.html b/doc/html/range/reference/algorithms/range_algorithm_introduction.html index 9f15ed5..f0aa6c4 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_introduction.html +++ b/doc/html/range/reference/algorithms/range_algorithm_introduction.html @@ -3,7 +3,7 @@ Introduction and motivation - + diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms.html index 80710b0..fcd52d1 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms.html @@ -3,7 +3,7 @@ Mutating algorithms - + diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html index 0decd23..e88c627 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html @@ -3,7 +3,7 @@ Range Algorithm - copy - + @@ -28,7 +28,7 @@ Range Algorithm - copy

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -51,14 +51,14 @@ distance(source_rng)

    - + Definition

    Defined in the header file boost/range/algorithm/copy.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Precondition:
      @@ -93,7 +93,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html index 541db9a..14d13c6 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html @@ -3,7 +3,7 @@ Range Algorithm - copy_backward - + @@ -28,7 +28,7 @@ Range Algorithm - copy_backward

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -60,14 +60,14 @@ denotes the end of the output sequence.

    - + Definition

    Defined in the header file boost/range/algorithm/copy_backward.hpp

    - + Requirements
      @@ -88,7 +88,7 @@
    - + Precondition:
      @@ -102,7 +102,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html index 4bb5340..f28518c 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html @@ -3,7 +3,7 @@ Range Algorithm - fill - + @@ -28,7 +28,7 @@ Range Algorithm - fill

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ in the range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/fill.hpp

    - + Requirements
      @@ -82,7 +82,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html index 1a5ba8a..68efa6a 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html @@ -3,7 +3,7 @@ Range Algorithm - generate - + @@ -28,7 +28,7 @@ Range Algorithm - generate

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -53,14 +53,14 @@ Returns the resultant range.

    - + Definition

    Defined in the header file boost/range/algorithm/generate.hpp

    - + Requirements
      @@ -84,7 +84,7 @@
    - + Precondition:
      @@ -98,7 +98,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html index fafc9d5..46ef629 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html @@ -3,7 +3,7 @@ Range Algorithm - inplace_merge - + @@ -28,7 +28,7 @@ Range Algorithm - inplace_merge

    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -72,14 +72,14 @@ input range is preserved.

    - + Definition

    Defined in the header file boost/range/algorithm/inplace_merge.hpp

    - + Requirements

    @@ -116,11 +116,11 @@ argument types.

    - + Precondition:
    - + For the non-predicate version:
    @@ -143,7 +143,7 @@
    - + For the predicate version:
    @@ -164,7 +164,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html index 9bd570e..5747eef 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html @@ -3,7 +3,7 @@ Range Algorithm - merge - + @@ -28,7 +28,7 @@ Range Algorithm - merge

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -76,14 +76,14 @@ version uses the predicate instead of operator<().

    - + Definition

    Defined in the header file boost/range/algorithm/merge.hpp

    - + Requirements

    @@ -151,11 +151,11 @@

    - + Precondition:
    - + For the non-predicate version:
    @@ -190,7 +190,7 @@
    - + For the predicate version:
    @@ -221,7 +221,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/nth_element.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/nth_element.html index b8d27f0..75f8d71 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/nth_element.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/nth_element.html @@ -3,7 +3,7 @@ Range Algorithm - nth_element - + @@ -28,7 +28,7 @@ Range Algorithm - nth_element

    - + Prototype

    @@ -55,7 +55,7 @@

    - + Description

    @@ -66,14 +66,14 @@ is the same as the element that would be in that position if rng has been sorted.

    - + Definition

    Defined in the header file boost/range/algorithm/nth_element.hpp

    - + Requirements

    @@ -124,7 +124,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partial_sort.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partial_sort.html index d218c43..1112ef2 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partial_sort.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partial_sort.html @@ -3,7 +3,7 @@ Range Algorithm - partial_sort - + @@ -28,7 +28,7 @@ Range Algorithm - partial_sort

    - + Prototype

    @@ -55,7 +55,7 @@

    - + Description

    @@ -71,14 +71,14 @@ predicate instead.

    - + Definition

    Defined in the header file boost/range/algorithm/partial_sort.hpp

    - + Requirements

    @@ -129,7 +129,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partition.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partition.html index 4136a2a..50b7b16 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partition.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partition.html @@ -3,7 +3,7 @@ Range Algorithm - partition - + @@ -28,7 +28,7 @@ Range Algorithm - partition

    - + Prototype

    @@ -67,7 +67,7 @@

    - + Description

    @@ -81,14 +81,14 @@ corresponds to the middle iterator.

    - + Definition

    Defined in the header file boost/range/algorithm/partition.hpp

    - + Requirements
      @@ -108,7 +108,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/random_shuffle.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/random_shuffle.html index 190f66f..023d799 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/random_shuffle.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/random_shuffle.html @@ -3,7 +3,7 @@ Range Algorithm - random_shuffle - + @@ -28,7 +28,7 @@ Range Algorithm - random_shuffle

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -61,14 +61,14 @@ the shuffles range.

    - + Definition

    Defined in the header file boost/range/algorithm/random_shuffle.hpp

    - + Requirements

    @@ -99,7 +99,7 @@

    - + Precondition:
    • @@ -108,7 +108,7 @@ maximum value.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove.html index 4cb906c..65ab605 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove.html @@ -3,7 +3,7 @@ Range Algorithm - remove - + @@ -28,7 +28,7 @@ Range Algorithm - remove

    - + Prototype

    @@ -67,7 +67,7 @@

    - + Description

    @@ -84,14 +84,14 @@ are dereferenceable, but the elements are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove.hpp

    - + Requirements
      @@ -114,7 +114,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove_if.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove_if.html index 9896adc..227aeb0 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove_if.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove_if.html @@ -3,7 +3,7 @@ Range Algorithm - remove_if - + @@ -28,7 +28,7 @@ Range Algorithm - remove_if

    - + Prototype

    @@ -67,7 +67,7 @@

    - + Description

    @@ -83,14 +83,14 @@ are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_if.hpp

    - + Requirements
      @@ -113,7 +113,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace.html index ab4232d..e07aebb 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace.html @@ -3,7 +3,7 @@ Range Algorithm - replace - + @@ -28,7 +28,7 @@ Range Algorithm - replace

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -58,14 +58,14 @@ Return a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace.hpp

    - + Requirements
      @@ -94,7 +94,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace_if.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace_if.html index 7677651..fcf01b9 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace_if.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace_if.html @@ -3,7 +3,7 @@ Range Algorithm - replace_if - + @@ -28,7 +28,7 @@ Range Algorithm - replace_if

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_if.hpp

    - + Requirements
      @@ -91,7 +91,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/rotate.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/rotate.html index 55faad4..e4c574f 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/rotate.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/rotate.html @@ -3,7 +3,7 @@ Range Algorithm - rotate - + @@ -28,7 +28,7 @@ Range Algorithm - rotate

    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -54,14 +54,14 @@ and [middle, end(rng)). Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/rotate.hpp

    - + Requirements
      @@ -75,7 +75,7 @@
    - + Precondition:
      @@ -87,7 +87,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/sort.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/sort.html index 290f8e7..31adcdf 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/sort.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/sort.html @@ -3,7 +3,7 @@ Range Algorithm - sort - + @@ -28,7 +28,7 @@ Range Algorithm - sort

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ [x,y], pred(y, x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/sort.hpp

    - + Requirements

    @@ -130,7 +130,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_partition.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_partition.html index eb0032a..a549bc5 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_partition.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_partition.html @@ -3,7 +3,7 @@ Range Algorithm - stable_partition - + @@ -28,7 +28,7 @@ Range Algorithm - stable_partition

    - + Prototype

    @@ -61,7 +61,7 @@

    - + Description

    @@ -83,14 +83,14 @@ the iterator to the first element that fails to satisfy pred.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_partition.hpp

    - + Requirements
      @@ -108,7 +108,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_sort.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_sort.html index 984024d..e02cfa3 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_sort.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_sort.html @@ -3,7 +3,7 @@ Range Algorithm - stable_sort - + @@ -28,7 +28,7 @@ Range Algorithm - stable_sort

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ [x,y], pred(y,x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_sort.hpp

    - + Requirements

    @@ -130,7 +130,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/transform.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/transform.html index 58da4ca..82c53ea 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/transform.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/transform.html @@ -3,7 +3,7 @@ Range Algorithm - transform - + @@ -28,7 +28,7 @@ Range Algorithm - transform

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -93,14 +93,14 @@ The return value is out + min(distance(rng1), distance(rng2)).

    - + Definition

    Defined in the header file boost/range/algorithm/transform.hpp

    - + Requirements

    @@ -170,7 +170,7 @@

    - + Precondition:

    @@ -202,7 +202,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/unique.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/unique.html index aaa5525..13f388f 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/unique.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/unique.html @@ -3,7 +3,7 @@ Range Algorithm - unique - + @@ -28,7 +28,7 @@ Range Algorithm - unique

    - + Prototype

    @@ -69,7 +69,7 @@

    - + Description

    @@ -87,14 +87,14 @@ type.

    - + Definition

    Defined in the header file boost/range/algorithm/unique.hpp

    - + Requirements

    @@ -138,7 +138,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms.html index 7b34570..7976d61 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms.html @@ -3,7 +3,7 @@ New algorithms - + @@ -34,6 +34,8 @@ for_each

    insert
    +
    + iota
    overwrite
    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/erase.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/erase.html index 3520dba..e3d64a6 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/erase.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/erase.html @@ -3,7 +3,7 @@ erase - + @@ -28,7 +28,7 @@ erase
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,14 +53,14 @@ target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. @@ -68,7 +68,7 @@ erase of an iterator range.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/for_each.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/for_each.html index 4a1cb75..dfe62c3 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/for_each.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/for_each.html @@ -3,7 +3,7 @@ for_each - + @@ -28,7 +28,7 @@ for_each

    - + Prototype

    @@ -73,7 +73,7 @@

    - + Description

    @@ -89,14 +89,14 @@ It is safe to call this function with unequal length ranges.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/for_each.hpp

    - + Requirements
      @@ -126,7 +126,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/insert.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/insert.html index fc06253..e0aa512 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/insert.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/insert.html @@ -3,11 +3,11 @@ insert - + - + @@ -20,7 +20,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    @@ -28,7 +28,7 @@ insert
    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -55,14 +55,14 @@ target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/insert.hpp

    - + Requirements
      @@ -82,7 +82,7 @@
    - + Complexity

    @@ -100,7 +100,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/iota.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/iota.html new file mode 100644 index 0000000..c36f96d --- /dev/null +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/iota.html @@ -0,0 +1,96 @@ + + + +iota + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +
    + + Prototype +
    +

    + +

    +
    template<class SinglePassRange, class Value>
    +iota(SinglePassRange& rng, Value x);
    +
    +

    +

    +
    + + Description +
    +

    + iota traverses forward + through rng, each element + y in rng + is assigned a value equivalent to x + + boost::distance(boost::begin(rng), it) +

    +
    + + Definition +
    +

    + Defined in the header file boost/range/algorithm_ext/iota.hpp +

    +
    + + Requirements +
    +
      +
    1. +SinglePassRange is + a model of the Single + Pass Range Concept. +
    2. +
    3. +Value is a model of + the Incrementable Concept. +
    4. +
    +
    + + Complexity +
    +

    + Linear. Exactly distance(rng) assignments into rng. +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html index b856c39..189151b 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html @@ -3,10 +3,10 @@ overwrite - + - + @@ -20,7 +20,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    @@ -28,7 +28,7 @@ overwrite
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,14 +53,14 @@ into the range to.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/overwrite.hpp

    - + Requirements
      @@ -87,7 +87,7 @@
    - + Complexity

    @@ -105,7 +105,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_back.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_back.html index 26741e2..1357275 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_back.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_back.html @@ -3,7 +3,7 @@ push_back - + @@ -28,7 +28,7 @@ push_back
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,14 +53,14 @@ to the back of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_back.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_front.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_front.html index 4afd63c..d91db73 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_front.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_front.html @@ -3,7 +3,7 @@ push_front - + @@ -28,7 +28,7 @@ push_front

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,14 +53,14 @@ to the front of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_front.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase.html index f80666a..5963cab 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase.html @@ -3,7 +3,7 @@ remove_erase - + @@ -28,7 +28,7 @@ remove_erase

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -54,14 +54,14 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. @@ -69,7 +69,7 @@ erase of an iterator range.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase_if.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase_if.html index 0f4c190..4469f02 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase_if.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase_if.html @@ -3,7 +3,7 @@ remove_erase_if - + @@ -28,7 +28,7 @@ remove_erase_if

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -55,14 +55,14 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
      @@ -76,7 +76,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms.html index 87820b8..2e8a2d1 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms.html @@ -3,7 +3,7 @@ Non-mutating algorithms - + diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/adjacent_find.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/adjacent_find.html index e45a101..d14634a 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/adjacent_find.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/adjacent_find.html @@ -3,7 +3,7 @@ Range Algorithm - adjacent_find - + @@ -28,7 +28,7 @@ Range Algorithm - adjacent_find

    - + Prototype

    @@ -77,7 +77,7 @@

    - + Description

    @@ -98,14 +98,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/adjacent_find.hpp

    - + Requirements

    @@ -143,7 +143,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/binary_search.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/binary_search.html index 247d8bc..e87ccbe 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/binary_search.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/binary_search.html @@ -3,7 +3,7 @@ binary_search - + @@ -28,7 +28,7 @@ binary_search

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -53,14 +53,14 @@ range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/binary_search.hpp

    - + Requirements

    @@ -111,7 +111,7 @@

    - + Precondition:

    @@ -129,7 +129,7 @@ order according to the function object pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/count.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/count.html index bdfc489..3e36aa5 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/count.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/count.html @@ -3,7 +3,7 @@ count - + @@ -28,7 +28,7 @@ count

    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -55,14 +55,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/count.hpp

    - + Requirements
      @@ -85,7 +85,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal.html index d6d54a1..bb6187c 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal.html @@ -3,7 +3,7 @@ equal - + @@ -28,7 +28,7 @@ equal

    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -71,14 +71,14 @@ considered equal in the predicate version if pred(x,y) is true.

    - + Definition

    Defined in the header file boost/range/algorithm/equal.hpp

    - + Requirements

    @@ -139,7 +139,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal_range.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal_range.html index 94bd133..8ba9948 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal_range.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal_range.html @@ -3,7 +3,7 @@ equal_range - + @@ -28,7 +28,7 @@ equal_range

    - + Prototype

    @@ -71,7 +71,7 @@

    - + Description

    @@ -85,14 +85,14 @@ is determined by pred.

    - + Definition

    Defined in the header file boost/range/algorithm/equal_range.hpp

    - + Requirements

    @@ -143,7 +143,7 @@

    - + Precondition:

    @@ -155,7 +155,7 @@ is ordered in ascending order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find.html index 3e45381..05db375 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find.html @@ -3,7 +3,7 @@ find - + @@ -28,7 +28,7 @@ find

    - + Prototype

    @@ -38,10 +38,6 @@ typename range_iterator<SinglePassRange>::type find(SinglePassRange& rng, Value val); -template<class SinglePassRange, class Value> -typename range_iterator<const SinglePassRange>::type -find(const SinglePassRange& rng, Value val); - template< range_return_value re, class SinglePassRange, @@ -49,19 +45,11 @@ > typename range_return<SinglePassRange, re>::type find(SinglePassRange& rng, Value val); - -template< - range_return_value re, - class SinglePassRange, - class Value - > -typename range_return<const SinglePassRange, re>::type -find(const SinglePassRange& rng, Value val);

    - + Description

    @@ -72,14 +60,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find.hpp

    - + Requirements
      @@ -100,7 +88,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_end.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_end.html index 9412d18..b5ab6b0 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_end.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_end.html @@ -3,7 +3,7 @@ find_end - + @@ -28,7 +28,7 @@ find_end

    - + Prototype

    @@ -38,10 +38,6 @@ typename range_iterator<ForwardRange1>::type find_end(ForwardRange1& rng1, const ForwardRange2& rng2); -template<class ForwardRange1, class ForwardRange2> -typename range_iterator<const ForwardRange1>::type -find_end(const ForwardRange1& rng1, const ForwardRange2& rng2); - template< class ForwardRange1, class ForwardRange2, @@ -50,15 +46,6 @@ typename range_iterator<ForwardRange1>::type find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred); -template< - class ForwardRange1, - class ForwardRange2, - class BinaryPredicate - > -typename range_iterator<const ForwardRange1>::type -find_end(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred); - - template< range_return_value re, class ForwardRange1, @@ -67,14 +54,6 @@ typename range_return<ForwardRange1, re>::type find_end(ForwardRange1& rng1, const ForwardRange2& rng2); -template< - range_return_value re, - class ForwardRange1, - class ForwardRange2 - > -typename range_return<const ForwardRange1, re>::type -find_end(const ForwardRange1& rng1, const ForwardRange2& rng2); - template< range_return_value re, class ForwardRange1, @@ -83,20 +62,11 @@ > typename range_return<ForwardRange1, re>::type find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred); - -template< - range_return_value re, - class ForwardRange1, - class ForwardRange2, - class BinaryPredicate - > -typename range_return<const ForwardRange1, re>::type -find_end(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);

    - + Description

    @@ -111,14 +81,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_end.hpp

    - + Requirements

    @@ -178,7 +148,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_first_of.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_first_of.html index 5f15b42..a8de6a4 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_first_of.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_first_of.html @@ -3,7 +3,7 @@ find_first_of - + @@ -28,7 +28,7 @@ find_first_of

    - + Prototype

    @@ -38,10 +38,6 @@ typename range_iterator<SinglePassRange1>::type find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2); -template<class SinglePassRange1, class ForwardRange2> -typename range_iterator<const SinglePassRange1>::type -find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2); - template< class SinglePassRange1, class ForwardRange2, @@ -50,15 +46,6 @@ typename range_iterator<SinglePassRange1>::type find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred); -template< - class SinglePassRange1, - class ForwardRange2, - class BinaryPredicate - > -typename range_iterator<const SinglePassRange1>::type -find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred); - - template< range_return_value re, class SinglePassRange1, @@ -67,14 +54,6 @@ typename range_return<SinglePassRange1, re>::type find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2); -template< - range_return_value re, - class SinglePassRange1, - class ForwardRange2 - > -typename range_return<const SinglePassRange1, re>::type -find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2); - template< range_return_value re, class SinglePassRange1, @@ -83,20 +62,11 @@ > typename range_return<SinglePassRange1, re>::type find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred); - -template< - range_return_value re, - class SinglePassRange1, - class ForwardRange2, - class BinaryPredicate - > -typename range_return<const SinglePassRange1, re>::type -find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);

    - + Description

    @@ -116,14 +86,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_first_of.hpp

    - + Requirements

    @@ -177,7 +147,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_if.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_if.html index 424b833..07df166 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_if.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_if.html @@ -3,7 +3,7 @@ find_if - + @@ -28,7 +28,7 @@ find_if

    - + Prototype

    @@ -38,10 +38,6 @@ typename range_iterator<SinglePassRange>::type find_if(SinglePassRange& rng, UnaryPredicate pred); -template<class SinglePassRange, class UnaryPredicate> -typename range_iterator<const SinglePassRange>::type -find_if(const SinglePassRange& rng, UnaryPredicate pred); - template< range_return_value re, class SinglePassRange, @@ -49,19 +45,11 @@ > typename range_return<SinglePassRange, re>::type find_if(SinglePassRange& rng, UnaryPredicate pred); - -template< - range_return_value re, - class SinglePassRange, - class UnaryPredicate - > -typename range_return<const SinglePassRange, re>::type -find_if(const SinglePassRange& rng, UnaryPredicate pred);

    - + Description

    @@ -76,14 +64,14 @@ defines found in the same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_if.hpp

    - + Requirements
      @@ -102,7 +90,7 @@
    - + Precondition:

    @@ -110,7 +98,7 @@ rng, *i is in the domain of UnaryPredicate.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/for_each.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/for_each.html index 3c85cc0..f90bdc6 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/for_each.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/for_each.html @@ -3,7 +3,7 @@ for_each - + @@ -28,7 +28,7 @@ for_each

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -59,14 +59,14 @@ fun(x).

    - + Definition

    Defined in the header file boost/range/algorithm/for_each.hpp

    - + Requirements
      @@ -90,7 +90,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lexicographical_compare.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lexicographical_compare.html index 0cf9505..d10629d 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lexicographical_compare.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lexicographical_compare.html @@ -3,7 +3,7 @@ lexicographical_compare - + @@ -28,7 +28,7 @@ lexicographical_compare

    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -73,14 +73,14 @@ predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/lexicographical_compare.hpp

    - + Requirements

    @@ -145,7 +145,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lower_bound.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lower_bound.html index 4e1f526..3eaa4e3 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lower_bound.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lower_bound.html @@ -3,7 +3,7 @@ lower_bound - + @@ -28,7 +28,7 @@ lower_bound

    - + Prototype

    @@ -38,10 +38,6 @@ typename range_iterator<ForwardRange>::type lower_bound(ForwardRange& rng, Value val); -template<class ForwardRange, class Value> -typename range_iterator<const ForwardRange>::type -lower_bound(const ForwardRange& rng, Value val); - template< range_return_value re, class ForwardRange, @@ -49,19 +45,11 @@ > typename range_return<ForwardRange, re>::type lower_bound(ForwardRange& rng, Value val); - -template< - range_return_value re, - class ForwardRange, - class Value - > -typename range_return<const ForwardRange, re>::type -lower_bound(const ForwardRange& rng, Value val);

    - + Description

    @@ -84,14 +72,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/lower_bound.hpp

    - + Requirements

    @@ -142,7 +130,7 @@

    - + Precondition:

    @@ -160,7 +148,7 @@ order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/max_element.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/max_element.html index 8ca03f7..552d3af 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/max_element.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/max_element.html @@ -3,7 +3,7 @@ max_element - + @@ -28,7 +28,7 @@ max_element

    - + Prototype

    @@ -84,7 +84,7 @@

    - + Description

    @@ -98,14 +98,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/max_element.hpp

    - + Requirements

    @@ -142,7 +142,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/min_element.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/min_element.html index 08903d1..675196b 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/min_element.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/min_element.html @@ -3,7 +3,7 @@ min_element - + @@ -28,7 +28,7 @@ min_element

    - + Prototype

    @@ -84,7 +84,7 @@

    - + Description

    @@ -98,14 +98,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/min_element.hpp

    - + Requirements

    @@ -142,7 +142,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/mismatch.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/mismatch.html index 5a168da..572dd69 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/mismatch.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/mismatch.html @@ -3,7 +3,7 @@ mismatch - + @@ -28,7 +28,7 @@ mismatch

    - + Prototype

    @@ -106,7 +106,7 @@

    - + Description

    @@ -124,14 +124,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/mismatch.hpp

    - + Requirements

    @@ -192,14 +192,14 @@

    - + Precondition:

    distance(rng2) >= distance(rng1)

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/search.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/search.html index 1dcf8c0..03b528c 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/search.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/search.html @@ -3,7 +3,7 @@ search - + @@ -28,7 +28,7 @@ search

    - + Prototype

    @@ -96,7 +96,7 @@

    - + Description

    @@ -115,14 +115,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/search.hpp

    - + Requirements

    @@ -183,7 +183,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/upper_bound.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/upper_bound.html index 8db1558..e73149f 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/upper_bound.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/upper_bound.html @@ -3,7 +3,7 @@ upper_bound - + @@ -28,7 +28,7 @@ upper_bound

    - + Prototype

    @@ -38,10 +38,6 @@ typename range_iterator<ForwardRange>::type upper_bound(ForwardRange& rng, Value val); -template<class ForwardRange, class Value> -typename range_iterator<const ForwardRange>::type -upper_bound(const ForwardRange& rng, Value val); - template< range_return_value re, class ForwardRange, @@ -49,19 +45,11 @@ > typename range_return<ForwardRange, re>::type upper_bound(ForwardRange& rng, Value val); - -template< - range_return_value re, - class ForwardRange, - class Value - > -typename range_return<const ForwardRange, re>::type -upper_bound(const ForwardRange& rng, Value val);

    - + Description

    @@ -83,14 +71,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/upper_bound.hpp

    - + Requirements

    @@ -141,7 +129,7 @@

    - + Precondition:

    @@ -159,7 +147,7 @@ order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_numeric.html b/doc/html/range/reference/algorithms/range_numeric.html index c6c6767..9da4d83 100644 --- a/doc/html/range/reference/algorithms/range_numeric.html +++ b/doc/html/range/reference/algorithms/range_numeric.html @@ -3,7 +3,7 @@ Numeric algorithms - + diff --git a/doc/html/range/reference/algorithms/range_numeric/accumulate.html b/doc/html/range/reference/algorithms/range_numeric/accumulate.html index 448b1fa..9351f90 100644 --- a/doc/html/range/reference/algorithms/range_numeric/accumulate.html +++ b/doc/html/range/reference/algorithms/range_numeric/accumulate.html @@ -3,7 +3,7 @@ accumulate - + @@ -28,7 +28,7 @@ accumulate

    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -64,18 +64,18 @@ The return value is the resultant value of the above algorithm.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -100,7 +100,7 @@
    - + For the second version
    @@ -134,7 +134,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_numeric/adjacent_difference.html b/doc/html/range/reference/algorithms/range_numeric/adjacent_difference.html index 8c76593..6680e82 100644 --- a/doc/html/range/reference/algorithms/range_numeric/adjacent_difference.html +++ b/doc/html/range/reference/algorithms/range_numeric/adjacent_difference.html @@ -3,7 +3,7 @@ adjacent_difference - + @@ -28,7 +28,7 @@ adjacent_difference

    - + Prototype

    @@ -55,7 +55,7 @@

    - + Description

    @@ -69,18 +69,18 @@ instead of operator-().

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -111,7 +111,7 @@
    - + For the second version
    @@ -146,7 +146,7 @@
    - + Precondition:

    @@ -154,7 +154,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_numeric/inner_product.html b/doc/html/range/reference/algorithms/range_numeric/inner_product.html index 6d48b14..d2591e2 100644 --- a/doc/html/range/reference/algorithms/range_numeric/inner_product.html +++ b/doc/html/range/reference/algorithms/range_numeric/inner_product.html @@ -3,7 +3,7 @@ inner_product - + @@ -28,7 +28,7 @@ inner_product

    - + Prototype

    @@ -54,7 +54,7 @@

    - + Description

    @@ -67,18 +67,18 @@ algorithm please see inner_product.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -113,7 +113,7 @@
    - + For the second version
    @@ -162,14 +162,14 @@
    - + Precondition:

    distance(rng2) >= distance(rng1) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_numeric/partial_sum.html b/doc/html/range/reference/algorithms/range_numeric/partial_sum.html index b89e58e..b1aa0bf 100644 --- a/doc/html/range/reference/algorithms/range_numeric/partial_sum.html +++ b/doc/html/range/reference/algorithms/range_numeric/partial_sum.html @@ -3,7 +3,7 @@ partial_sum - + @@ -28,7 +28,7 @@ partial_sum

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -58,18 +58,18 @@ in the same manner as std::partial_sum(boost::begin(rng), boost::end(rng), out_it). See partial_sum.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -99,7 +99,7 @@
    - + For the second version
    @@ -128,7 +128,7 @@
    - + Precondition:

    @@ -136,7 +136,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms.html b/doc/html/range/reference/algorithms/set_algorithms.html index b9888f5..447b470 100644 --- a/doc/html/range/reference/algorithms/set_algorithms.html +++ b/doc/html/range/reference/algorithms/set_algorithms.html @@ -3,7 +3,7 @@ Set algorithms - + diff --git a/doc/html/range/reference/algorithms/set_algorithms/includes.html b/doc/html/range/reference/algorithms/set_algorithms/includes.html index 015474a..b8fabe5 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/includes.html +++ b/doc/html/range/reference/algorithms/set_algorithms/includes.html @@ -3,7 +3,7 @@ includes - + @@ -28,7 +28,7 @@ includes

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -60,14 +60,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -145,7 +145,7 @@

    - + Precondition:

    @@ -163,7 +163,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms/set_difference.html b/doc/html/range/reference/algorithms/set_algorithms/set_difference.html index 58d8a54..95531ed 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/set_difference.html +++ b/doc/html/range/reference/algorithms/set_algorithms/set_difference.html @@ -3,7 +3,7 @@ set_difference - + @@ -28,7 +28,7 @@ set_difference

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -71,14 +71,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -164,7 +164,7 @@

    - + Precondition:

    @@ -182,7 +182,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms/set_intersection.html b/doc/html/range/reference/algorithms/set_algorithms/set_intersection.html index 65840cd..7367d86 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/set_intersection.html +++ b/doc/html/range/reference/algorithms/set_algorithms/set_intersection.html @@ -3,7 +3,7 @@ set_intersection - + @@ -28,7 +28,7 @@ set_intersection

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -71,14 +71,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -164,7 +164,7 @@

    - + Precondition:

    @@ -182,7 +182,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms/set_symmetric_difference.html b/doc/html/range/reference/algorithms/set_algorithms/set_symmetric_difference.html index a25e8e4..52b58b7 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/set_symmetric_difference.html +++ b/doc/html/range/reference/algorithms/set_algorithms/set_symmetric_difference.html @@ -3,7 +3,7 @@ set_symmetric_difference - + @@ -28,7 +28,7 @@ set_symmetric_difference

    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -75,14 +75,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -168,7 +168,7 @@

    - + Precondition:

    @@ -186,7 +186,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms/set_union.html b/doc/html/range/reference/algorithms/set_algorithms/set_union.html index 90c343c..3a8abe3 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/set_union.html +++ b/doc/html/range/reference/algorithms/set_algorithms/set_union.html @@ -3,7 +3,7 @@ set_union - + @@ -28,7 +28,7 @@ set_union

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -70,14 +70,14 @@ in the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -163,7 +163,7 @@

    - + Precondition:

    @@ -181,7 +181,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/extending.html b/doc/html/range/reference/extending.html index fc32e83..37f4882 100644 --- a/doc/html/range/reference/extending.html +++ b/doc/html/range/reference/extending.html @@ -3,7 +3,7 @@ Extending the library - + diff --git a/doc/html/range/reference/extending/method_1.html b/doc/html/range/reference/extending/method_1.html index 3283d10..d9f66a7 100644 --- a/doc/html/range/reference/extending/method_1.html +++ b/doc/html/range/reference/extending/method_1.html @@ -3,7 +3,7 @@ Method 1: provide member functions and nested types - + @@ -34,7 +34,7 @@

    The primary templates in this library are implemented such that standard - containers will work automatically and so will boost::array. + containers will work automatically and so will boost::array. Below is given an overview of which member functions and member types a class must specify to be useable as a certain Range concept.

    diff --git a/doc/html/range/reference/extending/method_2.html b/doc/html/range/reference/extending/method_2.html index f4f3524..eae4cbd 100644 --- a/doc/html/range/reference/extending/method_2.html +++ b/doc/html/range/reference/extending/method_2.html @@ -3,7 +3,7 @@ Method 2: provide free-standing functions and specialize metafunctions - + diff --git a/doc/html/range/reference/extending/method_3.html b/doc/html/range/reference/extending/method_3.html index f841237..3594ff8 100644 --- a/doc/html/range/reference/extending/method_3.html +++ b/doc/html/range/reference/extending/method_3.html @@ -3,7 +3,7 @@ Method 3: provide range adaptor implementations - + diff --git a/doc/html/range/reference/extending/method_3/method_3_1.html b/doc/html/range/reference/extending/method_3/method_3_1.html index e995bee..9370d65 100644 --- a/doc/html/range/reference/extending/method_3/method_3_1.html +++ b/doc/html/range/reference/extending/method_3/method_3_1.html @@ -3,7 +3,7 @@ Method 3.1: Implement a Range Adaptor without arguments - + diff --git a/doc/html/range/reference/extending/method_3/method_3_2.html b/doc/html/range/reference/extending/method_3/method_3_2.html index f0bae90..f153d0e 100644 --- a/doc/html/range/reference/extending/method_3/method_3_2.html +++ b/doc/html/range/reference/extending/method_3/method_3_2.html @@ -3,7 +3,7 @@ Method 3.2: Implement a Range Adaptor with arguments - + diff --git a/doc/html/range/reference/overview.html b/doc/html/range/reference/overview.html index ae0bbf0..8db874f 100644 --- a/doc/html/range/reference/overview.html +++ b/doc/html/range/reference/overview.html @@ -3,7 +3,7 @@ Overview - + diff --git a/doc/html/range/reference/ranges.html b/doc/html/range/reference/ranges.html index 2e16372..6e4ad0a 100644 --- a/doc/html/range/reference/ranges.html +++ b/doc/html/range/reference/ranges.html @@ -3,7 +3,7 @@ Provided Ranges - + diff --git a/doc/html/range/reference/ranges/counting_range.html b/doc/html/range/reference/ranges/counting_range.html index b556488..e2ccb2c 100644 --- a/doc/html/range/reference/ranges/counting_range.html +++ b/doc/html/range/reference/ranges/counting_range.html @@ -3,7 +3,7 @@ counting_range - + @@ -27,7 +27,7 @@ counting_range
    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -58,14 +58,14 @@ (from Boost.Iterator).

    - + Definition

    Defined in header file boost/range/counting_range.hpp

    - + Requirements
    1. diff --git a/doc/html/range/reference/ranges/irange.html b/doc/html/range/reference/ranges/irange.html index f4565c0..cd481f0 100644 --- a/doc/html/range/reference/ranges/irange.html +++ b/doc/html/range/reference/ranges/irange.html @@ -3,7 +3,7 @@ irange - + @@ -27,7 +27,7 @@ irange
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -58,14 +58,14 @@ parameters denoted a half-open range.

    - + Definition

    Defined in the header file boost/range/irange.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/ranges/istream_range.html b/doc/html/range/reference/ranges/istream_range.html index e7d81d8..063204d 100644 --- a/doc/html/range/reference/ranges/istream_range.html +++ b/doc/html/range/reference/ranges/istream_range.html @@ -3,7 +3,7 @@ istream_range - + @@ -27,7 +27,7 @@ istream_range

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -49,7 +49,7 @@ wrapping a std::istream_iterator.

    - + Definition

    diff --git a/doc/html/range/reference/semantics.html b/doc/html/range/reference/semantics.html index fbb1aa8..4fa0645 100644 --- a/doc/html/range/reference/semantics.html +++ b/doc/html/range/reference/semantics.html @@ -3,7 +3,7 @@ Semantics - + @@ -31,7 +31,7 @@

    Functions
    - + notation
    diff --git a/doc/html/range/reference/semantics/functions.html b/doc/html/range/reference/semantics/functions.html index 232b680..16bb7fb 100644 --- a/doc/html/range/reference/semantics/functions.html +++ b/doc/html/range/reference/semantics/functions.html @@ -3,7 +3,7 @@ Functions - + diff --git a/doc/html/range/reference/semantics/metafunctions.html b/doc/html/range/reference/semantics/metafunctions.html index 6df4902..cc2f4bd 100644 --- a/doc/html/range/reference/semantics/metafunctions.html +++ b/doc/html/range/reference/semantics/metafunctions.html @@ -3,7 +3,7 @@ Metafunctions - + diff --git a/doc/html/range/reference/synopsis.html b/doc/html/range/reference/synopsis.html index 248e8c1..c950490 100644 --- a/doc/html/range/reference/synopsis.html +++ b/doc/html/range/reference/synopsis.html @@ -3,7 +3,7 @@ Synopsis - + diff --git a/doc/html/range/style_guide.html b/doc/html/range/style_guide.html index f064884..48043c4 100644 --- a/doc/html/range/style_guide.html +++ b/doc/html/range/style_guide.html @@ -3,7 +3,7 @@ Terminology and style guidelines - + @@ -66,7 +66,7 @@

    - Notice how we have used the categories from the new + Notice how we have used the categories from the new style iterators.

    diff --git a/doc/html/range/upgrade.html b/doc/html/range/upgrade.html index ad53c37..27ddd2b 100644 --- a/doc/html/range/upgrade.html +++ b/doc/html/range/upgrade.html @@ -3,7 +3,7 @@ Upgrade version of Boost.Range - + diff --git a/doc/html/range/upgrade/upgrade_from_1_34.html b/doc/html/range/upgrade/upgrade_from_1_34.html index dfc4c52..587555c 100644 --- a/doc/html/range/upgrade/upgrade_from_1_34.html +++ b/doc/html/range/upgrade/upgrade_from_1_34.html @@ -3,7 +3,7 @@ Upgrade from version 1.34 - + diff --git a/doc/html/range/upgrade/upgrade_from_1_42.html b/doc/html/range/upgrade/upgrade_from_1_42.html index 3fbc2d2..74059e4 100644 --- a/doc/html/range/upgrade/upgrade_from_1_42.html +++ b/doc/html/range/upgrade/upgrade_from_1_42.html @@ -3,7 +3,7 @@ Upgrade from version 1.42 - + diff --git a/doc/html/range/utilities.html b/doc/html/range/utilities.html index d9caa5f..0ccd47c 100644 --- a/doc/html/range/utilities.html +++ b/doc/html/range/utilities.html @@ -3,7 +3,7 @@ Utilities - + @@ -52,7 +52,7 @@

    The iterator_range class is - templated on an Forward + templated on an Forward Traversal Iterator and should be used whenever fairly general code is needed. The sub_range class is templated on an Forward Range diff --git a/doc/html/range/utilities/iterator_range.html b/doc/html/range/utilities/iterator_range.html index 07efc15..7956363 100644 --- a/doc/html/range/utilities/iterator_range.html +++ b/doc/html/range/utilities/iterator_range.html @@ -3,7 +3,7 @@ Class iterator_range - + @@ -32,7 +32,7 @@ Range concept. A few other functions are also provided for convenience.

    - If the template argument is not a model of Forward + If the template argument is not a model of Forward Traversal Iterator, one can still use a subset of the interface. In particular, size() requires Random Access Traversal Iterators whereas empty() only requires Single Pass Iterators. @@ -47,7 +47,7 @@ limitation is simply propogated from the underlying iterator type.

    - + Synopsis

    @@ -187,7 +187,7 @@ iterators from the same container.

    - + Details member functions
    @@ -218,7 +218,7 @@

    - + Details functions
    diff --git a/doc/html/range/utilities/join.html b/doc/html/range/utilities/join.html index c2c9e15..d430946 100644 --- a/doc/html/range/utilities/join.html +++ b/doc/html/range/utilities/join.html @@ -3,7 +3,7 @@ Function join - + @@ -39,7 +39,7 @@ if the end of a range has been reached internally during traversal.

    - + Synposis

    @@ -65,7 +65,7 @@

    - + Example

    diff --git a/doc/html/range/utilities/sub_range.html b/doc/html/range/utilities/sub_range.html index 0b474d7..517639f 100644 --- a/doc/html/range/utilities/sub_range.html +++ b/doc/html/range/utilities/sub_range.html @@ -3,7 +3,7 @@ Class sub_range - + @@ -35,7 +35,7 @@ is.

    - + Synopsis

    diff --git a/doc/reference/algorithm_ext/iota.qbk b/doc/reference/algorithm_ext/iota.qbk index 37aba15..c098708 100644 --- a/doc/reference/algorithm_ext/iota.qbk +++ b/doc/reference/algorithm_ext/iota.qbk @@ -1,4 +1,4 @@ -[section:for_each for_each] +[section:iota iota] [heading Prototype] diff --git a/include/boost/range/adaptor/adjacent_filtered.hpp b/include/boost/range/adaptor/adjacent_filtered.hpp index 4f0bb75..5f66711 100644 --- a/include/boost/range/adaptor/adjacent_filtered.hpp +++ b/include/boost/range/adaptor/adjacent_filtered.hpp @@ -30,94 +30,58 @@ namespace boost namespace range_detail { - template< class Iter, class R > + template< class Iter, class Pred, bool default_pass > class skip_iterator - : public boost::iterator_adaptor< skip_iterator, Iter > + : public boost::iterator_adaptor< + skip_iterator, + Iter, + BOOST_DEDUCED_TYPENAME std::iterator_traits::value_type, + boost::forward_traversal_tag, + BOOST_DEDUCED_TYPENAME std::iterator_traits::reference, + BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type + > + , private Pred { private: - typedef boost::iterator_adaptor< skip_iterator, Iter > - base_t; - - R* range; + typedef boost::iterator_adaptor< + skip_iterator, + Iter, + BOOST_DEDUCED_TYPENAME std::iterator_traits::value_type, + boost::forward_traversal_tag, + BOOST_DEDUCED_TYPENAME std::iterator_traits::reference, + BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type + > base_t; public: - typedef Iter wrapped_iter_t; + typedef Pred pred_t; + typedef Iter iter_t; - // - // The iterators are bound to the lifetime of the - // range and may not exist on their own. Hence it makes no - // sense to e.g. wrap them in reverse_iterators - // (that can OTOH be done in advance). - // - typedef std::input_iterator_tag iterator_category; + skip_iterator() : m_last() {} - explicit skip_iterator( R* r, Iter i ) - : base_t(i), range(r) {} - - template< class OtherIter, class R2> - skip_iterator( const skip_iterator& other ) - : base_t( other.base() ) {} - - R* get_range() const { return range; } - - private: - friend class boost::iterator_core_access; - - void increment() - { - BOOST_ASSERT( range != 0 ); - range->increment_impl( this->base_reference() ); - } - - // - // Not needed ... just apply a reverse_iterator - // - void decrement() + skip_iterator(iter_t it, iter_t last, const Pred& pred) + : base_t(it) + , pred_t(pred) + , m_last(last) { - BOOST_ASSERT( false && "you can't decrement an adjacent_filter_iterator" ); + move_to_next_valid(); } - template< class D > - void advance( D n ) - { - BOOST_ASSERT( false ); - } + template + skip_iterator( const skip_iterator& other ) + : base_t(other.base()) + , pred_t(other) + , m_last(other.m_last) {} - }; - - template< class P, class R > - struct adjacent_filter_range - : iterator_range< skip_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - adjacent_filter_range - > - > - { - private: - typedef skip_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - adjacent_filter_range - > - skip_iter; - typedef iterator_range - base_range; - - typedef BOOST_DEDUCED_TYPENAME range_iterator::type raw_iterator; - - P m_bi_pred; - - // Get the first element in the half-open range that - // passes the filter predicate. - // The adjacent_filter_range must only contain values that pass - // through the filter. - static raw_iterator to_valid(raw_iterator it, raw_iterator last, const P& bi_pred, bool default_pass) + void move_to_next_valid() { - if (it != last) + iter_t& it = this->base_reference(); + pred_t& bi_pred = *this; + if (it != m_last) { if (default_pass) { - raw_iterator nxt = ::boost::next(it); - while (nxt != last && !bi_pred(*it, *nxt)) + iter_t nxt = ::boost::next(it); + while (nxt != m_last && !bi_pred(*it, *nxt)) { ++it; ++nxt; @@ -125,41 +89,61 @@ namespace boost } else { - raw_iterator nxt = ::boost::next(it); - for(; nxt != last; ++it, ++nxt) + iter_t nxt = ::boost::next(it); + for(; nxt != m_last; ++it, ++nxt) { if (bi_pred(*it, *nxt)) { break; } } - if (nxt == last) + if (nxt == m_last) { - it = last; + it = m_last; } } } - return it; } + void increment() + { + iter_t& it = this->base_reference(); + BOOST_ASSERT( it != m_last ); + ++it; + move_to_next_valid(); + } + + iter_t m_last; + }; + + template< class P, class R, bool default_pass > + struct adjacent_filter_range + : iterator_range< skip_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + P, + default_pass + > + > + { + private: + typedef skip_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + P, + default_pass + > + skip_iter; + + typedef iterator_range + base_range; + + typedef BOOST_DEDUCED_TYPENAME range_iterator::type raw_iterator; + public: - adjacent_filter_range( const P& p, R& r, bool default_pass ) - : base_range( skip_iter( this, to_valid(boost::begin(r), boost::end(r), p, default_pass)), - skip_iter( this, boost::end(r) ) ), - m_bi_pred( p ), - m_default_pass(default_pass) + adjacent_filter_range( const P& p, R& r ) + : base_range( skip_iter( boost::begin(r), boost::end(r), p), + skip_iter( boost::end(r), boost::end(r), p) ) { } - - void increment_impl( raw_iterator& current ) - { - BOOST_ASSERT( current != this->end().base() ); - - current = to_valid(::boost::next(current), this->end().base(), m_bi_pred, m_default_pass); - } - - private: - bool m_default_pass; }; template< class T > @@ -177,37 +161,37 @@ namespace boost }; template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range + inline adjacent_filter_range operator|( ForwardRng& r, const adjacent_holder& f ) { - return adjacent_filter_range( f.val, r, true ); + return adjacent_filter_range( f.val, r ); } template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range + inline adjacent_filter_range operator|( const ForwardRng& r, const adjacent_holder& f ) { return adjacent_filter_range( f.val, r, true ); + const ForwardRng, true>( f.val, r ); } template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range + inline adjacent_filter_range operator|( ForwardRng& r, const adjacent_excl_holder& f ) { - return adjacent_filter_range( f.val, r, false ); + return adjacent_filter_range( f.val, r ); } template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range + inline adjacent_filter_range operator|( const ForwardRng& r, const adjacent_excl_holder& f ) { return adjacent_filter_range( f.val, r, false ); + const ForwardRng, false>( f.val, r ); } } // 'range_detail' @@ -231,17 +215,17 @@ namespace boost } template - inline adjacent_filter_range - adjacent_filter(ForwardRng& rng, BinPredicate filter_pred, bool default_pass = true) + inline adjacent_filter_range + adjacent_filter(ForwardRng& rng, BinPredicate filter_pred) { - return adjacent_filter_range(filter_pred, rng, default_pass); + return adjacent_filter_range(filter_pred, rng); } template - inline adjacent_filter_range - adjacent_filter(const ForwardRng& rng, BinPredicate filter_pred, bool default_pass = true) + inline adjacent_filter_range + adjacent_filter(const ForwardRng& rng, BinPredicate filter_pred) { - return adjacent_filter_range(filter_pred, rng, default_pass); + return adjacent_filter_range(filter_pred, rng); } } // 'adaptors' diff --git a/include/boost/range/adaptor/uniqued.hpp b/include/boost/range/adaptor/uniqued.hpp index 28a30f2..ddaf3fe 100755 --- a/include/boost/range/adaptor/uniqued.hpp +++ b/include/boost/range/adaptor/uniqued.hpp @@ -15,68 +15,68 @@ namespace boost { - + namespace range_detail { struct unique_forwarder { }; - + struct unique_not_equal_to { typedef bool result_type; - + template< class T > bool operator()( const T& l, const T& r ) const { return !(l == r); } }; - + template - class unique_range : public adjacent_filter_range + class unique_range : public adjacent_filter_range { - typedef adjacent_filter_range base; + typedef adjacent_filter_range base; public: explicit unique_range(ForwardRng& rng) - : base(unique_not_equal_to(), rng, true) + : base(unique_not_equal_to(), rng) { } }; - + template< class ForwardRng > - inline unique_range - operator|( ForwardRng& r, + inline unique_range + operator|( ForwardRng& r, unique_forwarder ) { return unique_range(r); } - + template< class ForwardRng > - inline unique_range - operator|( const ForwardRng& r, + inline unique_range + operator|( const ForwardRng& r, unique_forwarder ) { return unique_range(r); } - + } // 'range_detail' - + using range_detail::unique_range; - + namespace adaptors - { + { namespace { - const range_detail::unique_forwarder uniqued = + const range_detail::unique_forwarder uniqued = range_detail::unique_forwarder(); } - + template inline unique_range unique(ForwardRange& rng) { return unique_range(rng); } - + template inline unique_range unique(const ForwardRange& rng) @@ -84,7 +84,7 @@ namespace boost return unique_range(rng); } } // 'adaptors' - + } #endif diff --git a/include/boost/range/combine.hpp b/include/boost/range/combine.hpp index 31a540b..8b1be00 100755 --- a/include/boost/range/combine.hpp +++ b/include/boost/range/combine.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -14,40 +15,48 @@ namespace boost { - namespace detail + namespace range_detail { struct void_ { typedef void_ type; }; } - template<> struct range_iterator + template<> struct range_iterator< ::boost::range_detail::void_ > { - typedef tuples::null_type type; + typedef ::boost::tuples::null_type type; }; - namespace detail + namespace range_detail { - inline tuples::null_type range_begin( void_& ) - { return tuples::null_type(); } + inline ::boost::tuples::null_type range_begin( ::boost::range_detail::void_& ) + { return ::boost::tuples::null_type(); } - inline tuples::null_type range_end( void_& ) - { return tuples::null_type(); } + inline ::boost::tuples::null_type range_begin( const ::boost::range_detail::void_& ) + { return ::boost::tuples::null_type(); } + + inline ::boost::tuples::null_type range_end( ::boost::range_detail::void_& ) + { return ::boost::tuples::null_type(); } + + inline ::boost::tuples::null_type range_end( const ::boost::range_detail::void_& ) + { return ::boost::tuples::null_type(); } template< class T > struct tuple_iter { - typedef typename mpl::eval_if_c< is_same::value, - mpl::identity, - range_iterator >::type - type; + typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::eval_if_c< + ::boost::is_same::value, + ::boost::mpl::identity< ::boost::tuples::null_type >, + ::boost::range_iterator + >::type type; }; template< class Rng1, class Rng2 > struct tuple_range { - typedef typename mpl::eval_if_c< is_same::value, - void_, - mpl::identity >::type - type; + typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::eval_if_c< + ::boost::is_same::value, + ::boost::range_detail::void_, + ::boost::mpl::identity + >::type type; }; template @@ -57,36 +66,37 @@ namespace boost class R3, class R4, class R5, - class R6 + class R6 > struct generate_tuple { - typedef boost::tuple< typename tuple_iter::type, - typename tuple_iter::type, - typename tuple_iter::type, - typename tuple_iter::type, - typename tuple_iter::type, - typename tuple_iter::type > - type; + typedef ::boost::tuples::tuple< + BOOST_DEDUCED_TYPENAME tuple_iter::type, + BOOST_DEDUCED_TYPENAME tuple_iter::type, + BOOST_DEDUCED_TYPENAME tuple_iter::type, + BOOST_DEDUCED_TYPENAME tuple_iter::type, + BOOST_DEDUCED_TYPENAME tuple_iter::type, + BOOST_DEDUCED_TYPENAME tuple_iter::type + > type; static type begin( R1& r1, R2& r2, R3& r3, R4& r4, R5& r5, R6& r6 ) { - return make_tuple( boost::begin(r1), - boost::begin(r2), - boost::begin(r3), - boost::begin(r4), - boost::begin(r5), - boost::begin(r6) ); + return ::boost::tuples::make_tuple( ::boost::begin(r1), + ::boost::begin(r2), + ::boost::begin(r3), + ::boost::begin(r4), + ::boost::begin(r5), + ::boost::begin(r6) ); } static type end( R1& r1, R2& r2, R3& r3, R4& r4, R5& r5, R6& r6 ) { - return make_tuple( boost::end(r1), - boost::end(r2), - boost::end(r3), - boost::end(r4), - boost::end(r5), - boost::end(r6) ); + return ::boost::tuples::make_tuple( ::boost::end(r1), + ::boost::end(r2), + ::boost::end(r3), + ::boost::end(r4), + ::boost::end(r5), + ::boost::end(r6) ); } }; @@ -101,54 +111,52 @@ namespace boost > struct zip_rng : iterator_range< - zip_iterator< typename generate_tuple::type > - > + zip_iterator< + BOOST_DEDUCED_TYPENAME generate_tuple::type + > + > { private: - typedef generate_tuple - generator; - typedef typename generator::type - tuple; - typedef zip_iterator - zip_iter; - typedef iterator_range - base; + typedef generate_tuple generator_t; + typedef BOOST_DEDUCED_TYPENAME generator_t::type tuple_t; + typedef zip_iterator zip_iter_t; + typedef iterator_range base_t; public: zip_rng( R1& r1, R2& r2, R3& r3, R4& r4, R5& r5, R6& r6 ) - : base( zip_iter( generator::begin(r1,r2,r3,r4,r5,r6) ), - zip_iter( generator::end(r1,r2,r3,r4,r5,r6) ) ) + : base_t( zip_iter_t( generator_t::begin(r1,r2,r3,r4,r5,r6) ), + zip_iter_t( generator_t::end(r1,r2,r3,r4,r5,r6) ) ) { - BOOST_ASSERT(boost::distance(r1) <= boost::distance(r2)); - BOOST_ASSERT(boost::distance(r1) <= boost::distance(r3)); - BOOST_ASSERT(boost::distance(r1) <= boost::distance(r4)); - BOOST_ASSERT(boost::distance(r1) <= boost::distance(r5)); - BOOST_ASSERT(boost::distance(r1) <= boost::distance(r6)); + BOOST_ASSERT(::boost::distance(r1) <= ::boost::distance(r2)); + BOOST_ASSERT(::boost::distance(r1) <= ::boost::distance(r3)); + BOOST_ASSERT(::boost::distance(r1) <= ::boost::distance(r4)); + BOOST_ASSERT(::boost::distance(r1) <= ::boost::distance(r5)); + BOOST_ASSERT(::boost::distance(r1) <= ::boost::distance(r6)); } template< class Zip, class Rng > zip_rng( Zip& z, Rng& r ) - : base( zip_iter( generator::begin( z, r ) ), - zip_iter( generator::end( z, r ) ) ) + : base_t( zip_iter_t( generator_t::begin( z, r ) ), + zip_iter_t( generator_t::end( z, r ) ) ) { // @todo: tuple::begin( should be overloaded for this situation } - struct tuple_length : tuples::length + struct tuple_length : ::boost::tuples::length { }; template< unsigned N > struct get { template< class Z, class R > - static typename tuples::element::type begin( Z& z, R& ) + static BOOST_DEDUCED_TYPENAME ::boost::tuples::element::type begin( Z& z, R& ) { return get( z.begin().get_iterator_tuple() ); } template< class Z, class R > - static typename tuples::element::type end( Z& z, R& r ) + static BOOST_DEDUCED_TYPENAME ::boost::tuples::element::type end( Z& z, R& r ) { return get( z.end().get_iterator_tuple() ); } @@ -157,64 +165,70 @@ namespace boost }; template< class Rng1, class Rng2 > - struct zip_range - : iterator_range< - zip_iterator< - tuple< typename range_iterator::type, - typename range_iterator::type > - > > + struct zip_range + : iterator_range< + zip_iterator< + ::boost::tuples::tuple< + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type, + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type + > + > + > { private: - typedef zip_iterator< - tuple< typename range_iterator::type, - typename range_iterator::type > + typedef zip_iterator< + ::boost::tuples::tuple< + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type, + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type > - zip_iter; - typedef iterator_range - base; + > zip_iter_t; + typedef iterator_range base_t; public: zip_range( Rng1& r1, Rng2& r2 ) - : base( zip_iter( make_tuple(boost::begin(r1), - boost::begin(r2)) ), - zip_iter( make_tuple(boost::end(r1), - boost::end(r2)) ) ) + : base_t( zip_iter_t( ::boost::tuples::make_tuple(::boost::begin(r1), + ::boost::begin(r2)) ), + zip_iter_t( ::boost::tuples::make_tuple(::boost::end(r1), + ::boost::end(r2)) ) ) { - BOOST_ASSERT(boost::distance(r1) <= boost::distance(r2)); + BOOST_ASSERT(::boost::distance(r1) <= ::boost::distance(r2)); } }; template< class Rng1, class Rng2, class Rng3 > - struct zip_range3 - : iterator_range< - zip_iterator< - tuple< typename range_iterator::type, - typename range_iterator::type, - typename range_iterator::type > - > > + struct zip_range3 + : iterator_range< + zip_iterator< + ::boost::tuples::tuple< + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type, + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type, + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type + > + > + > { private: - typedef zip_iterator< - tuple< typename range_iterator::type, - typename range_iterator::type, - typename range_iterator::type > - > - zip_iter; - typedef iterator_range - base; + typedef zip_iterator< + ::boost::tuples::tuple< + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type, + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type, + BOOST_DEDUCED_TYPENAME ::boost::range_iterator::type + > + > zip_iter_t; + typedef iterator_range base_t; public: zip_range3( Rng1& r1, Rng2& r2, Rng3& r3 ) - : base( zip_iter( make_tuple(boost::begin(r1), - boost::begin(r2), - boost::begin(r3)) ), - zip_iter( make_tuple(boost::end(r1), - boost::end(r2), - boost::end(r3)) ) - ) + : base_t( zip_iter_t( ::boost::tuples::make_tuple(::boost::begin(r1), + ::boost::begin(r2), + ::boost::begin(r3)) ), + zip_iter_t( ::boost::tuples::make_tuple(::boost::end(r1), + ::boost::end(r2), + ::boost::end(r3)) ) + ) { - BOOST_ASSERT(distance(r1) <= distance(r2)); - BOOST_ASSERT(distance(r1) <= distance(r3)); + BOOST_ASSERT(::boost::distance(r1) <= ::boost::distance(r2)); + BOOST_ASSERT(::boost::distance(r1) <= ::boost::distance(r3)); } }; @@ -222,89 +236,61 @@ namespace boost struct combine_tag {}; template< class Rng > - inline zip_rng + inline zip_rng operator&( combine_tag, Rng& r ) { return zip_rng(r); } template< class Rng > - inline iterator_range + inline iterator_range operator&( combine_tag, const Rng& r ) { return iterator_range(r); } template - < - class R1, + < + class R1, class R2, class R3, class R4, class R5, class Rng > - inline typename zip_rng::next - operator&( const zip_rng& zip, + inline BOOST_DEDUCED_TYPENAME zip_rng::next + operator&( const zip_rng& zip, Rng& r ) { return zip_rng::next( zip, r ); } - // - // This one should be able to be made generic - // - // template - // < - // class R1, - // class R2 = void, - // class R3 = void, - // class R4 = void, - // class R5 = void, - // class R6 = void - // > - // inline zip_range::type - // x - // - // - /* - template< class Rng1, class Rng2, class Rng3 > - inline zip_range3 - operator&( const zip_range& r1, const Rng3& r3 ) - { - return zip_range3( - }*/ - - } // namespace 'detail' + } // namespace range_detail template< class Rng1, class Rng2 > - inline detail::zip_range combine( Rng1& r1, Rng2& r2 ) + inline ::boost::range_detail::zip_range combine( Rng1& r1, Rng2& r2 ) { - return detail::zip_range(r1,r2); + return ::boost::range_detail::zip_range(r1, r2); } template< class Rng1, class Rng2 > - inline detail::zip_range combine( const Rng1& r1, Rng2& r2 ) + inline ::boost::range_detail::zip_range combine( const Rng1& r1, Rng2& r2 ) { - return detail::zip_range(r1,r2); + return ::boost::range_detail::zip_range(r1, r2); } template< class Rng1, class Rng2 > - inline detail::zip_range combine( Rng1& r1, const Rng2& r2 ) + inline ::boost::range_detail::zip_range combine( Rng1& r1, const Rng2& r2 ) { - return detail::zip_range(r1,r2); + return ::boost::range_detail::zip_range(r1, r2); } template< class Rng1, class Rng2 > - inline detail::zip_range combine( const Rng1& r1, const Rng2& r2 ) + inline ::boost::range_detail::zip_range combine( const Rng1& r1, const Rng2& r2 ) { - return detail::zip_range(r1,r2); + return ::boost::range_detail::zip_range(r1, r2); } - // - // @todo: find a solution that scales better - // instead of adding 6 overloads! - // -} +} // namespace boost #endif diff --git a/include/boost/range/size_type.hpp b/include/boost/range/size_type.hpp old mode 100755 new mode 100644 index 7ed8dfa..9993d55 --- a/include/boost/range/size_type.hpp +++ b/include/boost/range/size_type.hpp @@ -67,7 +67,8 @@ namespace boost { }; template< class T > - struct range_size : range_size + struct range_size + : detail::range_size { }; } // namespace boost diff --git a/test/combine.cpp b/test/combine.cpp index 9e29a11..c020626 100644 --- a/test/combine.cpp +++ b/test/combine.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -26,23 +26,25 @@ struct add }; template< class CombinedRng > -void apply( const CombinedRng& r ) +void apply( const CombinedRng& r ) { std::vector v; - for( typename boost::range_iterator::type - i = boost::begin(r), - e = boost::end(r); - i != e; ++i ) + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iterator_t; + + iterator_t e = boost::end(r); + for (iterator_t i = boost::begin(r); i != e; ++i) { - } } void test_combine() { std::vector v1, v2, v3; - v1 = boost::assign::list_of(1)(2)(3)(4); - v2 = boost::assign::list_of(1)(2)(3)(4); + for (int i = 1; i <= 4; ++i) + { + v1.push_back(i); + v2.push_back(i); + } int i1, i2; BOOST_FOREACH( boost::tie( i1, i2 ), boost::combine(v1,v2) ) diff --git a/test/iterator_range.cpp b/test/iterator_range.cpp index 47bc565..cf22463 100644 --- a/test/iterator_range.cpp +++ b/test/iterator_range.cpp @@ -61,7 +61,7 @@ void check_iterator_range() BOOST_CHECK_EQUAL( r2.size(), size( r2 ) ); BOOST_CHECK_EQUAL( std::distance( r.begin(), r.end() ), - std::distance( begin( r2 ), end( r2 ) ) ); + std::distance( boost::begin( r2 ), boost::end( r2 ) ) ); std::cout << r << r2; From 13b748a22869ebf04fc7a43c419e4bcb4b2e99ff Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Sat, 10 Apr 2010 15:25:56 +0000 Subject: [PATCH 32/73] Boost.Range removed deprecated html documentation. [SVN r61181] --- doc/boost_range.html | 769 ------------------ doc/examples.html | 72 -- doc/faq.html | 145 ---- doc/headers.html | 202 ----- doc/history_ack.html | 90 -- .../range_algorithm_introduction.html | 257 ------ .../range_algorithm_mutating_algorithms.html | 50 -- .../copy.html | 115 --- .../copy_backward.html | 124 --- .../range_algorithm_new_algorithms.html | 41 - ...nge_algorithm_non_mutating_algorithms.html | 42 - doc/intro.html | 164 ---- doc/istream_range.html | 64 -- doc/mfc_atl.html | 581 ------------- doc/portability.html | 103 --- doc/range.html | 379 --------- doc/style.html | 132 --- doc/upgrading.html | 78 -- doc/utility_class.html | 380 --------- 19 files changed, 3788 deletions(-) delete mode 100644 doc/boost_range.html delete mode 100644 doc/examples.html delete mode 100644 doc/faq.html delete mode 100644 doc/headers.html delete mode 100644 doc/history_ack.html delete mode 100644 doc/html/range/reference/range_algorithm/range_algorithm_introduction.html delete mode 100644 doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms.html delete mode 100644 doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms/copy.html delete mode 100644 doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms/copy_backward.html delete mode 100644 doc/html/range/reference/range_algorithm/range_algorithm_new_algorithms.html delete mode 100644 doc/html/range/reference/range_algorithm/range_algorithm_non_mutating_algorithms.html delete mode 100644 doc/intro.html delete mode 100755 doc/istream_range.html delete mode 100644 doc/mfc_atl.html delete mode 100644 doc/portability.html delete mode 100644 doc/range.html delete mode 100644 doc/style.html delete mode 100644 doc/upgrading.html delete mode 100644 doc/utility_class.html diff --git a/doc/boost_range.html b/doc/boost_range.html deleted file mode 100644 index b9fd0ca..0000000 --- a/doc/boost_range.html +++ /dev/null @@ -1,769 +0,0 @@ - - - - Boost.Range Reference - - - - -

    - - - - -


    - Boost.Range -

    -
    -

    Synopsis and Reference -

    - -
    - -

    Overview

    -

    - Three types of objects are currently supported by the library: -

      -
    • - standard-like containers -
    • - std::pair<iterator,iterator> -
    • - built-in arrays -
    • -
    - Even though the behavior of the primary templates are exactly such that - standard containers will be supported by default, the requirements are much - lower than the standard container requirements. For example, the utility class - iterator_range implements the minimal - interface required to make the class a Forward - Range - . -

    -

    - Please also see Range concepts for more details. -

    - -

    Synopsis

    -

    -

    -namespace boost
    -{
    -    //
    -    // Single Pass Range metafunctions
    -    //
    -                   
    -    template< class T >
    -    struct range_iterator;
    -    
    -    template< class T >
    -    struct range_value;
    -  
    -    template< class T >
    -    struct range_reference;
    -
    -    template< class T >
    -    struct range_pointer;
    -    
    -    template< class T >
    -    struct range_category;
    -
    -    //
    -    // Forward Range metafunctions
    -    //
    -    
    -    template< class T >
    -    struct range_difference;
    -    
    -    //
    -    // Bidirectional Range metafunctions
    -    //
    -    
    -    template< class T >
    -    struct range_reverse_iterator;
    -    
    -    //
    -    // Single Pass Range functions
    -    //
    -    
    -    template< class T >
    -    typename range_iterator<T>::type
    -    begin( T& r );
    -    
    -    template< class T >
    -    typename range_iterator<const T>::type
    -    begin( const T& r );
    -        
    -    template< class T >
    -    typename range_iterator<T>::type
    -    end( T& r );
    -                      
    -    template< class T >
    -    typename range_iterator<const T>::type
    -    end( const T& r );
    -    
    -    template< class T >
    -    bool
    -    empty( const T& r );
    -               
    -    //
    -    // Forward Range functions
    -    //
    -    
    -    template< class T >
    -    typename range_difference<T>::type
    -    distance( const T& r );
    -                            
    -    //
    -    // Bidirectional Range functions
    -    //
    -                     
    -    template< class T >
    -    typename range_reverse_iterator<T>::type
    -    rbegin( T& r );
    -    
    -    template< class T >
    -    typename range_reverse_iterator<const T>::type
    -    rbegin( const T& r );
    -        
    -    template< class T >
    -    typename range_reverse_iterator<T>::type
    -    rend( T& r );
    -                      
    -    template< class T >
    -    typename range_reverse_iterator<const T>::type
    -    rend( const T& r );
    -    
    -    //
    -    // Random Access Range functions
    -    //
    -    
    -    template< class T >
    -    typename range_difference<T>::type
    -    size( const T& r );
    -    
    -    //
    -    // Special const Range functions
    -    // 
    -    
    -    template< class T >
    -    typename range_iterator<const T>::type 
    -    const_begin( const T& r );
    -    
    -    template< class T >
    -    typename range_iterator<const T>::type 
    -    const_end( const T& r );
    -    
    -    template< class T >
    -    typename range_reverse_iterator<const T>::type 
    -    const_rbegin( const T& r );
    -    
    -    template< class T >
    -    typename range_reverse_iterator<const T>::type 
    -    const_rend( const T& r );
    -
    -    //
    -    // String utilities
    -    //
    -    
    -    template< class T >
    -    iterator_range<...see below...> 
    -    as_literal( T& r );
    -
    -    template< class T >
    -    iterator_range<...see below...> 
    -    as_literal( const T& r );
    -
    -    template< class T >
    -    iterator_range< typename range_iterator<T>::type > 
    -    as_array( T& r );
    -
    -    template< class T >
    -    iterator_range< typename range_iterator<const T>::type > 
    -    as_array( const T& r );
    -
    -} // namespace 'boost' 
    -
    -
    -

    - -

    Semantics

    -

    notation

    -

    - - - - - - - - - - - - - - - - -
    - Type - - Object - - Describes -
    X - x - any type
    T - t - denotes behavior of the primary templates
    P - p - denotes std::pair<iterator,iterator>
    A[sz] - a - denotes an array of type A of size sz -
    Char* - s - denotes either char* or wchar_t*
    -

    -

    - Please notice in tables below that when four lines appear in a cell, the first - line will describe the primary template, the second line pairs of iterators, - the third line arrays and the last line null-terminated strings. -

    -

    Metafunctions

    -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Expression - Return type - Complexity
    range_iterator<X>::typeT::iterator
    - P::first_type
    - A*
    - -
    compile time
    range_iterator<const X>::typeT::const_iterator
    - P::first_type
    - const A*
    - -
    compile time
    range_value<X>::typeboost::iterator_value<range_iterator<X>::type>::type - compile time
    range_reference<X>::typeboost::iterator_reference<range_iterator<X>::type>::type - compile time
    range_pointer<X>::typeboost::iterator_pointer<range_iterator<X>::type>::type - compile time
    range_category<X>::typeboost::iterator_category<range_iterator<X>::type>::type - compile time
    range_difference<X>::type - boost::iterator_difference<range_iterator<X>::type>::typecompile time
    range_reverse_iterator<X>::typeboost::reverse_iterator<range_iterator<X>::type>
    -
    compile time
    range_reverse_iterator<const X>::typeboost::reverse_iterator<range_iterator<const X>::type> -
    -
    compile time
    -

    -

    Functions

    -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Expression - Return type - Returns - Complexity
    begin(x)range_iterator<X>::type - p.first if p is of type std::pair<T>
    - a if a is an array
    - range_begin(x) if that expression would invoke a function found by ADL
    - t.begin() otherwise - -
    constant time
    end(x)range_iterator<X>::type - p.second if p is of type std::pair<T>
    - a + sz if a is an array of size sz - -
    - range_end(x) if that expression would invoke a function found by ADL
    - t.end() otherwise - -
    - constant time
    empty(x)boolboost::begin(x) == boost::end(x)
    -
    constant time
    -
    distance(x)range_difference<X>::type - - std::distance(boost::begin(x),boost::end(x)) - - -
    size(x)range_difference<X>::type boost::end(x) - boost::begin(x) - - constant time
    rbegin(x)range_reverse_iterator<X>::typerange_reverse_iterator<X>::type( boost::end(x) ) -
    -
    constant time -
    rend(x)range_reverse_iterator<X>::typerange_reverse_iterator<X>::type( boost::begin(x) ) - constant time
    const_begin(x)range_iterator<const X>::typerange_iterator<const X>::type( boost::begin(x) ) -
    -
    constant time -
    const_end(x)range_iterator<const X>::typerange_iterator<const X>::type( boost::end(x) ) - constant time
    const_rbegin(x)range_reverse_iterator<const X>::typerange_reverse_iterator<const X>::type( boost::rbegin(x) ) -
    -
    constant time -
    const_rend(x)range_reverse_iterator<const X>::typerange_reverse_iterator<const X>::type( boost::rend(x) ) - - constant time
    as_literal(x)iterator_range<U> where U is - Char* if x is a pointer to a - string and U is - range_iterator<X>::type otherwise - - - - [s,s + std::char_traits<X>::length(s)) if s is a Char* or an array of Char -
    - [boost::begin(x),boost::end(x)) otherwise - - - -
    linear time for pointers to a string or arrays of - Char, constant time otherwise
    as_array(x)iterator_range<X> - [boost::begin(x),boost::end(x)) - - - - - constant time otherwise
    -

    -

    - The special const_-named functions are useful when you - want to document clearly that your code is read-only. -

    -

    - as_literal() can be used internally in string - algorithm librararies such that arrays of characters are - handled correctly. -

    -

    - as_array() can be used with string algorithm libraries to make it clear that arrays of characters are handled like an array and not like a string. -

    -

    Notice that the above functions should always be called with - qualification (boost::) to prevent unintended - Argument Dependent Lookup (ADL). -

    -
    - -

    Extending the library

    - - - - - -

    Method 1: provide member functions and nested types

    - -

    - This procedure assumes that you have control over the types that should be made - conformant to a Range concept. If not, see method 2. -

    - -

    - The primary templates in this library are implemented such that standard - containers will work automatically and so will boost::array. - Below is given an overview of which member functions and member types a class - must specify to be useable as a certain Range concept. -

    -

    - - - - - - - - - - - - -
    - Member function - Related concept
    begin()Single Pass Range
    end() - Single Pass Range
    -

    -

    - Notice that rbegin() and rend() member functions are - not needed even though the container can support bidirectional iteration. -

    -

    - The required member types are: -

    -

    - - - - - - - - - - - - - -
    - Member type - Related concept
    iteratorSingle Pass Range
    const_iteratorSingle Pass Range
    -

    -

    - Again one should notice that member types reverse_iterator and const_reverse_iterator - are not needed. -

    - -

    Method 2: provide free-standing functions and specialize metafunctions

    - -

    - This procedure assumes that you cannot (or do not wish to) change the types that should be made - conformant to a Range concept. If this is not true, see method 1. -

    - -

    - The primary templates in this library are implemented such that - certain functions are found via argument-dependent-lookup (ADL). - Below is given an overview of which free-standing functions a class - must specify to be useable as a certain Range concept. - Let x be a variable (const or mutable) - of the class in question. -

    -

    - - - - - - - - - - - - - -
    - Function - Related concept
    range_begin(x)Single Pass Range
    range_end(x) - Single Pass Range
    -

    -

    range_begin() and range_end() must be - overloaded for both const and mutable reference arguments. -

    - -

    - You must also specialize two metafunctions for your type X: -

    -

    - - - - - - - - - - - - - -
    - Metafunction - Related concept
    boost::range_mutable_iteratorSingle Pass Range
    boost::range_const_iteratorSingle Pass Range
    -

    -

    - A complete example is given here: -

    -
    -
    -#include <boost/range.hpp>
    -#include <iterator>         // for std::iterator_traits, std::distance()
    -
    -namespace Foo
    -{
    -    //
    -    // Our sample UDT. A 'Pair'
    -    // will work as a range when the stored
    -    // elements are iterators.
    -    //
    -    template< class T >
    -    struct Pair
    -    {
    -        T first, last;  
    -    };
    -
    -} // namespace 'Foo'
    -
    -namespace boost
    -{
    -    //
    -    // Specialize metafunctions. We must include the range.hpp header.
    -    // We must open the 'boost' namespace.
    -    //
    -
    -    template< class T >
    -    struct range_mutable_iterator< Foo::Pair<T> >
    -    {
    -        typedef T type;
    -    };
    -
    -    template< class T >
    -    struct range_const_iterator< Foo::Pair<T> >
    -    {
    -        //
    -        // Remark: this is defined similar to 'range_mutable_iterator'
    -        //         because the 'Pair' type does not distinguish
    -        //         between an iterator and a const_iterator.
    -        //
    -        typedef T type;
    -    };
    -
    -} // namespace 'boost'
    -
    -namespace Foo
    -{
    -    //
    -    // The required functions. These should be defined in
    -    // the same namespace as 'Pair', in this case 
    -    // in namespace 'Foo'.
    -    //
    -    
    -    template< class T >
    -    inline T range_begin( Pair<T>& x )
    -    { 
    -        return x.first;
    -    }
    -
    -    template< class T >
    -    inline T range_begin( const Pair<T>& x )
    -    { 
    -        return x.first;
    -    }
    -
    -    template< class T >
    -    inline T range_end( Pair<T>& x )
    -    { 
    -        return x.last;
    -    }
    -
    -    template< class T >
    -    inline T range_end( const Pair<T>& x )
    -    { 
    -        return x.last;
    -    }
    -
    -} // namespace 'Foo'
    -
    -#include <vector>
    -
    -int main()
    -{
    -    typedef std::vector<int>::iterator  iter;
    -    std::vector<int>                    vec;
    -    Foo::Pair<iter>                     pair  = { vec.begin(), vec.end() };
    -    const Foo::Pair<iter>&              cpair = pair; 
    -    //
    -    // Notice that we call 'begin' etc with qualification. 
    -    //
    -    iter i = boost::begin( pair );
    -    iter e = boost::end( pair );
    -    i      = boost::begin( cpair );
    -    e      = boost::end( cpair );
    -    boost::range_difference< Foo::Pair<iter> >::type s = boost::size( pair );
    -    s      = boost::size( cpair );
    -    boost::range_reverse_iterator< const Foo::Pair<iter> >::type
    -    ri     = boost::rbegin( cpair ),
    -    re     = boost::rend( cpair );
    -}    
    -
    -
    - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt) -

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - diff --git a/doc/examples.html b/doc/examples.html deleted file mode 100644 index d1f9887..0000000 --- a/doc/examples.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - Boost.Range Examples - - - - - - - - - - -

    Boost.Range

    - -

    Examples

    -

    - Some examples are given in the accompanying test files: -

    - - - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/faq.html b/doc/faq.html deleted file mode 100644 index fcacf98..0000000 --- a/doc/faq.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - Boost.Range FAQ - - - - - - - - - - -

    Boost.Range

    - -

    -

    FAQ

    -
      -
    1. - Why is there no difference between range_iterator<C>::type - and range_const_iterator<C>::type for std::pair<iterator, iterator>. - -

      - In general it is not possible nor desirable to find a corresponding const_iterator. - When it is possible to come up with one, the client might choose to construct a std::pair<const_iterator,const_iterator> - object. -

      -

      - Note that an iterator_range - is somewhat more convenient than a pair and that a sub_range does - propagate const-ness.

      -
    2. -
    3. - Why is there not supplied more types or more functions? -

      - The library has been kept small because its current interface will - serve most - purposes. If and when a genuine need arises for more functionality, it can be - implemented. -

      -
    4. -
    5. - How should I implement generic algorithms for ranges? -

      - One should always start with a generic algorithm that takes two iterators (or - more) as input. Then use Boost.Range to build handier versions on top of the - iterator based algorithm. Please notice that once the range version of the - algorithm is done, it makes sense not to expose the iterator version in - the public interface. -

      -
    6. -
    7. - Why is there no Incrementable Range concept? -

      - Even though we speak of incrementable iterators, it would not make - much sense for ranges; for example, we cannot determine the size and - emptiness of a range since we cannot even compare - its iterators. -

      -

      - Note also that incrementable iterators are derived from output - iterators and so there exist no output range. -

      -
    8. - - -
    - - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/headers.html b/doc/headers.html deleted file mode 100644 index c896bff..0000000 --- a/doc/headers.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - Boost.Range Headers - - - - - - - - - - -

    Boost.Range

    - -

    -

    Library headers

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    HeaderIncludesRelated concept
    <boost/range.hpp>everything-
    <boost/range/metafunctions.hpp>every metafunction-
    <boost/range/functions.hpp>every function-
    <boost/range/value_type.hpp>range_valueSingle Pass Range
    <boost/range/iterator.hpp>range_iteratorSingle Pass Range
    <boost/range/mutable_iterator.hpp>range_mutable_iteratorSingle Pass Range
    <boost/range/const_iterator.hpp>range_const_iteratorSingle Pass Range
    <boost/range/difference_type.hpp>range_differenceForward Range
    <boost/range/pointer.hpp>range_pointer-
    <boost/range/category.hpp>range_category-
    <boost/range/reverse_iterator.hpp>range_reverse_iteratorBidirectional Range
    <boost/range/begin.hpp> - begin and - const_begin - Single Pass Range
    <boost/range/end.hpp> - end and - const_end - Single Pass Range
    <boost/range/empty.hpp>emptySingle Pass Range
    <boost/range/distance.hpp>distanceForward Range
    <boost/range/size.hpp>sizeRandom Access Range -
    <boost/range/rbegin.hpp> - rbegin and - const_rbegin - Bidirectional Range
    <boost/range/rend.hpp> - rend and - const_rend - Bidirectional Range
    <boost/range/as_array.hpp> - as_array - -
    <boost/range/as_literal.hpp> - as_literal - -
    <boost/range/iterator_range.hpp>iterator_range-
    <boost/range/sub_range.hpp>sub_range-
    <boost/range/concepts.hpp>concept checks-
    -
    -

    - - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/history_ack.html b/doc/history_ack.html deleted file mode 100644 index 3191dd0..0000000 --- a/doc/history_ack.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - Boost.Range History and Acknowledgement - - - - - - - - - - -

    Boost.Range

    - -

    History and Acknowledgement

    -

    - The library was under way for a long time. Dietmar Kühl originally intended - to submit an array_traits class template which had most of - the functionality present now, but only for arrays and standard containers. - I believe this was back in 2001 or 2002. -

    - -

    - Meanwhile work on algorithms for containers in various contexts showed the - need for handling pairs of iterators, and string libraries needed special - treatment of character arrays. In the end it made sense to formalize the - minimal requirements of these similar concepts. And the results are the - Range concepts found in this library.

    - -

    - The term Range was adopted because of paragraph 24.1/7 from the -C++ standard:

    - Most of the library's algorithmic templates that operate on data - structures have interfaces that use ranges. A range is a pair of - iterators that designate the beginning and end of the computation. A - range [i, i) is an empty range; in general, a range [i, j) refers to - the elements in the data structure starting with the one pointed to - by i and up to but not including the one pointed to by j. Range [i, - j) is valid if and only if j is reachable from i. The result of the - application of functions in the library to invalid ranges is - undefined. -
    - -

    - Special thanks goes to -

      -
    • Pavol Droba for help with documentation and implementation -
    • Pavel Vozenilek for help with porting the library -
    • Jonathan Turkanis and John Torjo for help with documentation -
    • Hartmut Kaiser for being review manager -
    • Jonathan Turkanis for porting the lib (as far sa possible) to - vc6 and vc7. -
    -

    -

    - The concept checks and their documentation was provided by Daniel Walker. - -


    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/html/range/reference/range_algorithm/range_algorithm_introduction.html b/doc/html/range/reference/range_algorithm/range_algorithm_introduction.html deleted file mode 100644 index e24351f..0000000 --- a/doc/html/range/reference/range_algorithm/range_algorithm_introduction.html +++ /dev/null @@ -1,257 +0,0 @@ - - - -Introduction and motivation - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - In its most simple form a Range Algorithm - (or range-based algorithm) is simply an iterator-based algorithm where - the two iterator arguments have been replaced by - one range argument. For example, we may write -

    -

    - -

    -
    #include <boost/range/algorithm.hpp>
    -#include <vector>
    -
    -std::vector<int> vec = ...;
    -boost::sort(vec);
    -
    -

    -

    -

    - instead of -

    -

    - -

    -
    std::sort(vec.begin(), vec.end());
    -
    -

    -

    -

    - However, the return type of range algorithms is almost always different - from that of existing iterator-based algorithms. -

    -

    - One group of algorithms, like boost::sort(), will simply return the same range so - that we can continue to pass the range around and/or further modify it. - Because of this we may write -

    -
    boost:unique(boost::sort(vec));
    -
    -

    - to first sort the range and then run unique() on the sorted range. -

    -

    - Algorithms like boost::unique() - fall into another group of algorithms that return (potentially) narrowed - views of the original range. By default boost::unique(rng) returns the range [boost::begin(rng), found) - where found denotes the - iterator returned by std::unique(boost::begin(rng), boost::end(rng)) -

    -

    - Therefore exactly the unique values can be copied by writing -

    -
    boost::copy(boost::unique(boost::sort(vec)),
    -            std::ostream_iterator<int>(std::cout));
    -
    -

    -

    -

    - Algorithms like boost::unique usually return the same range: - [boost::begin(rng), found). However, this behaviour may be changed - by supplying the algorithms with a template argument: -

    -
    ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Expression -

    -
    -

    - Return -

    -
    -

    - boost::unique<boost::return_found>(rng) -

    -
    -

    - returns a single iterator like std::unique -

    -
    -

    - boost::unique<boost::return_begin_found>(rng) -

    -
    -

    - returns the range [boost::begin(rng), - found) - (this is the default) -

    -
    -

    - boost::unique<boost::return_begin_next>(rng) -

    -
    -

    - returns the range [boost::begin(rng), - boost::next(found)) -

    -
    -

    - boost::unique<boost::return_found_end>(rng) -

    -
    -

    - returns the range [found, - boost::end(rng)) -

    -
    -

    - boost::unique<boost::return_next_end>(rng) -

    -
    -

    - returns the range [boost::next(found),boost::end(rng)) -

    -
    -

    - boost::unique<boost::return_begin_end>(rng) -

    -
    -

    - returns the entire original range. -

    -
    -

    - This functionality has the following advantages: -

    -
      -
    1. - it allows for seamless functional-style - programming where you do not need to use named - local variables to store intermediate results -
    2. -
    3. - it is very safe - because the algorithm can verify out-of-bounds conditions and handle - tricky conditions that lead to empty ranges -
    4. -
    -

    - For example, consider how easy we may erase the duplicates in a sorted - container: -

    -

    - -

    -
    std::vector<int> vec = ...;
    -boost::erase(vec, boost::unique<boost::return_found_end>(boost::sort(vec)));
    -
    -

    -

    -

    - Notice the use of boost::return_found_end. - What if we wanted to erase all the duplicates except one of them? In old-fashined - STL-programming we might write -

    -

    - -

    -
    // assume 'vec' is already sorted
    -std::vector<int>::iterator i = std::unique(vec.begin(), vec.end());
    -
    -// remember this check or you get into problems
    -if (i != vec.end())
    -    ++i;
    -    
    -vec.erase(i, vec.end());
    -
    -

    -

    -

    - The same task may be accomplished simply with -

    -
    boost::erase(vec, boost::unique<boost::return_next_end>(vec));
    -
    -

    - and there is no need to worry about generating an invalid range. Furthermore, - if the container is complex, calling vec.begin() several times will be more expensive - than using a range algorithm. -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms.html b/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms.html deleted file mode 100644 index 5c11829..0000000 --- a/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms.html +++ /dev/null @@ -1,50 +0,0 @@ - - - -Mutating algorithms - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    - - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms/copy.html b/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms/copy.html deleted file mode 100644 index 4bf5ab0..0000000 --- a/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms/copy.html +++ /dev/null @@ -1,115 +0,0 @@ - - - -Range Algorithm - copy - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -
    - - Prototype -
    -

    - -

    -
    template<class SinglePassRange, class OutputIterator>
    -OutputIterator copy(const SinglePassRange& source_rng, OutputIterator out_it);
    -
    -

    -

    -
    - - Description -
    -

    - copy copies all elements - from source_rng to the - range [out_it, out_it - + distance(source_rng)). The return value is out_it + - distance(source_rng) -

    -
    - - Definition -
    -

    - Defined in the header file boost/range/algorithm/copy.hpp -

    -
    - - Requirements -
    -
      -
    • -SinglePassRange is - a model of the SinglePassRangeConcept. -
    • -
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • -
    • - The value_type of - SinglePassRange is - convertible to a type in OutputIterator's - set of value types. -
    • -
    -
    - - Precondition: -
    -
      -
    • -out_it is not an iterator - within the source_rng. -
    • -
    • -[out_it, out_it - + distance(source_rng)) is a valid range. -
    • -
    -
    - - Complexity -
    -

    - Linear. Exactly distance(source_rng) assignments are performed. -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms/copy_backward.html b/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms/copy_backward.html deleted file mode 100644 index de14a89..0000000 --- a/doc/html/range/reference/range_algorithm/range_algorithm_mutating_algorithms/copy_backward.html +++ /dev/null @@ -1,124 +0,0 @@ - - - -Range Algorithm - copy_backward - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -
    - - Prototype -
    -

    - -

    -
    template<class BidirectionalRange, class BidirectionalOutputIterator>
    -    BidirectionalOutputIterator
    -        copy_backward(const BidirectionalRange& source_rng,
    -                      BidirectionalOutputIterator out_it);
    -
    -

    -

    -
    - - Description -
    -

    - copy_backward copies - all elements from source_rng - to the range [out_it - - distance(source_rng), out_it). -

    -

    - The values are copied in reverse order. The return value is out_it - - distance(source_rng). -

    -

    - Note well that unlike all other standard algorithms out_it - denotes the end of the output sequence. -

    -
    - - Definition -
    -

    - Defined in the header file boost/range/algorithm/copy_backward.hpp -

    -
    - - Requirements -
    -
      -
    • -BidirectionalRange - is a model of the SinglePassRangeConcept. -
    • -
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • -
    • - The value_type of - SinglePassRange is - convertible to a type in OutputIterator's - set of value types. -
    • -
    -
    - - Precondition: -
    -
      -
    • -out_it is not an iterator - within the source_rng. -
    • -
    • -[out_it, out_it - + distance(source_rng)) is a valid range. -
    • -
    -
    - - Complexity -
    -

    - Linear. Exactly distance(source_rng) assignments are performed. -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/range_algorithm/range_algorithm_new_algorithms.html b/doc/html/range/reference/range_algorithm/range_algorithm_new_algorithms.html deleted file mode 100644 index a7f08e5..0000000 --- a/doc/html/range/reference/range_algorithm/range_algorithm_new_algorithms.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -

    -??? -

    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/range_algorithm/range_algorithm_non_mutating_algorithms.html b/doc/html/range/reference/range_algorithm/range_algorithm_non_mutating_algorithms.html deleted file mode 100644 index 9974a92..0000000 --- a/doc/html/range/reference/range_algorithm/range_algorithm_non_mutating_algorithms.html +++ /dev/null @@ -1,42 +0,0 @@ - - - -Non-mutating algorithms - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    - - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/intro.html b/doc/intro.html deleted file mode 100644 index 89d3504..0000000 --- a/doc/intro.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - Boost.Range Introduction - - - - - - - - - - -

    Boost.Range

    - -

    Introduction

    -

    - Generic algorithms have so far been specified in terms of two or more - iterators. Two iterators would together form a range of values that the - algorithm could work on. This leads to a very general interface, but also - to a somewhat clumsy use of the algorithms with redundant specification - of container names. Therefore we would like to raise the abstraction level - for algorithms so they specify their interface in terms of Ranges as much as possible. -

    - -

    - The most common form of ranges we are used to work with is standard library - containers. However, one - often finds it desirable to extend that code to work with other types that - offer - enough functionality to satisfy the needs of the generic code - if a suitable layer of indirection is applied . For - example, raw arrays are often suitable for use with generic code that - works with containers, provided a suitable adapter is used. -

    - -

    - This library therefore provides the means to adapt standard-like - containers, std::pairs of iterators, and raw arrays (and - more), such that - the same generic code can work with them all. -The basic idea is to add another layer of indirection using metafunctions and -free-standing functions so syntactic and/or semantic differences can be removed. -

    - -

    - The main advantages are -

      -
    • - simpler implementation and specification of generic range algorithms -
    • -
    • - more flexible, compact and maintainable client code -
    • -
    • - safe use of built-in arrays -
    • - -
    -

    -

    Below is given a small example (the complete example can be found here):

    -
    -
    -    //
    -    // example: extracting bounds in a generic algorithm
    -    //
    -    template< class ForwardReadableRange, class T >
    -    inline typename boost::range_iterator< ForwardReadableRange >::type
    -    find( ForwardReadableRange& c, const T& value )
    -    {
    -       return std::find( boost::begin( c ), boost::end( c ), value );
    -    }
    -
    -    template< class ForwardReadableRange, class T >
    -    inline typename boost::range_iterator< const ForwardReadableRange >::type
    -    find( const ForwardReadableRange& c, const T& value )
    -    {
    -       return std::find( boost::begin( c ), boost::end( c ), value );
    -    }
    -
    -    //
    -    // replace first value and return its index
    -    //
    -    template< class ForwardReadableWriteableRange, class T >
    -    inline typename boost::range_difference< ForwardReadableWriteableRange >::type
    -    my_generic_replace( ForwardReadableWriteableRange& c, const T& value, const T& replacement )
    -    {
    -       typename boost::range_iterator< ForwardReadableWriteableRange >::type found = find( c, value );
    -
    -       if( found != boost::end( c ) )
    -           *found = replacement;
    -       return std::distance( boost::begin( c ), found );
    -    }
    -
    -    //
    -    // usage
    -    //
    -    const int N = 5;
    -    std::vector<int> my_vector;
    -    int values[] = { 1,2,3,4,5,6,7,8,9 };
    -    
    -    my_vector.assign( values, boost::end( values ) );
    -    typedef std::vector<int>::iterator iterator;
    -    std::pair<iterator,iterator>       my_view( boost::begin( my_vector ),
    -                                                boost::begin( my_vector ) + N );
    -    char  str_val[] = "a string";
    -    char* str       = str_val;
    -
    -    std::cout << my_generic_replace( my_vector, 4, 2 );
    -    std::cout << my_generic_replace( my_view, 4, 2 );
    -    std::cout << my_generic_replace( str, 'a', 'b' );
    -
    -    // prints '3', '5' and '0'     
    -    
    -
    - - By using the free-standing functions and metafunctions, the code automatically - works for all the types supported by this library; now and in the future. -Notice that we have to - provide two version of find() since we cannot forward a non-const - rvalue with reference arguments (see this article about The - Forwarding Problem ). - -

    - - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/istream_range.html b/doc/istream_range.html deleted file mode 100755 index 8f41fc4..0000000 --- a/doc/istream_range.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - Boost.Range Utilities - - - - - - - - - -

    Boost.Range

    -

    Function istream_range

    -

    - The intention of the istream_range function is to construct - a new range with a pair of std::istream_iterators that wrap a - specified std::basic_istream instance. -

    - -

    Synopsis

    - -
    -namespace boost
    -{
    -    template< class 
    -        Type, class 
    -            Elem, class Traits > inline
    -    range< std::istream_iterator<Type, Elem, Traits> >
    -    istream_range(std::basic_istream<Elem, Traits>& in);
    -}    
    - -

    - © Copyright Neil Groves 2009. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/mfc_atl.html b/doc/mfc_atl.html deleted file mode 100644 index cc8eeb0..0000000 --- a/doc/mfc_atl.html +++ /dev/null @@ -1,581 +0,0 @@ - - - - - - -Boost Range MFC/ATL Extension - - - - - - -
    -

    Boost Range MFC/ATL Extension

    - --- - - - - - - - - - -
    Author:Shunsuke Sogame
    Contact:mb2act@yahoo.co.jp
    Date:26th of May 2006
    Copyright:Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt).
    -
    -

    Overview

    -

    Boost.Range MFC/ATL Extension provides Boost.Range support for MFC/ATL collection and string types.

    -
    -CTypedPtrArray<CPtrArray, CList<CString> *> myArray;
    -...
    -BOOST_FOREACH (CList<CString> *theList, myArray)
    -{
    -    BOOST_FOREACH (CString& str, *theList)
    -    {
    -        boost::to_upper(str);
    -        std::sort(boost::begin(str), boost::end(str));
    -        ...
    -    }
    -}
    -
    - -
    -
    -

    Requirements

    - -
    -
    -

    MFC Ranges

    -

    If the <boost/range/mfc.hpp> is included before or after Boost.Range headers, -the MFC collections and strings become models of Range. -The table below lists the Traversal Category and range_reference of MFC ranges.

    - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    RangeTraversal Categoryrange_reference<Range>::type
    CArray<T,A>Random AccessT&
    CList<T,A>BidirectionalT&
    CMap<K,AK,M,AM>ForwardRange::CPair&
    CTypedPtrArray<B,T*>Random AccessT* const
    CTypedPtrList<B,T*>BidirectionalT* const
    CTypedPtrMap<B,T*,V*>Forwardstd::pair<T*,V*> const
    CByteArrayRandom AccessBYTE&
    CDWordArrayRandom AccessDWORD&
    CObArrayRandom AccessCObject* &
    CPtrArrayRandom Accessvoid* &
    CStringArrayRandom AccessCString&
    CUIntArrayRandom AccessUINT&
    CWordArrayRandom AccessWORD&
    CObListBidirectionalCObject* &
    CPtrListBidirectionalvoid* &
    CStringListBidirectionalCString&
    CMapPtrToWordForwardstd::pair<void*,WORD> const
    CMapPtrToPtrForwardstd::pair<void*,void*> const
    CMapStringToObForwardstd::pair<String,CObject*> const
    CMapStringToStringForwardRange::CPair&
    CMapWordToObForwardstd::pair<WORD,CObject*> const
    CMapWordToPtrForwardstd::pair<WORD,void*> const
    -

    Other Boost.Range metafunctions are defined by the following. -Let Range be any type listed above and ReF be the same as range_reference<Range>::type. -range_value<Range>::type is the same as remove_reference<remove_const<Ref>::type>::type, -range_difference<Range>::type is the same as std::ptrdiff_t, and -range_pointer<Range>::type is the same as add_pointer<remove_reference<Ref>::type>::type. -As for const Range, see const Ranges.

    -
    -
    -

    ATL Ranges

    -

    If the <boost/range/atl.hpp> is included before or after Boost.Range headers, -the ATL collections and strings become models of Range. -The table below lists the Traversal Category and range_reference of ATL ranges.

    - ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    RangeTraversal Categoryrange_reference<Range>::type
    CAtlArray<E,ET>Random AccessE&
    CAutoPtrArray<E>Random AccessE&
    CInterfaceArray<I,pi>Random AccessCComQIPtr<I,pi>&
    CAtlList<E,ET>BidirectionalE&
    CAutoPtrList<E>BidirectionalE&
    CHeapPtrList<E,A>BidirectionalE&
    CInterfaceList<I,pi>BidirectionalCComQIPtr<I,pi>&
    CAtlMap<K,V,KT,VT>ForwardRange::CPair&
    CRBTree<K,V,KT,VT>BidirectionalRange::CPair&
    CRBMap<K,V,KT,VT>BidirectionalRange::CPair&
    CRBMultiMap<K,V,KT,VT>BidirectionalRange::CPair&
    CSimpleStringT<B,b>Random AccessB&
    CStringT<B,ST>Random AccessB&
    CFixedStringT<S,n>Random Accessrange_reference<S>::type
    CStringT<B,ST>Random AccessB&
    CComBSTRRandom AccessOLECHAR&
    CSimpleArray<T,TE>Random AccessT&
    -

    Other Boost.Range metafunctions are defined by the following. -Let Range be any type listed above and ReF be the same as range_reference<Range>::type. -range_value<Range>::type is the same as remove_reference<Ref>::type, -range_difference<Range>::type is the same as std::ptrdiff_t, and -range_pointer<Range>::type is the same as add_pointer<remove_reference<Ref>::type>::type. -As for const Range, see const Ranges.

    -
    -
    -

    const Ranges

    -

    range_reference<const Range>::type is defined by the following algorithm. -Let Range be any type listed above and ReF be the same as range_reference<Range>::type.

    -
    -if (Range is CObArray || Range is CObList)
    -    return CObject const * &
    -else if (Range is CPtrArray || Range is CPtrList)
    -    return void const * &
    -else if (there is a type X such that X& is the same as ReF)
    -    return X const &
    -else if (there is a type X such that X* const is the same as ReF)
    -    return X const * const
    -else
    -    return ReF
    -
    -

    Other Boost.Range metafunctions are defined by the following. -range_value<const Range>::type is the same as range_value<Range>::type, -range_difference<const Range>::type is the same as std::ptrdiff_t, and -range_pointer<const Range>::type is the same as add_pointer<remove_reference<range_reference<const Range>::type>::type>::type.

    -
    - -
    - - diff --git a/doc/portability.html b/doc/portability.html deleted file mode 100644 index bb73e78..0000000 --- a/doc/portability.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - Boost.Range Portability - - - - - - - - - - -

    Boost.Range

    - -

    Portability

    - -

    - A huge effort has been made to port the library to as many compilers as possible. -

    - -

    - Full support for built-in arrays require that the compiler supports class - template partial specialization. For non-conforming compilers there might be a - chance that it works anyway thanks to workarounds in the type traits library. -

    -

    Visual C++ 6/7.0 has a limited support for arrays: as long as the arrays - are of built-in type it should work. -

    -

    - Notice also that some compilers cannot do function template ordering properly. - In that case one must rely on range_iterator - and a single function definition instead of overloaded versions for const and - non-const arguments. - - So if one cares about old compilers, one should not pass rvalues to the - functions. -

    - -

    - For maximum portability you should follow these guidelines: - -

      -
    1. - do not use built-in arrays, -
    2. - do not pass rvalues to begin(), end() and - iterator_range Range constructors and assignment operators, -
    3. - use const_begin() - and const_end() - whenever your code by intention is read-only; this will also solve - most rvalue problems, -
    4. - do not rely on ADL: -
        -
      • - if you overload functions, include that header before the headers in this - library, -
      • - put all overloads in namespace boost. -
      - -
    -

    - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    > - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/range.html b/doc/range.html deleted file mode 100644 index 8646141..0000000 --- a/doc/range.html +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - Range Concepts - - - - - - - - -

    Boost.Range

    - -

    Range concepts

    - - - - -
    -

    Overview

    - -

    - A Range is a concept similar to the STL Container concept. A - Range provides iterators for accessing a half-open range -[first,one_past_last) of elements and provides - information about the number of elements in the Range. However, a Range has - much fewer requirements than a Container. -

    -

    - The motivation for the Range concept is - that there are many useful Container-like types that do not meet the full - requirements of Container, and many algorithms that can be written with this - reduced set of requirements. In particular, a Range does not necessarily - -

      -
    • - own the elements that can be accessed through it, -
    • - have copy semantics, - -
    - - - Because of the second requirement, a Range object must be passed by - (const or non-const) reference in generic code. - -

    -

    - The operations that can be performed on a Range is dependent on the - traversal -category of the underlying iterator type. Therefore - the range concepts are named to reflect which traversal category their - iterators support. See also terminology and style - guidelines. for more information about naming of ranges.

    - -

    The concepts described below specifies associated types as -metafunctions and all -functions as free-standing functions to allow for a layer of indirection.

    - - - -
    - -

    Single Pass Range

    - -

    Notation

    - - - - - - - - - -
    XA type that is a model of Single Pass Range.
    aObject of type X.
    - - -

    Description

    -

    - A range X where boost::range_iterator<X>::type is a model of -Single Pass Iterator - -

    - - -

    Associated types

    - - - - - - - - - - - - - -
    Iterator typeboost::range_iterator<X>::typeThe type of iterator used to iterate through a Range's elements. - The iterator's value type is expected to be the Range's value type. A - conversion from the iterator type to the const iterator type must exist. -
    Const iterator typeboost::range_iterator<const X>::typeA type of iterator that may be used to examine, but not to - modify, a Range's elements.
    - - -

    Valid expressions

    - - The following expressions must be valid. -

    - - - - - - - - - - - - - - - - - -
    NameExpressionReturn type
    Beginning of rangeboost::begin(a)boost::range_iterator<X>::type if -a is mutable, boost::range_iterator<const X>::type -otherwise
    End of rangeboost::end(a)boost::range_iterator<X>::type if -a is mutable, boost::range_iterator<const X>::type -otherwise
    -

    Expression semantics

    - - - - - - - - - - - - - - - - - - -
    ExpressionSemanticsPostcondition
    boost::begin(a)Returns an iterator pointing to the first element in the Range.boost::begin(a) is either dereferenceable or past-the-end. - It is past-the-end if and only if boost::distance(a) == 0.
    boost::end(a)Returns an iterator pointing one past the last element in the - Range.boost::end(a) is past-the-end.
    - -

    Complexity guarantees

    - - boost::end(a) is at most amortized linear time, boost::begin(a) is - amortized constant time. For most practical - purposes, one can expect both to be amortized constant time. - -

    Invariants

    - - - - - - - - - -
    Valid rangeFor any Range a, [boost::begin(a),boost::end(a)) is - a valid range, that is, boost::end(a) is reachable from boost::begin(a) - in a finite number of increments.
    CompletenessAn algorithm that iterates through the range [boost::begin(a),boost::end(a)) - will pass through every element of a.
    - - -

    See also

    -

    Extending the library for UDTs

    -

    Implementation of - metafunctions

    - -

    Implementation of - functions

    -

    - Container -

    - - -
    -

    Forward Range

    - -

    Notation

    - - - - - - - - - -
    XA type that is a model of Forward Range.
    aObject of type X.
    - -

    Description

    -

    - A range X where boost::range_iterator<X>::type is a model -of Forward Traversal Iterator -

    - -

    Refinement of

    Single Pass -Range - -

    - -
    - -

    Bidirectional Range

    - -

    Notation

    - - - - - - - - - -
    XA type that is a model of Bidirectional Range.
    aObject of type X.
    - -

    Description

    This concept provides access to iterators that traverse in - both directions (forward and reverse). The -boost::range_iterator<X>::type iterator must meet all of the requirements -of Bidirectional Traversal Iterator. - -

    Refinement of

    Forward Range - - -

    - -
    - -

    Random Access Range

    -

    Description

    -

    - A range X where boost::range_iterator<X>::type is a model -of Random Access Traversal Iterator -

    - -

    Refinement of

    -

    - Bidirectional Range -

    - -
    - -

    Concept Checking

    - - Each of the range concepts has a corresponding concept checking - class in the file <boost/range/concepts.hpp>. These classes may be - used in conjunction with the Boost Concept - Check library to insure that the type of a template parameter - is compatible with a range concept. If not, a meaningful compile - time error is generated. Checks are provided for the range - concepts related to iterator traversal categories. For example, - the following line checks that the type T models the - ForwardRange concept. - -
    -    function_requires<ForwardRangeConcept<T> >();
    -    
    - - An additional concept check is required for the value access - property of the range based on the range's iterator type. For - example to check for a ForwardReadableRange, the following code is - required. - -
    -    function_requires<ForwardRangeConcept<T> >();
    -    function_requires<
    -        ReadableIteratorConcept<
    -            typename range_iterator<T>::type
    -        >
    -    >();
    -    
    - - The following range concept checking classes are provided. - - -

    See also

    -

    Range Terminology and style guidelines

    -

    Iterator Concepts

    -

    Boost Concept Check library

    - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/style.html b/doc/style.html deleted file mode 100644 index 4240a8c..0000000 --- a/doc/style.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - Boost.Range Terminology and Style Guidelines - - - - - - - - - - -

    Boost.Range

    - -

    Terminology and style guidelines

    - -

    - The use of a consistent terminology is as important for Ranges - and range-based algorithms as it is for iterators and iterator-based algorithms. - If a conventional set of names are adopted, we can avoid misunderstandings and - write generic function prototypes that are self-documenting. -

    - -

    - Since ranges are characterized by a specific underlying iterator type, we get a - type of range for each type of iterator. Hence we can speak of the following - types of ranges: -

    - Notice how we have used the categories from the new - style iterators. - -

    - Notice that an iterator (and therefore an range) has one traversal - property and one or more properties from the value access category. So in - reality we will mostly talk about mixtures such as -

      -
    • - Random Access Readable Writeable Range -
    • - Forward Lvalue Range -
    - By convention, we should always specify the traversal property first as - done above. This seems reasonable since there will only be one traversal - property, but perhaps many value access properties. -

    - -

    - It might, however, be reasonable to specify only one category if the other - category does not matter. For example, the iterator_range can be constructed from - a Forward Range. This means that we do not care about what value access - properties the Range has. Similarly, a Readable Range will be one that has the - lowest possible traversal property (Single Pass). -

    - -

    - As another example, consider how we specify the interface of std::sort(). - Algorithms are usually more cumbersome to specify the interface of since both traversal - and value access properties must be exactly defined. The iterator-based - version looks like this: - -

    -   template< class RandomAccessTraversalReadableWritableIterator >
    -   void sort( RandomAccessTraversalReadableWritableIterator first,
    -              RandomAccessTraversalReadableWritableIterator last );
    -   
    - For ranges the interface becomes - -
    -   template< class RandomAccessReadableWritableRange >
    -   void sort( RandomAccessReadableWritableRange& r );
    -   
    -

    -

    - -

    - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/upgrading.html b/doc/upgrading.html deleted file mode 100644 index f94e73b..0000000 --- a/doc/upgrading.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - Boost.Range Upgrading - - - - - - - - - -

    Boost.Range

    - -

    Upgrading from Boost v. 1.34.*

    -

    - Boost v. 1.35 introduced some larger refactorings of the library: -

    -
      -
    • Direct support for character arrays was abandoned in favor of - uniform treatment of all arrays. Instead string algorithms can use - the new function as_literal().
    • -
    • boost::size() now requires a Random Access Range. The old behavior is provided as boost::distance()
    • -
    • range_size<T>::type has been completely removed - in favor of range_difference<T>::type -
    • - boost_range_begin() and boost_range_end() - have been renamed range_begin() and range_begin(), respectively.
    • - - -
    • range_result_iterator<T>::type and - range_reverse_result_iterator<T>::type are have - been renamed - range_iterator<T>::type and - range_reverse_iterator<T>::type. -
    • -
    • The procedure that makes a custom type work with the library - has been greatly simplified. See extending the library - for details.
    • -
    - - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/utility_class.html b/doc/utility_class.html deleted file mode 100644 index 956bf99..0000000 --- a/doc/utility_class.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - Boost.Range Utilities - - - - - - - - - -

    Boost.Range

    - -

    Utilities

    -

    - Having an abstraction that encapsulates a pair of iterators is very useful. The - standard library uses std::pair in some circumstances, but that - class is cumbersome to use because we need to specify two template arguments, - and for all range algorithm purposes we must enforce the two template arguments - to be the same. Moreover, std::pair<iterator,iterator> is hardly - self-documenting whereas more domain specific class names are. Therefore these - two classes are provided: - -

    - - The iterator_range class is templated on a Forward - Traversal Iterator and should be used whenever fairly general code is needed. - The sub_range class is templated on a Forward Range and it is less general, - but a bit easier to use since its template - argument is easier to specify. The biggest difference is, however, that a - sub_range can propagate constness because it knows what a -corresponding const_iterator is.

    - -

    - Both classes can be used as ranges since they implement the minimal interface - required for this to work automatically. -

    - -
    -

    Class iterator_range

    -

    - The intention of the iterator_range class is to encapsulate two - iterators so they fulfill the Forward Range concept. A few other - functions are also provided for convenience. -

    -

    - If the template argument is not a model of Forward Traversal Iterator, one can - still use a subset of the interface. In particular, size() requires - Random Access Iterators whereas empty() only requires Single - Pass Iterators. -

    - -

    - Recall that many default constructed iterators - are singular and hence can only be assigned, but not compared or - incremented or anything. Likewise, if one creates a default constructed - iterator_range, then one have to be careful about not doing - anything besides copying.

    - -

    Synopsis

    - -
    -namespace boost
    -{
    -    template< class ForwardTraversalIterator >
    -    class iterator_range
    -    {
    -    public: // Forward Range types
    -        typedef ForwardTraversalIterator             iterator;
    -        typedef ForwardTraversalIterator             const_iterator;
    -        typedef iterator_difference<iterator>::type  difference_type;
    - 
    -    public: // construction, assignment
    -        template< class ForwardTraversalIterator2 >
    -        iterator_range( ForwardTraversalIterator2 Begin, ForwardTraversalIterator2 End );
    -                    
    -        template< class ForwardRange >
    -        iterator_range( ForwardRange& r );
    -  
    -        template< class ForwardRange >
    -        iterator_range( const ForwardRange& r );
    -        
    -        template< class ForwardRange >
    -        iterator_range& operator=( ForwardRange& r );
    -
    -        template< class ForwardRange >
    -        iterator_range& operator=( const ForwardRange& r );
    -    
    -    public: // Forward Range functions
    -        iterator        begin() const;
    -        iterator        end() const;
    -        difference_type size() const;
    -        bool            empty() const;
    -        
    -    public: // convenience
    -        operator        unspecified_bool_type() const;
    -        bool            equal( const iterator_range& ) const;
    -        reference       front() const;
    -        reference       back() const;
    -        iterator_range& advance_begin( difference_type n );
    -        iterator_range& advance_end( difference_type n );
    -        // for Random Access Range only: 
    -        reference       operator[]( difference_type at ) const;
    -        value_type      operator()( difference_type at ) const;
    -    };
    -    
    -    // stream output
    -    template< class ForwardTraversalIterator, class T, class Traits >
    -    std::basic_ostream<T,Traits>& 
    -    operator<<( std::basic_ostream<T,Traits>& Os,
    -                const iterator_range<ForwardTraversalIterator>& r );
    -
    -    // comparison
    -    template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
    -    bool operator==( const iterator_range<ForwardTraversalIterator>& l, 
    -                     const iterator_range<ForwardTraversalIterator2>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator==( const iterator_range<ForwardTraversalIterator>& l, 
    -                     const ForwardRange& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator==( const ForwardRange& l,
    -                     const iterator_range<ForwardTraversalIterator>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
    -    bool operator!=( const iterator_range<ForwardTraversalIterator>& l, 
    -                     const iterator_range<ForwardTraversalIterator2>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator!=( const iterator_range<ForwardTraversalIterator>& l, 
    -                     const ForwardRange& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator!=( const ForwardRange& l,
    -                     const iterator_range<ForwardTraversalIterator>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
    -    bool operator<( const iterator_range<ForwardTraversalIterator>& l, 
    -                    const iterator_range<ForwardTraversalIterator2>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator<( const iterator_range<ForwardTraversalIterator>& l, 
    -                    const ForwardRange& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator<( const ForwardRange& l,
    -                    const iterator_range<ForwardTraversalIterator>& r );
    - 
    -    // external construction
    -    template< class ForwardTraversalIterator >
    -    iterator_range< ForwardTraversalIterator >
    -    make_iterator_range( ForwardTraversalIterator Begin, 
    -                         ForwardTraversalIterator End );
    -       
    -    template< class ForwardRange >
    -    iterator_range< typename range_iterator<ForwardRange>::type >
    -    make_iterator_range( ForwardRange& r );
    -
    -    template< class ForwardRange >
    -    iterator_range< typename range_iterator<const ForwardRange>::type >
    -    make_iterator_range( const ForwardRange& r );
    -    
    -    template< class Range >
    -    iterator_range< typename range_iterator<Range>::type >
    -    make_iterator_range( Range& r,
    -                         typename range_difference<Range>::type advance_begin,
    -                         typename range_difference<Range>::type advance_end );
    -    
    -    template< class Range >
    -    iterator_range< typename range_iterator<const Range>::type >
    -    make_iterator_range( const Range& r, 
    -                         typename range_difference<Range>::type advance_begin,
    -                         typename range_difference<Range>::type advance_end );
    -    
    -    // convenience
    -    template< class Sequence, class ForwardRange >
    -    Sequence copy_range( const ForwardRange& r );
    -    
    -} // namespace 'boost'
    -    
    - -

    - If an instance of -iterator_range is constructed by a client with two iterators, the -client must ensure that the two iterators delimit a valid closed-open range -[begin,end). -

    - -

    -It is worth noticing that the templated constructors and assignment operators -allow conversion from iterator_range<iterator> to -iterator_range<const_iterator>. Similarly, since the comparison -operators have two template arguments, we can compare ranges whenever the -iterators are comparable; for example when we are dealing with const and -non-const iterators from the same container.

    - -

    Details member functions

    - -

    - -operator unspecified_bool_type() const; -

    -Returns !empty(); -
    -

    - -

    - -bool equal( iterator_range& r ) const; -

    - Returns begin() == r.begin() && end() == r.end(); -
    -

    - -

    Details functions

    - -

    - -bool operator==( const ForwardRange1& l, const ForwardRange2& r ); -

    - Returns size(l) != size(r) ? false : std::equal( begin(l), end(l), begin(r) );

    -bool operator!=( const ForwardRange1& l, const ForwardRange2& r ); -
    - Returns !( l == r ); -
    -bool operator<( const ForwardRange1& l, const ForwardRange2& r ); -
    - Returns std::lexicographical_compare( begin(l), end(l), begin(r), end(r) );
    - -

    - -

    -iterator_range make_iterator_range( Range& r, 
    -                                    typename range_difference<Range>::type advance_begin, 
    -                                    typename range_difference<Range>::type advance_end );
    -
    -
    - Effects: -
    -iterator new_begin = begin( r ),
    -iterator new_end   = end( r );
    -std::advance( new_begin, advance_begin );
    -std::advance( new_end, advance_end );
    -return make_iterator_range( new_begin, new_end );
    -
    -
    -

    - -Sequence copy_range( const ForwardRange& r ); -

    - Returns Sequence( begin(r), end(r) ); -
    -

    - -
    -

    Class sub_range

    - -The sub_range class inherits all its functionality -from the iterator_range class. -The sub_range class is often easier to use because -one must specify the Forward Range -template argument instead of an iterator. Moreover, the sub_range -class can propagate constness since it knows what a corresponding -const_iterator is. - -

    Synopsis

    - -
    -namespace boost
    -{
    -    template< class ForwardRange >
    -    class sub_range : public iterator_range< typename range_iterator<ForwardRange>::type >
    -    {
    -    public: 
    -        typedef typename range_iterator<ForwardRange>::type iterator;
    -        typedef typename range_iterator<const ForwardRange>::type  const_iterator;
    -        typedef typename iterator_difference<iterator>::type       difference_type;
    -    
    -
    -    public: // construction, assignment
    -        template< class ForwardTraversalIterator >
    -        sub_range( ForwardTraversalIterator Begin, ForwardTraversalIterator End );
    -
    -        template< class ForwardRange2 >
    -        sub_range( ForwardRange2& r );
    -         
    -        template< class ForwardRange2 >
    -        sub_range( const ForwardRange2& r );
    -         
    -        template< class ForwardRange2 >
    -        sub_range& operator=( ForwardRange2& r );
    -
    -        template< class ForwardRange2 >
    -        sub_range& operator=( const ForwardRange2& r );    
    -    
    -    public:  // Forward Range functions 
    -        iterator        begin();
    -        const_iterator  begin() const;
    -        iterator        end();
    -        const_iterator  end() const;    
    -        
    -    public: // convenience 
    -        value_type&       front();
    -        const value_type& front() const;
    -        value_type&       back();
    -        const value_type& back() const;
    -        // for Random Access Range only: 
    -        value_type&       operator[]( difference_type at );
    -        const value_type& operator[]( difference_type at ) const;
    -    
    -    public:
    -        // rest of interface inherited from iterator_range
    -    };
    -    
    -} // namespace 'boost'
    -
    - -

    - The class should be trivial to use as seen below. - Imagine that we have an algorithm that searches for a sub-string in a string. - The - result is an iterator_range, that delimits the match. We need to -store the result - from this algorithm. Here is an example of how we can do it with and without -sub_range -

    -    std::string str("hello");
    -    iterator_range<std::string::iterator> ir = find_first( str, as_literal("ll") );
    -    sub_range<std::string>               sub = find_first( str, as_literal("ll") );
    -
    -

    - -
    -

    - © Copyright Thorsten Ottosen 2008. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - From dfc30e334dfa96bb21ddbaf10087afda586e6dc6 Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Wed, 14 Apr 2010 21:15:41 +0000 Subject: [PATCH 33/73] Boost.Range merged defect fix for iterator_range. [SVN r61280] --- include/boost/range/iterator_range_core.hpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/include/boost/range/iterator_range_core.hpp b/include/boost/range/iterator_range_core.hpp index c1822fb..497b1e3 100755 --- a/include/boost/range/iterator_range_core.hpp +++ b/include/boost/range/iterator_range_core.hpp @@ -290,23 +290,11 @@ namespace boost return *--last; } - -#ifdef __SUNPRO_CC reference operator[]( difference_type at ) const { BOOST_ASSERT( at >= 0 && at < size() ); return m_Begin[at]; } -#else - BOOST_DEDUCED_TYPENAME boost::detail::operator_brackets_result::type - operator[]( difference_type at ) const - { - BOOST_ASSERT( at >= 0 && at < size() ); - - typedef boost::detail::use_operator_brackets_proxy use_proxy; - return boost::detail::make_operator_brackets_result(m_Begin + at, use_proxy()); - } -#endif // // When storing transform iterators, operator[]() From a47f15a98fe609d701c4d034cf116cb03612d202 Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Fri, 23 Apr 2010 22:50:56 +0000 Subject: [PATCH 34/73] Boost.Range merge from trunk to release. This is motivated by the need to correct the istream_range, to correct the adaptors.hpp header file, and correct the return types of various range algorithms. [SVN r61517] --- doc/counting_range.html | 70 ----- doc/headers.qbk | 2 +- doc/html/index.html | 6 +- doc/html/quickbook_HTML.manifest | 2 + doc/html/range/concepts.html | 2 +- .../range/concepts/bidirectional_range.html | 18 +- doc/html/range/concepts/concept_checking.html | 4 +- doc/html/range/concepts/forward_range.html | 12 +- doc/html/range/concepts/overview.html | 2 +- .../range/concepts/random_access_range.html | 14 +- .../range/concepts/single_pass_range.html | 18 +- doc/html/range/examples.html | 2 +- doc/html/range/faq.html | 2 +- doc/html/range/history_ack.html | 2 +- doc/html/range/introduction.html | 2 +- doc/html/range/library_headers.html | 6 +- doc/html/range/mfc_atl.html | 6 +- doc/html/range/mfc_atl/atl_ranges.html | 2 +- doc/html/range/mfc_atl/const_ranges.html | 2 +- doc/html/range/mfc_atl/mfc_ranges.html | 2 +- doc/html/range/mfc_atl/references.html | 2 +- doc/html/range/mfc_atl/requirements.html | 2 +- doc/html/range/portability.html | 2 +- doc/html/range/reference.html | 2 +- doc/html/range/reference/adaptors.html | 2 +- .../adaptors_general_requirements.html | 2 +- .../adaptors/adaptors_introduction.html | 8 +- .../adaptors/adaptors_reference.html | 2 +- .../adaptors_reference/adjacent_filtered.html | 2 +- .../adaptors/adaptors_reference/copied.html | 2 +- .../adaptors/adaptors_reference/filtered.html | 2 +- .../adaptors/adaptors_reference/indexed.html | 2 +- .../adaptors_reference/indirected.html | 2 +- .../adaptors/adaptors_reference/map_keys.html | 2 +- .../adaptors_reference/map_values.html | 2 +- .../adaptors/adaptors_reference/replaced.html | 2 +- .../adaptors_reference/replaced_if.html | 2 +- .../adaptors/adaptors_reference/reversed.html | 2 +- .../adaptors/adaptors_reference/sliced.html | 2 +- .../adaptors/adaptors_reference/strided.html | 2 +- .../adaptors_reference/tokenized.html | 2 +- .../adaptors_reference/transformed.html | 2 +- .../adaptors/adaptors_reference/uniqued.html | 2 +- .../reference/adaptors/adaptors_synopsis.html | 2 +- doc/html/range/reference/algorithms.html | 2 +- .../reference/algorithms/heap_algorithms.html | 4 +- .../algorithms/heap_algorithms/make_heap.html | 26 +- .../algorithms/heap_algorithms/pop_heap.html | 22 +- .../algorithms/heap_algorithms/push_heap.html | 22 +- .../algorithms/heap_algorithms/sort_heap.html | 153 ++++++++++ .../algorithms/permutation_algorithms.html | 8 +- .../next_permutation.html | 20 +- .../prev_permutation.html | 20 +- .../range_algorithm_introduction.html | 2 +- .../range_algorithm_mutating_algorithms.html | 4 +- .../copy.html | 14 +- .../copy_backward.html | 14 +- .../fill.html | 23 +- .../fill_n.html | 102 +++++++ .../generate.html | 20 +- .../inplace_merge.html | 18 +- .../merge.html | 18 +- .../nth_element.html | 42 +-- .../partial_sort.html | 42 +-- .../partition.html | 12 +- .../random_shuffle.html | 14 +- .../remove.html | 12 +- .../remove_if.html | 12 +- .../replace.html | 12 +- .../replace_if.html | 12 +- .../rotate.html | 14 +- .../sort.html | 12 +- .../stable_partition.html | 12 +- .../stable_sort.html | 12 +- .../transform.html | 14 +- .../unique.html | 12 +- .../range_algorithm_new_algorithms.html | 2 +- .../range_algorithm_new_algorithms/erase.html | 30 +- .../for_each.html | 12 +- .../insert.html | 18 +- .../range_algorithm_new_algorithms/iota.html | 22 +- .../overwrite.html | 12 +- .../push_back.html | 16 +- .../push_front.html | 16 +- .../remove_erase.html | 23 +- .../remove_erase_if.html | 21 +- ...nge_algorithm_non_mutating_algorithms.html | 2 +- .../adjacent_find.html | 12 +- .../binary_search.html | 14 +- .../count.html | 12 +- .../equal.html | 12 +- .../equal_range.html | 14 +- .../find.html | 12 +- .../find_end.html | 12 +- .../find_first_of.html | 12 +- .../find_if.html | 14 +- .../for_each.html | 12 +- .../lexicographical_compare.html | 12 +- .../lower_bound.html | 14 +- .../max_element.html | 12 +- .../min_element.html | 12 +- .../mismatch.html | 14 +- .../search.html | 12 +- .../upper_bound.html | 14 +- .../reference/algorithms/range_numeric.html | 2 +- .../algorithms/range_numeric/accumulate.html | 16 +- .../range_numeric/adjacent_difference.html | 18 +- .../range_numeric/inner_product.html | 18 +- .../algorithms/range_numeric/partial_sum.html | 18 +- .../reference/algorithms/set_algorithms.html | 2 +- .../algorithms/set_algorithms/includes.html | 14 +- .../set_algorithms/set_difference.html | 14 +- .../set_algorithms/set_intersection.html | 14 +- .../set_symmetric_difference.html | 14 +- .../algorithms/set_algorithms/set_union.html | 14 +- doc/html/range/reference/extending.html | 2 +- .../range/reference/extending/method_1.html | 2 +- .../range/reference/extending/method_2.html | 2 +- .../range/reference/extending/method_3.html | 2 +- .../extending/method_3/method_3_1.html | 2 +- .../extending/method_3/method_3_2.html | 2 +- doc/html/range/reference/overview.html | 2 +- doc/html/range/reference/ranges.html | 2 +- .../reference/ranges/counting_range.html | 10 +- doc/html/range/reference/ranges/irange.html | 12 +- .../range/reference/ranges/istream_range.html | 8 +- doc/html/range/reference/semantics.html | 4 +- .../range/reference/semantics/functions.html | 2 +- .../reference/semantics/metafunctions.html | 2 +- doc/html/range/reference/synopsis.html | 2 +- doc/html/range/style_guide.html | 2 +- doc/html/range/upgrade.html | 2 +- doc/html/range/upgrade/upgrade_from_1_34.html | 2 +- doc/html/range/upgrade/upgrade_from_1_42.html | 2 +- doc/html/range/utilities.html | 2 +- doc/html/range/utilities/iterator_range.html | 8 +- doc/html/range/utilities/join.html | 6 +- doc/html/range/utilities/sub_range.html | 4 +- doc/reference/algorithm/fill.qbk | 5 +- doc/reference/algorithm/fill_n.qbk | 31 ++ doc/reference/algorithm/make_heap.qbk | 10 +- doc/reference/algorithm/next_permutation.qbk | 10 +- doc/reference/algorithm/nth_element.qbk | 30 +- doc/reference/algorithm/partial_sort.qbk | 30 +- doc/reference/algorithm/pop_heap.qbk | 10 +- doc/reference/algorithm/prev_permutation.qbk | 10 +- doc/reference/algorithm/push_heap.qbk | 10 +- doc/reference/algorithm/sort_heap.qbk | 10 +- doc/reference/algorithm_ext/erase.qbk | 14 +- doc/reference/algorithm_ext/insert.qbk | 6 +- doc/reference/algorithm_ext/iota.qbk | 6 +- doc/reference/algorithm_ext/push_back.qbk | 4 +- doc/reference/algorithm_ext/push_front.qbk | 4 +- doc/reference/algorithm_ext/remove_erase.qbk | 11 +- .../algorithm_ext/remove_erase_if.qbk | 9 +- doc/reference/algorithms.qbk | 2 + .../boost/range/adaptor/adjacent_filtered.hpp | 288 +++++++++--------- include/boost/range/adaptor/argument_fwd.hpp | 92 +++--- include/boost/range/adaptor/copied.hpp | 52 ++-- include/boost/range/adaptor/filtered.hpp | 134 ++++---- include/boost/range/adaptor/indexed.hpp | 128 ++++---- include/boost/range/adaptor/indirected.hpp | 96 +++--- include/boost/range/adaptor/map.hpp | 284 ++++++++--------- include/boost/range/adaptor/replaced.hpp | 160 +++++----- include/boost/range/adaptor/replaced_if.hpp | 184 +++++------ include/boost/range/adaptor/reversed.hpp | 132 ++++---- include/boost/range/adaptor/strided.hpp | 226 +++++++------- include/boost/range/adaptor/tokenized.hpp | 214 ++++++------- include/boost/range/adaptor/transformed.hpp | 152 ++++----- include/boost/range/adaptor/uniqued.hpp | 126 ++++---- include/boost/range/adaptors.hpp | 3 +- include/boost/range/algorithm/equal.hpp | 2 +- include/boost/range/algorithm/generate.hpp | 9 - .../boost/range/algorithm/heap_algorithm.hpp | 88 +----- include/boost/range/algorithm/nth_element.hpp | 16 +- .../boost/range/algorithm/partial_sort.hpp | 25 +- .../range/algorithm/partial_sort_copy.hpp | 16 +- include/boost/range/algorithm/partition.hpp | 20 -- .../boost/range/algorithm/random_shuffle.hpp | 18 -- include/boost/range/algorithm/remove.hpp | 20 -- .../boost/range/algorithm/remove_copy_if.hpp | 2 +- include/boost/range/algorithm/remove_if.hpp | 20 -- include/boost/range/algorithm/replace.hpp | 11 - include/boost/range/algorithm/replace_if.hpp | 11 - include/boost/range/algorithm/reverse.hpp | 9 - .../boost/range/algorithm/reverse_copy.hpp | 10 +- include/boost/range/algorithm/rotate.hpp | 15 +- include/boost/range/algorithm/rotate_copy.hpp | 6 +- include/boost/range/algorithm/search.hpp | 14 +- include/boost/range/algorithm/search_n.hpp | 50 +-- include/boost/range/algorithm/sort.hpp | 18 -- include/boost/range/algorithm/stable_sort.hpp | 18 -- include/boost/range/algorithm/swap_ranges.hpp | 12 +- .../boost/range/algorithm_ext/for_each.hpp | 78 ++--- include/boost/range/counting_range.hpp | 58 ++-- .../detail/demote_iterator_traversal_tag.hpp | 8 +- include/boost/range/istream_range.hpp | 23 +- include/boost/range/join.hpp | 44 +-- include/boost/range/numeric.hpp | 102 +++---- include/boost/range/size_type.hpp | 2 +- include/boost/range/unbounded_range.hpp | 73 ----- test/Jamfile.v2 | 3 + .../adjacent_filtered_example.cpp | 2 +- test/adaptor_test/copied_example.cpp | 2 +- test/adaptor_test/strided2.cpp | 67 ++++ test/algorithm_ext_test/push_front.cpp | 19 +- test/algorithm_test/find.cpp | 20 +- test/algorithm_test/find_end.cpp | 38 +-- test/algorithm_test/find_first_of.cpp | 38 +-- test/algorithm_test/find_if.cpp | 20 +- test/algorithm_test/for_each.cpp | 2 +- test/algorithm_test/lower_bound.cpp | 44 +-- test/algorithm_test/max_element.cpp | 34 +-- test/algorithm_test/min_element.cpp | 34 +-- test/algorithm_test/partition.cpp | 18 +- test/algorithm_test/stable_partition.cpp | 18 +- test/algorithm_test/unique.cpp | 34 +-- test/algorithm_test/upper_bound.cpp | 48 +-- test/counting_range.cpp | 2 +- test/istream_range.cpp | 51 ++++ test/iterator_range.cpp | 2 +- test/pointer_as_iterator.cpp | 39 +++ test/test_driver/range_return_test_driver.hpp | 30 +- 223 files changed, 2754 insertions(+), 2666 deletions(-) delete mode 100755 doc/counting_range.html create mode 100644 doc/html/range/reference/algorithms/heap_algorithms/sort_heap.html create mode 100644 doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill_n.html create mode 100644 doc/reference/algorithm/fill_n.qbk delete mode 100755 include/boost/range/unbounded_range.hpp create mode 100644 test/adaptor_test/strided2.cpp create mode 100644 test/istream_range.cpp create mode 100644 test/pointer_as_iterator.cpp diff --git a/doc/counting_range.html b/doc/counting_range.html deleted file mode 100755 index c44edcc..0000000 --- a/doc/counting_range.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - Boost.Range Utilities - - - - - - - - - -

    Boost.Range

    -

    Function counting_range

    -

    - The intention of the counting_range function is to construct - a new range with iterators that are wrapped in a - counting_iterator (from Boost.Iterator) -

    - -

    Synopsis

    - -
    namespace boost
    -{
    -    template< class Incrementable > inline
    -    range< counting_iterator<Incrementable> >
    -    counting_range(Incrementable first, Incrementable last);
    -
    -    template< class SinglePassRange > inline
    -    range< counting_iterator<typename range_iterator<SinglePassRange>::type >
    -    counting_range(const Range& rng);
    -
    -    template< class SinglePassRange > inline
    -    range< counting_iterator<typename range_iterator<SinglePassRange>::type >
    -    counting_range(Range& rng);
    -            
    -} // namespace 'boost'
    -    
    - -

    - © Copyright Neil Groves 2009. -

    - -

    - Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at www.boost.org/LICENSE_1_0.txt) -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/doc/headers.qbk b/doc/headers.qbk index 6edefbd..9e29745 100644 --- a/doc/headers.qbk +++ b/doc/headers.qbk @@ -2,7 +2,7 @@ [table [[Header ] [Includes ] [Related Concept ]] - [[`` ] [everything ] [- ]] + [[`` ] [everything from Boost.Range version 1 (Boost versions 1.42 and below). Includes the core range functions and metafunctinos, but excludes Range Adaptors and Range Algorithms. ] [- ]] [[`` ] [every metafunction ] [- ]] [[`` ] [every function ] [- ]] [[`` ] [__range_value__ ] [__single_pass_range__ ]] diff --git a/doc/html/index.html b/doc/html/index.html index f5bb91c..27ee9ba 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Chapter 1. Range 2.0 - + @@ -30,7 +30,7 @@
    -

    +

    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)

    @@ -135,7 +135,7 @@

    - +

    Last revised: April 05, 2010 at 17:25:33 GMT

    Last revised: April 11, 2010 at 21:49:16 GMT


    diff --git a/doc/html/quickbook_HTML.manifest b/doc/html/quickbook_HTML.manifest index 67e69fa..df8f151 100644 --- a/doc/html/quickbook_HTML.manifest +++ b/doc/html/quickbook_HTML.manifest @@ -39,6 +39,7 @@ range/reference/algorithms/range_algorithm_mutating_algorithms.html range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html +range/reference/algorithms/range_algorithm_mutating_algorithms/fill_n.html range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html @@ -84,6 +85,7 @@ range/reference/algorithms/heap_algorithms.html range/reference/algorithms/heap_algorithms/push_heap.html range/reference/algorithms/heap_algorithms/pop_heap.html range/reference/algorithms/heap_algorithms/make_heap.html +range/reference/algorithms/heap_algorithms/sort_heap.html range/reference/algorithms/permutation_algorithms.html range/reference/algorithms/permutation_algorithms/next_permutation.html range/reference/algorithms/permutation_algorithms/prev_permutation.html diff --git a/doc/html/range/concepts.html b/doc/html/range/concepts.html index c43b67c..c384122 100644 --- a/doc/html/range/concepts.html +++ b/doc/html/range/concepts.html @@ -3,7 +3,7 @@ Range Concepts - + diff --git a/doc/html/range/concepts/bidirectional_range.html b/doc/html/range/concepts/bidirectional_range.html index 0fc965b..e3ae956 100644 --- a/doc/html/range/concepts/bidirectional_range.html +++ b/doc/html/range/concepts/bidirectional_range.html @@ -3,7 +3,7 @@ Bidirectional Range - + @@ -27,7 +27,7 @@ Bidirectional Range
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -75,7 +75,7 @@ Traversal Iterator.

    - + Refinement of
    @@ -83,7 +83,7 @@ Forward Range

    - + Associated types
    @@ -136,7 +136,7 @@
    - + Valid expressions
    @@ -221,7 +221,7 @@
    - + Complexity guarantees
    @@ -232,7 +232,7 @@ Forward Range.

    - + Invariants
    @@ -272,7 +272,7 @@
    - + See also

    diff --git a/doc/html/range/concepts/concept_checking.html b/doc/html/range/concepts/concept_checking.html index a4aa1d9..b5d5407 100644 --- a/doc/html/range/concepts/concept_checking.html +++ b/doc/html/range/concepts/concept_checking.html @@ -3,7 +3,7 @@ Concept Checking - + @@ -79,7 +79,7 @@

    - + See also

    diff --git a/doc/html/range/concepts/forward_range.html b/doc/html/range/concepts/forward_range.html index f82d8c5..919f6dd 100644 --- a/doc/html/range/concepts/forward_range.html +++ b/doc/html/range/concepts/forward_range.html @@ -3,7 +3,7 @@ Forward Range - + @@ -27,7 +27,7 @@ Forward Range

    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -73,14 +73,14 @@ Traversal Iterator.

    - + Refinement of

    Single Pass Range

    - + Associated types
    @@ -132,7 +132,7 @@
    - + See also

    diff --git a/doc/html/range/concepts/overview.html b/doc/html/range/concepts/overview.html index c2bb4d1..7cd19e8 100644 --- a/doc/html/range/concepts/overview.html +++ b/doc/html/range/concepts/overview.html @@ -3,7 +3,7 @@ Overview - + diff --git a/doc/html/range/concepts/random_access_range.html b/doc/html/range/concepts/random_access_range.html index cc5d88e..a695e97 100644 --- a/doc/html/range/concepts/random_access_range.html +++ b/doc/html/range/concepts/random_access_range.html @@ -3,7 +3,7 @@ Random Access Range - + @@ -27,7 +27,7 @@ Random Access Range

    - + Description

    @@ -35,7 +35,7 @@ Access Traversal Iterator.

    - + Refinement of
    @@ -43,7 +43,7 @@ Bidirectional Range

    - + Valid expressions
    @@ -89,7 +89,7 @@
    - + Expression semantics
    @@ -139,7 +139,7 @@
    - + Complexity guarantees
    @@ -147,7 +147,7 @@ boost::size(a) completes in amortized constant time.

    - + Invariants
    diff --git a/doc/html/range/concepts/single_pass_range.html b/doc/html/range/concepts/single_pass_range.html index 9cb3123..5588147 100644 --- a/doc/html/range/concepts/single_pass_range.html +++ b/doc/html/range/concepts/single_pass_range.html @@ -3,7 +3,7 @@ Single Pass Range - + @@ -27,7 +27,7 @@ Single Pass Range
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -73,7 +73,7 @@ Pass Iterator.

    - + Associated types
    @@ -126,7 +126,7 @@
    - + Valid expressions
    @@ -198,7 +198,7 @@
    - + Expression semantics
    @@ -266,7 +266,7 @@
    - + Complexity guarantees
    @@ -276,7 +276,7 @@ constant time.

    - + Invariants
    @@ -316,7 +316,7 @@
    - + See also

    diff --git a/doc/html/range/examples.html b/doc/html/range/examples.html index f517040..b272df8 100644 --- a/doc/html/range/examples.html +++ b/doc/html/range/examples.html @@ -3,7 +3,7 @@ Examples - + diff --git a/doc/html/range/faq.html b/doc/html/range/faq.html index a5ea15d..0c9d40b 100644 --- a/doc/html/range/faq.html +++ b/doc/html/range/faq.html @@ -3,7 +3,7 @@ FAQ - + diff --git a/doc/html/range/history_ack.html b/doc/html/range/history_ack.html index 2401db3..930b6b6 100644 --- a/doc/html/range/history_ack.html +++ b/doc/html/range/history_ack.html @@ -3,7 +3,7 @@ History and Acknowledgement - + diff --git a/doc/html/range/introduction.html b/doc/html/range/introduction.html index e41a60c..7bedc97 100644 --- a/doc/html/range/introduction.html +++ b/doc/html/range/introduction.html @@ -3,7 +3,7 @@ Introduction - + diff --git a/doc/html/range/library_headers.html b/doc/html/range/library_headers.html index 8f28283..58ddcff 100644 --- a/doc/html/range/library_headers.html +++ b/doc/html/range/library_headers.html @@ -3,7 +3,7 @@ Library Headers - + @@ -58,7 +58,9 @@

    - everything + everything from Boost.Range version 1 (Boost versions 1.42 and below). + Includes the core range functions and metafunctinos, but excludes + Range Adaptors and Range Algorithms.

    diff --git a/doc/html/range/mfc_atl.html b/doc/html/range/mfc_atl.html index 338e860..63558aa 100644 --- a/doc/html/range/mfc_atl.html +++ b/doc/html/range/mfc_atl.html @@ -3,7 +3,7 @@ MFC/ATL (courtesy of Shunsuke Sogame) - + @@ -34,7 +34,7 @@
    References
    - + Introduction

    @@ -100,7 +100,7 @@

    - + Overview

    diff --git a/doc/html/range/mfc_atl/atl_ranges.html b/doc/html/range/mfc_atl/atl_ranges.html index 766375d..65ee355 100644 --- a/doc/html/range/mfc_atl/atl_ranges.html +++ b/doc/html/range/mfc_atl/atl_ranges.html @@ -3,7 +3,7 @@ ATL Ranges - + diff --git a/doc/html/range/mfc_atl/const_ranges.html b/doc/html/range/mfc_atl/const_ranges.html index 222c6d8..2e047f6 100644 --- a/doc/html/range/mfc_atl/const_ranges.html +++ b/doc/html/range/mfc_atl/const_ranges.html @@ -3,7 +3,7 @@ const Ranges - + diff --git a/doc/html/range/mfc_atl/mfc_ranges.html b/doc/html/range/mfc_atl/mfc_ranges.html index 9e6d001..af0c6e9 100644 --- a/doc/html/range/mfc_atl/mfc_ranges.html +++ b/doc/html/range/mfc_atl/mfc_ranges.html @@ -3,7 +3,7 @@ MFC Ranges - + diff --git a/doc/html/range/mfc_atl/references.html b/doc/html/range/mfc_atl/references.html index 8afe82a..124a538 100644 --- a/doc/html/range/mfc_atl/references.html +++ b/doc/html/range/mfc_atl/references.html @@ -3,7 +3,7 @@ References - + diff --git a/doc/html/range/mfc_atl/requirements.html b/doc/html/range/mfc_atl/requirements.html index c49ac8c..131433f 100644 --- a/doc/html/range/mfc_atl/requirements.html +++ b/doc/html/range/mfc_atl/requirements.html @@ -3,7 +3,7 @@ Requirements - + diff --git a/doc/html/range/portability.html b/doc/html/range/portability.html index 63e3621..901e0b1 100644 --- a/doc/html/range/portability.html +++ b/doc/html/range/portability.html @@ -3,7 +3,7 @@ Portability - + diff --git a/doc/html/range/reference.html b/doc/html/range/reference.html index a76673a..70c17dc 100644 --- a/doc/html/range/reference.html +++ b/doc/html/range/reference.html @@ -3,7 +3,7 @@ Reference - + diff --git a/doc/html/range/reference/adaptors.html b/doc/html/range/reference/adaptors.html index bc68382..5ab0ecd 100644 --- a/doc/html/range/reference/adaptors.html +++ b/doc/html/range/reference/adaptors.html @@ -3,7 +3,7 @@ Range Adaptors - + diff --git a/doc/html/range/reference/adaptors/adaptors_general_requirements.html b/doc/html/range/reference/adaptors/adaptors_general_requirements.html index ce2b17b..a815bae 100644 --- a/doc/html/range/reference/adaptors/adaptors_general_requirements.html +++ b/doc/html/range/reference/adaptors/adaptors_general_requirements.html @@ -3,7 +3,7 @@ General Requirements - + diff --git a/doc/html/range/reference/adaptors/adaptors_introduction.html b/doc/html/range/reference/adaptors/adaptors_introduction.html index 3d61175..e1e4e26 100644 --- a/doc/html/range/reference/adaptors/adaptors_introduction.html +++ b/doc/html/range/reference/adaptors/adaptors_introduction.html @@ -3,7 +3,7 @@ Introduction and motivation - + @@ -122,7 +122,7 @@ situations, you will really appreciate the succinctness of operator|().

    - + Composition of Adaptors
    @@ -159,7 +159,7 @@ is the design solution to this problem.

    - + Range Adaptor alternative to copy_if algorithm
    @@ -176,7 +176,7 @@

    - + Range Adaptor alternative to count_if algorithm
    diff --git a/doc/html/range/reference/adaptors/adaptors_reference.html b/doc/html/range/reference/adaptors/adaptors_reference.html index 5a3dae6..d284888 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference.html +++ b/doc/html/range/reference/adaptors/adaptors_reference.html @@ -3,7 +3,7 @@ Reference - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/adjacent_filtered.html b/doc/html/range/reference/adaptors/adaptors_reference/adjacent_filtered.html index df72e28..fa763c8 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/adjacent_filtered.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/adjacent_filtered.html @@ -3,7 +3,7 @@ adjacent_filtered - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/copied.html b/doc/html/range/reference/adaptors/adaptors_reference/copied.html index b488800..650e29a 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/copied.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/copied.html @@ -3,7 +3,7 @@ copied - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/filtered.html b/doc/html/range/reference/adaptors/adaptors_reference/filtered.html index 04d418d..1551a9f 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/filtered.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/filtered.html @@ -3,7 +3,7 @@ filtered - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/indexed.html b/doc/html/range/reference/adaptors/adaptors_reference/indexed.html index 03ec01b..d8c8674 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/indexed.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/indexed.html @@ -3,7 +3,7 @@ indexed - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/indirected.html b/doc/html/range/reference/adaptors/adaptors_reference/indirected.html index 391abcc..adcd57a 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/indirected.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/indirected.html @@ -3,7 +3,7 @@ indirected - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/map_keys.html b/doc/html/range/reference/adaptors/adaptors_reference/map_keys.html index 7af39c9..95c1746 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/map_keys.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/map_keys.html @@ -3,7 +3,7 @@ map_keys - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/map_values.html b/doc/html/range/reference/adaptors/adaptors_reference/map_values.html index 810ba7a..553a8f3 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/map_values.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/map_values.html @@ -3,7 +3,7 @@ map_values - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/replaced.html b/doc/html/range/reference/adaptors/adaptors_reference/replaced.html index 6af8257..0990ede 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/replaced.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/replaced.html @@ -3,7 +3,7 @@ replaced - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/replaced_if.html b/doc/html/range/reference/adaptors/adaptors_reference/replaced_if.html index f916472..abcf00f 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/replaced_if.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/replaced_if.html @@ -3,7 +3,7 @@ replaced_if - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/reversed.html b/doc/html/range/reference/adaptors/adaptors_reference/reversed.html index 2ef6d5d..52f4cda 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/reversed.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/reversed.html @@ -3,7 +3,7 @@ reversed - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/sliced.html b/doc/html/range/reference/adaptors/adaptors_reference/sliced.html index 8901fa0..9793092 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/sliced.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/sliced.html @@ -3,7 +3,7 @@ sliced - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/strided.html b/doc/html/range/reference/adaptors/adaptors_reference/strided.html index ca37e60..6fcc281 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/strided.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/strided.html @@ -3,7 +3,7 @@ strided - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/tokenized.html b/doc/html/range/reference/adaptors/adaptors_reference/tokenized.html index 0b294b2..fc4bc42 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/tokenized.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/tokenized.html @@ -3,7 +3,7 @@ tokenized - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/transformed.html b/doc/html/range/reference/adaptors/adaptors_reference/transformed.html index 1947b6d..56a6170 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/transformed.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/transformed.html @@ -3,7 +3,7 @@ transformed - + diff --git a/doc/html/range/reference/adaptors/adaptors_reference/uniqued.html b/doc/html/range/reference/adaptors/adaptors_reference/uniqued.html index 1f7d9fb..3b314ab 100644 --- a/doc/html/range/reference/adaptors/adaptors_reference/uniqued.html +++ b/doc/html/range/reference/adaptors/adaptors_reference/uniqued.html @@ -3,7 +3,7 @@ uniqued - + diff --git a/doc/html/range/reference/adaptors/adaptors_synopsis.html b/doc/html/range/reference/adaptors/adaptors_synopsis.html index 202a114..d0fea59 100644 --- a/doc/html/range/reference/adaptors/adaptors_synopsis.html +++ b/doc/html/range/reference/adaptors/adaptors_synopsis.html @@ -3,7 +3,7 @@ Synopsis - + diff --git a/doc/html/range/reference/algorithms.html b/doc/html/range/reference/algorithms.html index 99e1dad..fc70d02 100644 --- a/doc/html/range/reference/algorithms.html +++ b/doc/html/range/reference/algorithms.html @@ -3,7 +3,7 @@ Range Algorithm - + diff --git a/doc/html/range/reference/algorithms/heap_algorithms.html b/doc/html/range/reference/algorithms/heap_algorithms.html index 2cdbaaa..018906e 100644 --- a/doc/html/range/reference/algorithms/heap_algorithms.html +++ b/doc/html/range/reference/algorithms/heap_algorithms.html @@ -3,7 +3,7 @@ Heap algorithms - + @@ -33,6 +33,8 @@ pop_heap
    make_heap
    +
    + sort_heap
    diff --git a/doc/html/range/reference/algorithms/heap_algorithms/make_heap.html b/doc/html/range/reference/algorithms/heap_algorithms/make_heap.html index 083df4a..f261c6a 100644 --- a/doc/html/range/reference/algorithms/heap_algorithms/make_heap.html +++ b/doc/html/range/reference/algorithms/heap_algorithms/make_heap.html @@ -3,11 +3,11 @@ make_heap - + - +
    @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    @@ -28,28 +28,28 @@ make_heap
    - + Prototype

    template<class RandomAccessRange>
    -void make_heap(RandomAccessRange& rng);
    +RandomAccessRange& make_heap(RandomAccessRange& rng);
     
     template<class RandomAccessRange>
    -void make_heap(const RandomAccessRange& rng);
    +const RandomAccessRange& make_heap(const RandomAccessRange& rng);
     
     template<class RandomAccessRange, class Compare>
    -void make_heap(RandomAccessRange& rng, Compare pred);
    +RandomAccessRange& make_heap(RandomAccessRange& rng, Compare pred);
     
     template<class RandomAccessRange, class Compare>
    -void make_heap(const RandomAccessRange& rng, Compare pred);
    +const RandomAccessRange& make_heap(const RandomAccessRange& rng, Compare pred);
     

    - + Description

    @@ -61,14 +61,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -119,7 +119,7 @@

    - + Complexity

    @@ -138,7 +138,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/heap_algorithms/pop_heap.html b/doc/html/range/reference/algorithms/heap_algorithms/pop_heap.html index 2e45c55..3759ef1 100644 --- a/doc/html/range/reference/algorithms/heap_algorithms/pop_heap.html +++ b/doc/html/range/reference/algorithms/heap_algorithms/pop_heap.html @@ -3,7 +3,7 @@ pop_heap - + @@ -28,28 +28,28 @@ pop_heap
    - + Prototype

    template<class RandomAccessRange>
    -void pop_heap(RandomAccessRange& rng);
    +RandomAccessRange& pop_heap(RandomAccessRange& rng);
     
     template<class RandomAccessRange>
    -void pop_heap(const RandomAccessRange& rng);
    +const RandomAccessRange& pop_heap(const RandomAccessRange& rng);
     
     template<class RandomAccessRange, class Compare>
    -void pop_heap(RandomAccessRange& rng, Compare pred);
    +RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare pred);
     
     template<class RandomAccessRange, class Compare>
    -void pop_heap(const RandomAccessRange& rng, Compare pred);
    +const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare pred);
     

    - + Description

    @@ -63,14 +63,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -121,7 +121,7 @@

    - + Precondition:
      @@ -131,7 +131,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap_algorithms/push_heap.html b/doc/html/range/reference/algorithms/heap_algorithms/push_heap.html index 9bcf219..9857d21 100644 --- a/doc/html/range/reference/algorithms/heap_algorithms/push_heap.html +++ b/doc/html/range/reference/algorithms/heap_algorithms/push_heap.html @@ -3,7 +3,7 @@ push_heap - + @@ -28,28 +28,28 @@ push_heap

    - + Prototype

    template<class RandomAccessRange>
    -void push_heap(RandomAccessRange& rng);
    +RandomAccessRange& push_heap(RandomAccessRange& rng);
     
     template<class RandomAccessRange>
    -void push_heap(const RandomAccessRange& rng);
    +const RandomAccessRange& push_heap(const RandomAccessRange& rng);
     
     template<class RandomAccessRange, class Compare>
    -void push_heap(RandomAccessRange& rng, Compare pred);
    +RandomAccessRange& push_heap(RandomAccessRange& rng, Compare pred);
     
     template<class RandomAccessRange, class Compare>
    -void push_heap(const RandomAccessRange& rng, Compare pred);
    +const RandomAccessRange& push_heap(const RandomAccessRange& rng, Compare pred);
     

    - + Description

    @@ -63,14 +63,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -121,7 +121,7 @@

    - + Precondition:
      @@ -131,7 +131,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap_algorithms/sort_heap.html b/doc/html/range/reference/algorithms/heap_algorithms/sort_heap.html new file mode 100644 index 0000000..c9c5746 --- /dev/null +++ b/doc/html/range/reference/algorithms/heap_algorithms/sort_heap.html @@ -0,0 +1,153 @@ + + + +sort_heap + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +


    +
    +PrevUpHomeNext +
    +
    + +
    + + Prototype +
    +

    + +

    +
    template<class RandomAccessRange>
    +RandomAccessRange& sort_heap(RandomAccessRange& rng);
    +
    +template<class RandomAccessRange>
    +const RandomAccessRange& sort_heap(const RandomAccessRange& rng);
    +
    +template<class RandomAccessRange, class Compare>
    +RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare pred);
    +
    +template<class RandomAccessRange, class Compare>
    +const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare pred);
    +
    +

    +

    +
    + + Description +
    +

    + sort_heap turns a heap + into a sorted range. +

    +

    + The ordering relationship is determined by using operator< in the non-predicate versions, and + by evaluating pred in + the predicate versions. +

    +
    + + Definition +
    +

    + Defined in the header file boost/range/algorithm/heap_algorithm.hpp +

    +
    + + Requirements +
    +

    + For the non-predicate versions: +

    +
      +
    • +RandomAccessRange is + a model of the Random + Access Range Concept. +
    • +
    • +RandomAccessRange is + mutable. +
    • +
    • +RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
    • +
    • + The ordering of objects of type RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • +
    +

    + For the predicate versions: +

    +
      +
    • +RandomAccessRange is + a model of the Random + Access Range Concept. +
    • +
    • +RandomAccessRange is + mutable. +
    • +
    • +Compare is a model + of the StrictWeakOrderingConcept. +
    • +
    • +RandomAccessRange's + value type is convertible to both of Compare's + argument types. +
    • +
    +
    + + Precondition: +
    +

    + rng is a heap. +

    +
    + + Complexity +
    +

    + At most N * + log(N) + comparisons, where N + is distance(rng). +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/range/reference/algorithms/permutation_algorithms.html b/doc/html/range/reference/algorithms/permutation_algorithms.html index a9e2392..16bd254 100644 --- a/doc/html/range/reference/algorithms/permutation_algorithms.html +++ b/doc/html/range/reference/algorithms/permutation_algorithms.html @@ -3,10 +3,10 @@ Permutation algorithms - + - + @@ -20,7 +20,7 @@
    -PrevUpHomeNext +PrevUpHomeNext

    @@ -44,7 +44,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/permutation_algorithms/next_permutation.html b/doc/html/range/reference/algorithms/permutation_algorithms/next_permutation.html index 0a212cf..8691969 100644 --- a/doc/html/range/reference/algorithms/permutation_algorithms/next_permutation.html +++ b/doc/html/range/reference/algorithms/permutation_algorithms/next_permutation.html @@ -3,7 +3,7 @@ next_permutation - + @@ -28,28 +28,28 @@ next_permutation

    - + Prototype

    template<class BidirectionalRange>
    -void next_permutation(BidirectionalRange& rng);
    +bool next_permutation(BidirectionalRange& rng);
     
     template<class BidirectionalRange>
    -void next_permutation(const BidirectionalRange& rng);
    +bool next_permutation(const BidirectionalRange& rng);
     
     template<class BidirectionalRange, class Compare>
    -void next_permutation(BidirectionalRange& rng, Compare pred);
    +bool next_permutation(BidirectionalRange& rng, Compare pred);
     
     template<class BidirectionalRange, class Compare>
    -void next_permutation(const BidirectionalRange& rng, Compare pred);
    +bool next_permutation(const BidirectionalRange& rng, Compare pred);
     

    - + Description

    @@ -67,14 +67,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -125,7 +125,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/permutation_algorithms/prev_permutation.html b/doc/html/range/reference/algorithms/permutation_algorithms/prev_permutation.html index 06b9d1d..2521275 100644 --- a/doc/html/range/reference/algorithms/permutation_algorithms/prev_permutation.html +++ b/doc/html/range/reference/algorithms/permutation_algorithms/prev_permutation.html @@ -3,7 +3,7 @@ prev_permutation - + @@ -28,28 +28,28 @@ prev_permutation

    - + Prototype

    template<class BidirectionalRange>
    -void prev_permutation(BidirectionalRange& rng);
    +bool prev_permutation(BidirectionalRange& rng);
     
     template<class BidirectionalRange>
    -void prev_permutation(const BidirectionalRange& rng);
    +bool prev_permutation(const BidirectionalRange& rng);
     
     template<class BidirectionalRange, class Compare>
    -void prev_permutation(BidirectionalRange& rng, Compare pred);
    +bool prev_permutation(BidirectionalRange& rng, Compare pred);
     
     template<class BidirectionalRange, class Compare>
    -void prev_permutation(const BidirectionalRange& rng, Compare pred);
    +bool prev_permutation(const BidirectionalRange& rng, Compare pred);
     

    - + Description

    @@ -67,14 +67,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -125,7 +125,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_introduction.html b/doc/html/range/reference/algorithms/range_algorithm_introduction.html index f0aa6c4..9f15ed5 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_introduction.html +++ b/doc/html/range/reference/algorithms/range_algorithm_introduction.html @@ -3,7 +3,7 @@ Introduction and motivation - + diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms.html index fcd52d1..a69db43 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms.html @@ -3,7 +3,7 @@ Mutating algorithms - + @@ -34,6 +34,8 @@ Range Algorithm - copy_backward

    Range Algorithm - fill
    +
    + Range Algorithm - fill_n
    Range Algorithm - generate
    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html index e88c627..7050fd9 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy.html @@ -3,7 +3,7 @@ Range Algorithm - copy - + @@ -28,7 +28,7 @@ Range Algorithm - copy
    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -51,14 +51,14 @@ distance(source_rng)

    - + Definition

    Defined in the header file boost/range/algorithm/copy.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Precondition:
      @@ -93,7 +93,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html index 14d13c6..5047d02 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/copy_backward.html @@ -3,7 +3,7 @@ Range Algorithm - copy_backward - + @@ -28,7 +28,7 @@ Range Algorithm - copy_backward

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -60,14 +60,14 @@ denotes the end of the output sequence.

    - + Definition

    Defined in the header file boost/range/algorithm/copy_backward.hpp

    - + Requirements
      @@ -88,7 +88,7 @@
    - + Precondition:
      @@ -102,7 +102,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html index f28518c..30c1bc4 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill.html @@ -3,11 +3,11 @@ Range Algorithm - fill - + - + @@ -20,7 +20,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    @@ -28,22 +28,19 @@ Range Algorithm - fill
    - + Prototype

    template<class ForwardRange, class Value>
    -void fill( ForwardRange& rng, const Value& val );
    -
    -template<class ForwardRange, class Value>
    -void fill( const ForwardRange& rng, const Value& val );
    +ForwardRange& fill( ForwardRange& rng, const Value& val );
     

    - + Description

    @@ -52,14 +49,14 @@ in the range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/fill.hpp

    - + Requirements
      @@ -82,7 +79,7 @@
    - + Complexity

    @@ -99,7 +96,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill_n.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill_n.html new file mode 100644 index 0000000..a202dea --- /dev/null +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/fill_n.html @@ -0,0 +1,102 @@ + + + +Range Algorithm - fill_n + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +
    + + Prototype +
    +

    + +

    +
    template<class ForwardRange, class Size, class Value>
    +ForwardRange& fill( ForwardRange& rng, Size n, const Value& val );
    +
    +

    +

    +
    + + Description +
    +

    + fill_n assigns the value + val to n elements in the range rng begining with boost::begin(rng). +

    +
    + + Definition +
    +

    + Defined in the header file boost/range/algorithm/fill_n.hpp +

    +
    + + Requirements +
    +
      +
    • +ForwardRange is a model + of the Forward Range + Concept. +
    • +
    • +ForwardRange is mutable. +
    • +
    • +Value is a model of + the AssignableConcept. +
    • +
    • +Value is convertible + to ForwardRange's value + type. +
    • +
    +
    + + Complexity +
    +

    + Linear. Exactly n assignments + are performed. +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html index 68efa6a..a76b480 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/generate.html @@ -3,10 +3,10 @@ Range Algorithm - generate - + - + @@ -20,7 +20,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    @@ -28,7 +28,7 @@ Range Algorithm - generate
    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -53,14 +53,14 @@ Returns the resultant range.

    - + Definition

    Defined in the header file boost/range/algorithm/generate.hpp

    - + Requirements
      @@ -84,7 +84,7 @@
    - + Precondition:
      @@ -98,7 +98,7 @@
    - + Complexity

    @@ -115,7 +115,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html index 46ef629..e0aa7fc 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/inplace_merge.html @@ -3,7 +3,7 @@ Range Algorithm - inplace_merge - + @@ -28,7 +28,7 @@ Range Algorithm - inplace_merge
    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -72,14 +72,14 @@ input range is preserved.

    - + Definition

    Defined in the header file boost/range/algorithm/inplace_merge.hpp

    - + Requirements

    @@ -116,11 +116,11 @@ argument types.

    - + Precondition:
    - + For the non-predicate version:
    @@ -143,7 +143,7 @@
    - + For the predicate version:
    @@ -164,7 +164,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html index 5747eef..e2b5d56 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/merge.html @@ -3,7 +3,7 @@ Range Algorithm - merge - + @@ -28,7 +28,7 @@ Range Algorithm - merge

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -76,14 +76,14 @@ version uses the predicate instead of operator<().

    - + Definition

    Defined in the header file boost/range/algorithm/merge.hpp

    - + Requirements

    @@ -151,11 +151,11 @@

    - + Precondition:
    - + For the non-predicate version:
    @@ -190,7 +190,7 @@
    - + For the predicate version:
    @@ -221,7 +221,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/nth_element.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/nth_element.html index 75f8d71..5b42602 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/nth_element.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/nth_element.html @@ -3,7 +3,7 @@ Range Algorithm - nth_element - + @@ -28,34 +28,38 @@ Range Algorithm - nth_element

    - + Prototype

    template<class RandomAccessRange>
    -void nth_element(RandomAccessRange& rng,
    -                 typename range_iterator<RandomAccessRange>::type nth);
    -                 
    +RandomAccessRange& nth_element(
    +    RandomAccessRange& rng,
    +    typename range_iterator<RandomAccessRange>::type nth);
    +
     template<class RandomAccessRange>
    -void nth_element(const RandomAccessRange& rng,
    -                 typename range_iterator<const RandomAccessRange>::type nth);
    -                 
    +const RandomAccessRange& nth_element(
    +    const RandomAccessRange& rng,
    +    typename range_iterator<const RandomAccessRange>::type nth);
    +
     template<class RandomAccessRange>
    -void nth_element(RandomAccessRange& rng,
    -                 typename range_iterator<RandomAccessRange>::type nth,
    -                 BinaryPredicate sort_pred);
    -                 
    +RandomAccessRange& nth_element(
    +    RandomAccessRange& rng,
    +    typename range_iterator<RandomAccessRange>::type nth,
    +    BinaryPredicate sort_pred);
    +
     template<class RandomAccessRange>
    -void nth_element(const RandomAccessRange& rng,
    -                 typename range_iterator<const RandomAccessRange>::type nth,
    -                 BinaryPredicate sort_pred);
    +const RandomAccessRange& nth_element(
    +    const RandomAccessRange& rng,
    +    typename range_iterator<const RandomAccessRange>::type nth,
    +    BinaryPredicate sort_pred);
     

    - + Description

    @@ -66,14 +70,14 @@ is the same as the element that would be in that position if rng has been sorted.

    - + Definition

    Defined in the header file boost/range/algorithm/nth_element.hpp

    - + Requirements

    @@ -124,7 +128,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partial_sort.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partial_sort.html index 1112ef2..a202f53 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partial_sort.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partial_sort.html @@ -3,7 +3,7 @@ Range Algorithm - partial_sort - + @@ -28,34 +28,38 @@ Range Algorithm - partial_sort

    - + Prototype

    template<class RandomAccessRange>
    -void partial_sort(RandomAccessRange& rng,
    -                  typename range_iterator<RandomAccessRange>::type middle);
    -                 
    +RandomAccessRange& partial_sort(
    +    RandomAccessRange& rng,
    +    typename range_iterator<RandomAccessRange>::type middle);
    +
     template<class RandomAccessRange>
    -void partial_sort(const RandomAccessRange& rng,
    -                  typename range_iterator<const RandomAccessRange>::type middle);
    -                 
    +const RandomAccessRange& partial_sort(
    +    const RandomAccessRange& rng,
    +    typename range_iterator<const RandomAccessRange>::type middle);
    +
     template<class RandomAccessRange>
    -void partial_sort(RandomAccessRange& rng,
    -                  typename range_iterator<RandomAccessRange>::type middle,
    -                  BinaryPredicate sort_pred);
    -                 
    +RandomAccessRange& partial_sort(
    +    RandomAccessRange& rng,
    +    typename range_iterator<RandomAccessRange>::type middle,
    +    BinaryPredicate sort_pred);
    +
     template<class RandomAccessRange>
    -void partial_sort(const RandomAccessRange& rng,
    -                  typename range_iterator<const RandomAccessRange>::type middle,
    -                  BinaryPredicate sort_pred);
    +const RandomAccessRange& partial_sort(
    +    const RandomAccessRange& rng,
    +    typename range_iterator<const RandomAccessRange>::type middle,
    +    BinaryPredicate sort_pred);
     

    - + Description

    @@ -71,14 +75,14 @@ predicate instead.

    - + Definition

    Defined in the header file boost/range/algorithm/partial_sort.hpp

    - + Requirements

    @@ -129,7 +133,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partition.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partition.html index 50b7b16..e2d73d7 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partition.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/partition.html @@ -3,7 +3,7 @@ Range Algorithm - partition - + @@ -28,7 +28,7 @@ Range Algorithm - partition

    - + Prototype

    @@ -67,7 +67,7 @@

    - + Description

    @@ -81,14 +81,14 @@ corresponds to the middle iterator.

    - + Definition

    Defined in the header file boost/range/algorithm/partition.hpp

    - + Requirements
      @@ -108,7 +108,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/random_shuffle.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/random_shuffle.html index 023d799..64643c5 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/random_shuffle.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/random_shuffle.html @@ -3,7 +3,7 @@ Range Algorithm - random_shuffle - + @@ -28,7 +28,7 @@ Range Algorithm - random_shuffle

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -61,14 +61,14 @@ the shuffles range.

    - + Definition

    Defined in the header file boost/range/algorithm/random_shuffle.hpp

    - + Requirements

    @@ -99,7 +99,7 @@

    - + Precondition:
    • @@ -108,7 +108,7 @@ maximum value.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove.html index 65ab605..016b1aa 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove.html @@ -3,7 +3,7 @@ Range Algorithm - remove - + @@ -28,7 +28,7 @@ Range Algorithm - remove

    - + Prototype

    @@ -67,7 +67,7 @@

    - + Description

    @@ -84,14 +84,14 @@ are dereferenceable, but the elements are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove.hpp

    - + Requirements
      @@ -114,7 +114,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove_if.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove_if.html index 227aeb0..51cb94c 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove_if.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/remove_if.html @@ -3,7 +3,7 @@ Range Algorithm - remove_if - + @@ -28,7 +28,7 @@ Range Algorithm - remove_if

    - + Prototype

    @@ -67,7 +67,7 @@

    - + Description

    @@ -83,14 +83,14 @@ are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_if.hpp

    - + Requirements
      @@ -113,7 +113,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace.html index e07aebb..dab9ee6 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace.html @@ -3,7 +3,7 @@ Range Algorithm - replace - + @@ -28,7 +28,7 @@ Range Algorithm - replace

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -58,14 +58,14 @@ Return a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace.hpp

    - + Requirements
      @@ -94,7 +94,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace_if.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace_if.html index fcf01b9..946b18c 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace_if.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/replace_if.html @@ -3,7 +3,7 @@ Range Algorithm - replace_if - + @@ -28,7 +28,7 @@ Range Algorithm - replace_if

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_if.hpp

    - + Requirements
      @@ -91,7 +91,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/rotate.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/rotate.html index e4c574f..2660663 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/rotate.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/rotate.html @@ -3,7 +3,7 @@ Range Algorithm - rotate - + @@ -28,7 +28,7 @@ Range Algorithm - rotate

    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -54,14 +54,14 @@ and [middle, end(rng)). Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/rotate.hpp

    - + Requirements
      @@ -75,7 +75,7 @@
    - + Precondition:
      @@ -87,7 +87,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/sort.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/sort.html index 31adcdf..0fc2893 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/sort.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/sort.html @@ -3,7 +3,7 @@ Range Algorithm - sort - + @@ -28,7 +28,7 @@ Range Algorithm - sort

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ [x,y], pred(y, x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/sort.hpp

    - + Requirements

    @@ -130,7 +130,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_partition.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_partition.html index a549bc5..d4178a2 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_partition.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_partition.html @@ -3,7 +3,7 @@ Range Algorithm - stable_partition - + @@ -28,7 +28,7 @@ Range Algorithm - stable_partition

    - + Prototype

    @@ -61,7 +61,7 @@

    - + Description

    @@ -83,14 +83,14 @@ the iterator to the first element that fails to satisfy pred.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_partition.hpp

    - + Requirements
      @@ -108,7 +108,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_sort.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_sort.html index e02cfa3..d0e3ddf 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_sort.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/stable_sort.html @@ -3,7 +3,7 @@ Range Algorithm - stable_sort - + @@ -28,7 +28,7 @@ Range Algorithm - stable_sort

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ [x,y], pred(y,x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_sort.hpp

    - + Requirements

    @@ -130,7 +130,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/transform.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/transform.html index 82c53ea..110d48d 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/transform.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/transform.html @@ -3,7 +3,7 @@ Range Algorithm - transform - + @@ -28,7 +28,7 @@ Range Algorithm - transform

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -93,14 +93,14 @@ The return value is out + min(distance(rng1), distance(rng2)).

    - + Definition

    Defined in the header file boost/range/algorithm/transform.hpp

    - + Requirements

    @@ -170,7 +170,7 @@

    - + Precondition:

    @@ -202,7 +202,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/unique.html b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/unique.html index 13f388f..ec4bf26 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/unique.html +++ b/doc/html/range/reference/algorithms/range_algorithm_mutating_algorithms/unique.html @@ -3,7 +3,7 @@ Range Algorithm - unique - + @@ -28,7 +28,7 @@ Range Algorithm - unique

    - + Prototype

    @@ -69,7 +69,7 @@

    - + Description

    @@ -87,14 +87,14 @@ type.

    - + Definition

    Defined in the header file boost/range/algorithm/unique.hpp

    - + Requirements

    @@ -138,7 +138,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms.html index 7976d61..5182eaf 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms.html @@ -3,7 +3,7 @@ New algorithms - + diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/erase.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/erase.html index e3d64a6..6d13233 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/erase.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/erase.html @@ -3,7 +3,7 @@ erase - + @@ -28,23 +28,21 @@ erase

    - + Prototype

    -
    template<
    -    class Container,
    -    class SinglePassRange
    -    >
    -void erase(Container& target,
    -           iterator_range<typename Container::iterator> to_erase);
    +
    template<class Container>
    +Container& erase(
    +    Container& target,
    +    iterator_range<typename Container::iterator> to_erase);
     

    - + Description

    @@ -52,15 +50,23 @@ to_erase from the container target.

    +

    + remove_erase performs + the frequently used combination equivalent to target.erase(std::remove(target.begin(), target.end(), value), target.end()); +

    +

    + remove_erase_if performs + the frequently used combination equivalent to target.erase(std::remove_if(target.begin(), target.end(), pred), target.end()); +

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. @@ -68,7 +74,7 @@ erase of an iterator range.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/for_each.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/for_each.html index dfe62c3..2577357 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/for_each.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/for_each.html @@ -3,7 +3,7 @@ for_each - + @@ -28,7 +28,7 @@ for_each

    - + Prototype

    @@ -73,7 +73,7 @@

    - + Description

    @@ -89,14 +89,14 @@ It is safe to call this function with unequal length ranges.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/for_each.hpp

    - + Requirements
      @@ -126,7 +126,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/insert.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/insert.html index e0aa512..7321ce8 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/insert.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/insert.html @@ -3,7 +3,7 @@ insert - + @@ -28,7 +28,7 @@ insert

    - + Prototype

    @@ -38,14 +38,14 @@ class Container, class SinglePassRange > -void insert(Container& target, - typename Container::iterator before, - const SinglePassRange& from); +Container& insert(Container& target, + typename Container::iterator before, + const SinglePassRange& from);

    - + Description

    @@ -55,14 +55,14 @@ target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/insert.hpp

    - + Requirements
      @@ -82,7 +82,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/iota.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/iota.html index c36f96d..ea0a6f4 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/iota.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/iota.html @@ -3,7 +3,7 @@ iota - + @@ -28,19 +28,19 @@ iota

    - + Prototype

    -
    template<class SinglePassRange, class Value>
    -iota(SinglePassRange& rng, Value x);
    +
    template<class ForwardRange, class Value>
    +ForwardRange& iota(ForwardRange& rng, Value x);
     

    - + Description

    @@ -51,21 +51,21 @@ + boost::distance(boost::begin(rng), it)

    - + Definition

    Defined in the header file boost/range/algorithm_ext/iota.hpp

    - + Requirements
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. +ForwardRange is a model + of the Forward Range + Concept.
    2. Value is a model of @@ -73,7 +73,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html index 189151b..d0a5b5e 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/overwrite.html @@ -3,7 +3,7 @@ overwrite - + @@ -28,7 +28,7 @@ overwrite

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,14 +53,14 @@ into the range to.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/overwrite.hpp

    - + Requirements
      @@ -87,7 +87,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_back.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_back.html index 1357275..8029406 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_back.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_back.html @@ -3,7 +3,7 @@ push_back - + @@ -28,7 +28,7 @@ push_back

    - + Prototype

    @@ -38,13 +38,13 @@ class Container, class SinglePassRange > -void push_back(Container& target, - const SinglePassRange& from); +Container& push_back(Container& target, + const SinglePassRange& from);

    - + Description

    @@ -53,14 +53,14 @@ to the back of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_back.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_front.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_front.html index d91db73..462cc72 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_front.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/push_front.html @@ -3,7 +3,7 @@ push_front - + @@ -28,7 +28,7 @@ push_front

    - + Prototype

    @@ -38,13 +38,13 @@ class Container, class SinglePassRange > -void push_front(Container& target, - const SinglePassRange& from); +Container& push_front(Container& target, + const SinglePassRange& from);

    - + Description

    @@ -53,14 +53,14 @@ to the front of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_front.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase.html index 5963cab..c268e1a 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase.html @@ -3,7 +3,7 @@ remove_erase - + @@ -28,40 +28,37 @@ remove_erase

    - + Prototype

    -
    template<
    -    class Container,
    -    class T
    -    >
    -void remove_erase(Container& target,
    -                  const T& val);
    +
    template<class Container, class Value>
    +Container& remove_erase(Container& target,
    +                        const Value& value);
     

    - + Description

    remove_erase actually - eliminates the elements equal to val + eliminates the elements equal to value from the container. This is in contrast to the remove algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. @@ -69,7 +66,7 @@ erase of an iterator range.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase_if.html b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase_if.html index 4469f02..0dd87cd 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase_if.html +++ b/doc/html/range/reference/algorithms/range_algorithm_new_algorithms/remove_erase_if.html @@ -3,7 +3,7 @@ remove_erase_if - + @@ -28,23 +28,20 @@ remove_erase_if

    - + Prototype

    -
    template<
    -    class Container,
    -    class Pred
    -    >
    -void remove_erase(Container& target,
    -                  Pred pred);
    +
    template<class Container, class Pred>
    +Container& remove_erase_if(Container& target,
    +                           Pred pred);
     

    - + Description

    @@ -55,14 +52,14 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
      @@ -76,7 +73,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms.html index 2e8a2d1..87820b8 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms.html @@ -3,7 +3,7 @@ Non-mutating algorithms - + diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/adjacent_find.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/adjacent_find.html index d14634a..f71cc25 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/adjacent_find.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/adjacent_find.html @@ -3,7 +3,7 @@ Range Algorithm - adjacent_find - + @@ -28,7 +28,7 @@ Range Algorithm - adjacent_find

    - + Prototype

    @@ -77,7 +77,7 @@

    - + Description

    @@ -98,14 +98,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/adjacent_find.hpp

    - + Requirements

    @@ -143,7 +143,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/binary_search.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/binary_search.html index e87ccbe..64a95a8 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/binary_search.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/binary_search.html @@ -3,7 +3,7 @@ binary_search - + @@ -28,7 +28,7 @@ binary_search

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -53,14 +53,14 @@ range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/binary_search.hpp

    - + Requirements

    @@ -111,7 +111,7 @@

    - + Precondition:

    @@ -129,7 +129,7 @@ order according to the function object pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/count.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/count.html index 3e36aa5..73a26b8 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/count.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/count.html @@ -3,7 +3,7 @@ count - + @@ -28,7 +28,7 @@ count

    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -55,14 +55,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/count.hpp

    - + Requirements
      @@ -85,7 +85,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal.html index bb6187c..d581af7 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal.html @@ -3,7 +3,7 @@ equal - + @@ -28,7 +28,7 @@ equal

    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -71,14 +71,14 @@ considered equal in the predicate version if pred(x,y) is true.

    - + Definition

    Defined in the header file boost/range/algorithm/equal.hpp

    - + Requirements

    @@ -139,7 +139,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal_range.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal_range.html index 8ba9948..88d3af6 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal_range.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/equal_range.html @@ -3,7 +3,7 @@ equal_range - + @@ -28,7 +28,7 @@ equal_range

    - + Prototype

    @@ -71,7 +71,7 @@

    - + Description

    @@ -85,14 +85,14 @@ is determined by pred.

    - + Definition

    Defined in the header file boost/range/algorithm/equal_range.hpp

    - + Requirements

    @@ -143,7 +143,7 @@

    - + Precondition:

    @@ -155,7 +155,7 @@ is ordered in ascending order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find.html index 05db375..f9fff13 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find.html @@ -3,7 +3,7 @@ find - + @@ -28,7 +28,7 @@ find

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -60,14 +60,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find.hpp

    - + Requirements
      @@ -88,7 +88,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_end.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_end.html index b5ab6b0..f6a9b8b 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_end.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_end.html @@ -3,7 +3,7 @@ find_end - + @@ -28,7 +28,7 @@ find_end

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -81,14 +81,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_end.hpp

    - + Requirements

    @@ -148,7 +148,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_first_of.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_first_of.html index a8de6a4..cb3cc79 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_first_of.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_first_of.html @@ -3,7 +3,7 @@ find_first_of - + @@ -28,7 +28,7 @@ find_first_of

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -86,14 +86,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_first_of.hpp

    - + Requirements

    @@ -147,7 +147,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_if.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_if.html index 07df166..44cdde4 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_if.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/find_if.html @@ -3,7 +3,7 @@ find_if - + @@ -28,7 +28,7 @@ find_if

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -64,14 +64,14 @@ defines found in the same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_if.hpp

    - + Requirements
      @@ -90,7 +90,7 @@
    - + Precondition:

    @@ -98,7 +98,7 @@ rng, *i is in the domain of UnaryPredicate.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/for_each.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/for_each.html index f90bdc6..0ea9130 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/for_each.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/for_each.html @@ -3,7 +3,7 @@ for_each - + @@ -28,7 +28,7 @@ for_each

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -59,14 +59,14 @@ fun(x).

    - + Definition

    Defined in the header file boost/range/algorithm/for_each.hpp

    - + Requirements
      @@ -90,7 +90,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lexicographical_compare.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lexicographical_compare.html index d10629d..0978050 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lexicographical_compare.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lexicographical_compare.html @@ -3,7 +3,7 @@ lexicographical_compare - + @@ -28,7 +28,7 @@ lexicographical_compare

    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -73,14 +73,14 @@ predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/lexicographical_compare.hpp

    - + Requirements

    @@ -145,7 +145,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lower_bound.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lower_bound.html index 3eaa4e3..3a5a05d 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lower_bound.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/lower_bound.html @@ -3,7 +3,7 @@ lower_bound - + @@ -28,7 +28,7 @@ lower_bound

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/lower_bound.hpp

    - + Requirements

    @@ -130,7 +130,7 @@

    - + Precondition:

    @@ -148,7 +148,7 @@ order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/max_element.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/max_element.html index 552d3af..0e042fd 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/max_element.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/max_element.html @@ -3,7 +3,7 @@ max_element - + @@ -28,7 +28,7 @@ max_element

    - + Prototype

    @@ -84,7 +84,7 @@

    - + Description

    @@ -98,14 +98,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/max_element.hpp

    - + Requirements

    @@ -142,7 +142,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/min_element.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/min_element.html index 675196b..4752df4 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/min_element.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/min_element.html @@ -3,7 +3,7 @@ min_element - + @@ -28,7 +28,7 @@ min_element

    - + Prototype

    @@ -84,7 +84,7 @@

    - + Description

    @@ -98,14 +98,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/min_element.hpp

    - + Requirements

    @@ -142,7 +142,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/mismatch.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/mismatch.html index 572dd69..3af4682 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/mismatch.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/mismatch.html @@ -3,7 +3,7 @@ mismatch - + @@ -28,7 +28,7 @@ mismatch

    - + Prototype

    @@ -106,7 +106,7 @@

    - + Description

    @@ -124,14 +124,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/mismatch.hpp

    - + Requirements

    @@ -192,14 +192,14 @@

    - + Precondition:

    distance(rng2) >= distance(rng1)

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/search.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/search.html index 03b528c..93994e9 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/search.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/search.html @@ -3,7 +3,7 @@ search - + @@ -28,7 +28,7 @@ search

    - + Prototype

    @@ -96,7 +96,7 @@

    - + Description

    @@ -115,14 +115,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/search.hpp

    - + Requirements

    @@ -183,7 +183,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/upper_bound.html b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/upper_bound.html index e73149f..14f5248 100644 --- a/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/upper_bound.html +++ b/doc/html/range/reference/algorithms/range_algorithm_non_mutating_algorithms/upper_bound.html @@ -3,7 +3,7 @@ upper_bound - + @@ -28,7 +28,7 @@ upper_bound

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -71,14 +71,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/upper_bound.hpp

    - + Requirements

    @@ -129,7 +129,7 @@

    - + Precondition:

    @@ -147,7 +147,7 @@ order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_numeric.html b/doc/html/range/reference/algorithms/range_numeric.html index 9da4d83..c6c6767 100644 --- a/doc/html/range/reference/algorithms/range_numeric.html +++ b/doc/html/range/reference/algorithms/range_numeric.html @@ -3,7 +3,7 @@ Numeric algorithms - + diff --git a/doc/html/range/reference/algorithms/range_numeric/accumulate.html b/doc/html/range/reference/algorithms/range_numeric/accumulate.html index 9351f90..26970d8 100644 --- a/doc/html/range/reference/algorithms/range_numeric/accumulate.html +++ b/doc/html/range/reference/algorithms/range_numeric/accumulate.html @@ -3,7 +3,7 @@ accumulate - + @@ -28,7 +28,7 @@ accumulate

    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -64,18 +64,18 @@ The return value is the resultant value of the above algorithm.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -100,7 +100,7 @@
    - + For the second version
    @@ -134,7 +134,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_numeric/adjacent_difference.html b/doc/html/range/reference/algorithms/range_numeric/adjacent_difference.html index 6680e82..9358698 100644 --- a/doc/html/range/reference/algorithms/range_numeric/adjacent_difference.html +++ b/doc/html/range/reference/algorithms/range_numeric/adjacent_difference.html @@ -3,7 +3,7 @@ adjacent_difference - + @@ -28,7 +28,7 @@ adjacent_difference

    - + Prototype

    @@ -55,7 +55,7 @@

    - + Description

    @@ -69,18 +69,18 @@ instead of operator-().

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -111,7 +111,7 @@
    - + For the second version
    @@ -146,7 +146,7 @@
    - + Precondition:

    @@ -154,7 +154,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_numeric/inner_product.html b/doc/html/range/reference/algorithms/range_numeric/inner_product.html index d2591e2..a040134 100644 --- a/doc/html/range/reference/algorithms/range_numeric/inner_product.html +++ b/doc/html/range/reference/algorithms/range_numeric/inner_product.html @@ -3,7 +3,7 @@ inner_product - + @@ -28,7 +28,7 @@ inner_product

    - + Prototype

    @@ -54,7 +54,7 @@

    - + Description

    @@ -67,18 +67,18 @@ algorithm please see inner_product.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -113,7 +113,7 @@
    - + For the second version
    @@ -162,14 +162,14 @@
    - + Precondition:

    distance(rng2) >= distance(rng1) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/range_numeric/partial_sum.html b/doc/html/range/reference/algorithms/range_numeric/partial_sum.html index b1aa0bf..e1ce532 100644 --- a/doc/html/range/reference/algorithms/range_numeric/partial_sum.html +++ b/doc/html/range/reference/algorithms/range_numeric/partial_sum.html @@ -3,7 +3,7 @@ partial_sum - + @@ -28,7 +28,7 @@ partial_sum

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -58,18 +58,18 @@ in the same manner as std::partial_sum(boost::begin(rng), boost::end(rng), out_it). See partial_sum.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -99,7 +99,7 @@
    - + For the second version
    @@ -128,7 +128,7 @@
    - + Precondition:

    @@ -136,7 +136,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms.html b/doc/html/range/reference/algorithms/set_algorithms.html index 447b470..b9888f5 100644 --- a/doc/html/range/reference/algorithms/set_algorithms.html +++ b/doc/html/range/reference/algorithms/set_algorithms.html @@ -3,7 +3,7 @@ Set algorithms - + diff --git a/doc/html/range/reference/algorithms/set_algorithms/includes.html b/doc/html/range/reference/algorithms/set_algorithms/includes.html index b8fabe5..0c538d9 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/includes.html +++ b/doc/html/range/reference/algorithms/set_algorithms/includes.html @@ -3,7 +3,7 @@ includes - + @@ -28,7 +28,7 @@ includes

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -60,14 +60,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -145,7 +145,7 @@

    - + Precondition:

    @@ -163,7 +163,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms/set_difference.html b/doc/html/range/reference/algorithms/set_algorithms/set_difference.html index 95531ed..e02ebe2 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/set_difference.html +++ b/doc/html/range/reference/algorithms/set_algorithms/set_difference.html @@ -3,7 +3,7 @@ set_difference - + @@ -28,7 +28,7 @@ set_difference

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -71,14 +71,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -164,7 +164,7 @@

    - + Precondition:

    @@ -182,7 +182,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms/set_intersection.html b/doc/html/range/reference/algorithms/set_algorithms/set_intersection.html index 7367d86..ce4af10 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/set_intersection.html +++ b/doc/html/range/reference/algorithms/set_algorithms/set_intersection.html @@ -3,7 +3,7 @@ set_intersection - + @@ -28,7 +28,7 @@ set_intersection

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -71,14 +71,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -164,7 +164,7 @@

    - + Precondition:

    @@ -182,7 +182,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms/set_symmetric_difference.html b/doc/html/range/reference/algorithms/set_algorithms/set_symmetric_difference.html index 52b58b7..c33f771 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/set_symmetric_difference.html +++ b/doc/html/range/reference/algorithms/set_algorithms/set_symmetric_difference.html @@ -3,7 +3,7 @@ set_symmetric_difference - + @@ -28,7 +28,7 @@ set_symmetric_difference

    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -75,14 +75,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -168,7 +168,7 @@

    - + Precondition:

    @@ -186,7 +186,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set_algorithms/set_union.html b/doc/html/range/reference/algorithms/set_algorithms/set_union.html index 3a8abe3..93ec40f 100644 --- a/doc/html/range/reference/algorithms/set_algorithms/set_union.html +++ b/doc/html/range/reference/algorithms/set_algorithms/set_union.html @@ -3,7 +3,7 @@ set_union - + @@ -28,7 +28,7 @@ set_union

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -70,14 +70,14 @@ in the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -163,7 +163,7 @@

    - + Precondition:

    @@ -181,7 +181,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/extending.html b/doc/html/range/reference/extending.html index 37f4882..fc32e83 100644 --- a/doc/html/range/reference/extending.html +++ b/doc/html/range/reference/extending.html @@ -3,7 +3,7 @@ Extending the library - + diff --git a/doc/html/range/reference/extending/method_1.html b/doc/html/range/reference/extending/method_1.html index d9f66a7..632687b 100644 --- a/doc/html/range/reference/extending/method_1.html +++ b/doc/html/range/reference/extending/method_1.html @@ -3,7 +3,7 @@ Method 1: provide member functions and nested types - + diff --git a/doc/html/range/reference/extending/method_2.html b/doc/html/range/reference/extending/method_2.html index eae4cbd..f4f3524 100644 --- a/doc/html/range/reference/extending/method_2.html +++ b/doc/html/range/reference/extending/method_2.html @@ -3,7 +3,7 @@ Method 2: provide free-standing functions and specialize metafunctions - + diff --git a/doc/html/range/reference/extending/method_3.html b/doc/html/range/reference/extending/method_3.html index 3594ff8..f841237 100644 --- a/doc/html/range/reference/extending/method_3.html +++ b/doc/html/range/reference/extending/method_3.html @@ -3,7 +3,7 @@ Method 3: provide range adaptor implementations - + diff --git a/doc/html/range/reference/extending/method_3/method_3_1.html b/doc/html/range/reference/extending/method_3/method_3_1.html index 9370d65..e995bee 100644 --- a/doc/html/range/reference/extending/method_3/method_3_1.html +++ b/doc/html/range/reference/extending/method_3/method_3_1.html @@ -3,7 +3,7 @@ Method 3.1: Implement a Range Adaptor without arguments - + diff --git a/doc/html/range/reference/extending/method_3/method_3_2.html b/doc/html/range/reference/extending/method_3/method_3_2.html index f153d0e..f0bae90 100644 --- a/doc/html/range/reference/extending/method_3/method_3_2.html +++ b/doc/html/range/reference/extending/method_3/method_3_2.html @@ -3,7 +3,7 @@ Method 3.2: Implement a Range Adaptor with arguments - + diff --git a/doc/html/range/reference/overview.html b/doc/html/range/reference/overview.html index 8db874f..ae0bbf0 100644 --- a/doc/html/range/reference/overview.html +++ b/doc/html/range/reference/overview.html @@ -3,7 +3,7 @@ Overview - + diff --git a/doc/html/range/reference/ranges.html b/doc/html/range/reference/ranges.html index 6e4ad0a..2e16372 100644 --- a/doc/html/range/reference/ranges.html +++ b/doc/html/range/reference/ranges.html @@ -3,7 +3,7 @@ Provided Ranges - + diff --git a/doc/html/range/reference/ranges/counting_range.html b/doc/html/range/reference/ranges/counting_range.html index e2ccb2c..7bc2c80 100644 --- a/doc/html/range/reference/ranges/counting_range.html +++ b/doc/html/range/reference/ranges/counting_range.html @@ -3,7 +3,7 @@ counting_range - + @@ -27,7 +27,7 @@ counting_range

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -58,14 +58,14 @@ (from Boost.Iterator).

    - + Definition

    Defined in header file boost/range/counting_range.hpp

    - + Requirements
    1. diff --git a/doc/html/range/reference/ranges/irange.html b/doc/html/range/reference/ranges/irange.html index cd481f0..fc88a82 100644 --- a/doc/html/range/reference/ranges/irange.html +++ b/doc/html/range/reference/ranges/irange.html @@ -3,7 +3,7 @@ irange - + @@ -27,7 +27,7 @@ irange
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -58,14 +58,14 @@ parameters denoted a half-open range.

    - + Definition

    Defined in the header file boost/range/irange.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/ranges/istream_range.html b/doc/html/range/reference/ranges/istream_range.html index 063204d..db454bc 100644 --- a/doc/html/range/reference/ranges/istream_range.html +++ b/doc/html/range/reference/ranges/istream_range.html @@ -3,7 +3,7 @@ istream_range - + @@ -27,7 +27,7 @@ istream_range

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -49,7 +49,7 @@ wrapping a std::istream_iterator.

    - + Definition

    diff --git a/doc/html/range/reference/semantics.html b/doc/html/range/reference/semantics.html index 4fa0645..5ab20fe 100644 --- a/doc/html/range/reference/semantics.html +++ b/doc/html/range/reference/semantics.html @@ -3,7 +3,7 @@ Semantics - + @@ -31,7 +31,7 @@

    Functions
    - + notation
    diff --git a/doc/html/range/reference/semantics/functions.html b/doc/html/range/reference/semantics/functions.html index 16bb7fb..232b680 100644 --- a/doc/html/range/reference/semantics/functions.html +++ b/doc/html/range/reference/semantics/functions.html @@ -3,7 +3,7 @@ Functions - + diff --git a/doc/html/range/reference/semantics/metafunctions.html b/doc/html/range/reference/semantics/metafunctions.html index cc2f4bd..6df4902 100644 --- a/doc/html/range/reference/semantics/metafunctions.html +++ b/doc/html/range/reference/semantics/metafunctions.html @@ -3,7 +3,7 @@ Metafunctions - + diff --git a/doc/html/range/reference/synopsis.html b/doc/html/range/reference/synopsis.html index c950490..248e8c1 100644 --- a/doc/html/range/reference/synopsis.html +++ b/doc/html/range/reference/synopsis.html @@ -3,7 +3,7 @@ Synopsis - + diff --git a/doc/html/range/style_guide.html b/doc/html/range/style_guide.html index 48043c4..b3e147a 100644 --- a/doc/html/range/style_guide.html +++ b/doc/html/range/style_guide.html @@ -3,7 +3,7 @@ Terminology and style guidelines - + diff --git a/doc/html/range/upgrade.html b/doc/html/range/upgrade.html index 27ddd2b..ad53c37 100644 --- a/doc/html/range/upgrade.html +++ b/doc/html/range/upgrade.html @@ -3,7 +3,7 @@ Upgrade version of Boost.Range - + diff --git a/doc/html/range/upgrade/upgrade_from_1_34.html b/doc/html/range/upgrade/upgrade_from_1_34.html index 587555c..dfc4c52 100644 --- a/doc/html/range/upgrade/upgrade_from_1_34.html +++ b/doc/html/range/upgrade/upgrade_from_1_34.html @@ -3,7 +3,7 @@ Upgrade from version 1.34 - + diff --git a/doc/html/range/upgrade/upgrade_from_1_42.html b/doc/html/range/upgrade/upgrade_from_1_42.html index 74059e4..3fbc2d2 100644 --- a/doc/html/range/upgrade/upgrade_from_1_42.html +++ b/doc/html/range/upgrade/upgrade_from_1_42.html @@ -3,7 +3,7 @@ Upgrade from version 1.42 - + diff --git a/doc/html/range/utilities.html b/doc/html/range/utilities.html index 0ccd47c..6c16a00 100644 --- a/doc/html/range/utilities.html +++ b/doc/html/range/utilities.html @@ -3,7 +3,7 @@ Utilities - + diff --git a/doc/html/range/utilities/iterator_range.html b/doc/html/range/utilities/iterator_range.html index 7956363..0902337 100644 --- a/doc/html/range/utilities/iterator_range.html +++ b/doc/html/range/utilities/iterator_range.html @@ -3,7 +3,7 @@ Class iterator_range - + @@ -47,7 +47,7 @@ limitation is simply propogated from the underlying iterator type.

    - + Synopsis

    @@ -187,7 +187,7 @@ iterators from the same container.

    - + Details member functions
    @@ -218,7 +218,7 @@

    - + Details functions
    diff --git a/doc/html/range/utilities/join.html b/doc/html/range/utilities/join.html index d430946..e73c51e 100644 --- a/doc/html/range/utilities/join.html +++ b/doc/html/range/utilities/join.html @@ -3,7 +3,7 @@ Function join - + @@ -39,7 +39,7 @@ if the end of a range has been reached internally during traversal.

    - + Synposis

    @@ -65,7 +65,7 @@

    - + Example

    diff --git a/doc/html/range/utilities/sub_range.html b/doc/html/range/utilities/sub_range.html index 517639f..e30fba7 100644 --- a/doc/html/range/utilities/sub_range.html +++ b/doc/html/range/utilities/sub_range.html @@ -3,7 +3,7 @@ Class sub_range - + @@ -35,7 +35,7 @@ is.

    - + Synopsis

    diff --git a/doc/reference/algorithm/fill.qbk b/doc/reference/algorithm/fill.qbk index e8419ab..9e16492 100644 --- a/doc/reference/algorithm/fill.qbk +++ b/doc/reference/algorithm/fill.qbk @@ -4,10 +4,7 @@ `` template -void fill( ForwardRange& rng, const Value& val ); - -template -void fill( const ForwardRange& rng, const Value& val ); +ForwardRange& fill( ForwardRange& rng, const Value& val ); `` [heading Description] diff --git a/doc/reference/algorithm/fill_n.qbk b/doc/reference/algorithm/fill_n.qbk new file mode 100644 index 0000000..a17695c --- /dev/null +++ b/doc/reference/algorithm/fill_n.qbk @@ -0,0 +1,31 @@ +[section:fill_n Range Algorithm - fill_n] + +[heading Prototype] + +`` +template +ForwardRange& fill( ForwardRange& rng, Size n, const Value& val ); +`` + +[heading Description] + +`fill_n` assigns the value `val` to `n` elements in the range `rng` begining with `boost::begin(rng)`. + +[heading Definition] + +Defined in the header file `boost/range/algorithm/fill_n.hpp` + +[heading Requirements] + +* `ForwardRange` is a model of the __forward_range__ Concept. +* `ForwardRange` is mutable. +* `Value` is a model of the `AssignableConcept`. +* `Value` is convertible to `ForwardRange`'s value type. + +[heading Complexity] + +Linear. Exactly `n` assignments are performed. + +[endsect] + + diff --git a/doc/reference/algorithm/make_heap.qbk b/doc/reference/algorithm/make_heap.qbk index 6f54a15..13238fc 100644 --- a/doc/reference/algorithm/make_heap.qbk +++ b/doc/reference/algorithm/make_heap.qbk @@ -4,16 +4,16 @@ `` template -void make_heap(RandomAccessRange& rng); +RandomAccessRange& make_heap(RandomAccessRange& rng); template -void make_heap(const RandomAccessRange& rng); +const RandomAccessRange& make_heap(const RandomAccessRange& rng); template -void make_heap(RandomAccessRange& rng, Compare pred); +RandomAccessRange& make_heap(RandomAccessRange& rng, Compare pred); template -void make_heap(const RandomAccessRange& rng, Compare pred); +const RandomAccessRange& make_heap(const RandomAccessRange& rng, Compare pred); `` [heading Description] @@ -21,7 +21,7 @@ void make_heap(const RandomAccessRange& rng, Compare pred); `make_heap` turns `rng` into a heap. The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions. - + [heading Definition] Defined in the header file `boost/range/algorithm/heap_algorithm.hpp` diff --git a/doc/reference/algorithm/next_permutation.qbk b/doc/reference/algorithm/next_permutation.qbk index 37b901a..3da1383 100644 --- a/doc/reference/algorithm/next_permutation.qbk +++ b/doc/reference/algorithm/next_permutation.qbk @@ -4,16 +4,16 @@ `` template -void next_permutation(BidirectionalRange& rng); +bool next_permutation(BidirectionalRange& rng); template -void next_permutation(const BidirectionalRange& rng); +bool next_permutation(const BidirectionalRange& rng); template -void next_permutation(BidirectionalRange& rng, Compare pred); +bool next_permutation(BidirectionalRange& rng, Compare pred); template -void next_permutation(const BidirectionalRange& rng, Compare pred); +bool next_permutation(const BidirectionalRange& rng, Compare pred); `` [heading Description] @@ -21,7 +21,7 @@ void next_permutation(const BidirectionalRange& rng, Compare pred); `next_permutation` transforms the range of elements `rng` into the lexicographically next greater permutation of the elements if such a permutation exists. If one does not exist then the range is transformed into the lexicographically smallest permutation and `false` is returned. `true` is returned when the next greater permutation is successfully generated. The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions. - + [heading Definition] Defined in the header file `boost/range/algorithm/permutation.hpp` diff --git a/doc/reference/algorithm/nth_element.qbk b/doc/reference/algorithm/nth_element.qbk index 69c87a8..9b888b6 100644 --- a/doc/reference/algorithm/nth_element.qbk +++ b/doc/reference/algorithm/nth_element.qbk @@ -4,22 +4,26 @@ `` template -void nth_element(RandomAccessRange& rng, - typename range_iterator::type nth); - +RandomAccessRange& nth_element( + RandomAccessRange& rng, + typename range_iterator::type nth); + template -void nth_element(const RandomAccessRange& rng, - typename range_iterator::type nth); - +const RandomAccessRange& nth_element( + const RandomAccessRange& rng, + typename range_iterator::type nth); + template -void nth_element(RandomAccessRange& rng, - typename range_iterator::type nth, - BinaryPredicate sort_pred); - +RandomAccessRange& nth_element( + RandomAccessRange& rng, + typename range_iterator::type nth, + BinaryPredicate sort_pred); + template -void nth_element(const RandomAccessRange& rng, - typename range_iterator::type nth, - BinaryPredicate sort_pred); +const RandomAccessRange& nth_element( + const RandomAccessRange& rng, + typename range_iterator::type nth, + BinaryPredicate sort_pred); `` [heading Description] diff --git a/doc/reference/algorithm/partial_sort.qbk b/doc/reference/algorithm/partial_sort.qbk index 298c16f..794415a 100644 --- a/doc/reference/algorithm/partial_sort.qbk +++ b/doc/reference/algorithm/partial_sort.qbk @@ -4,22 +4,26 @@ `` template -void partial_sort(RandomAccessRange& rng, - typename range_iterator::type middle); - +RandomAccessRange& partial_sort( + RandomAccessRange& rng, + typename range_iterator::type middle); + template -void partial_sort(const RandomAccessRange& rng, - typename range_iterator::type middle); - +const RandomAccessRange& partial_sort( + const RandomAccessRange& rng, + typename range_iterator::type middle); + template -void partial_sort(RandomAccessRange& rng, - typename range_iterator::type middle, - BinaryPredicate sort_pred); - +RandomAccessRange& partial_sort( + RandomAccessRange& rng, + typename range_iterator::type middle, + BinaryPredicate sort_pred); + template -void partial_sort(const RandomAccessRange& rng, - typename range_iterator::type middle, - BinaryPredicate sort_pred); +const RandomAccessRange& partial_sort( + const RandomAccessRange& rng, + typename range_iterator::type middle, + BinaryPredicate sort_pred); `` [heading Description] diff --git a/doc/reference/algorithm/pop_heap.qbk b/doc/reference/algorithm/pop_heap.qbk index 4479d46..8b3d900 100644 --- a/doc/reference/algorithm/pop_heap.qbk +++ b/doc/reference/algorithm/pop_heap.qbk @@ -4,16 +4,16 @@ `` template -void pop_heap(RandomAccessRange& rng); +RandomAccessRange& pop_heap(RandomAccessRange& rng); template -void pop_heap(const RandomAccessRange& rng); +const RandomAccessRange& pop_heap(const RandomAccessRange& rng); template -void pop_heap(RandomAccessRange& rng, Compare pred); +RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare pred); template -void pop_heap(const RandomAccessRange& rng, Compare pred); +const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare pred); `` [heading Description] @@ -21,7 +21,7 @@ void pop_heap(const RandomAccessRange& rng, Compare pred); `pop_heap` removes the largest element from the heap. It is assumed that `begin(rng), prior(end(rng))` is already a heap and that the element to be added is `*prior(end(rng))`. The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions. - + [heading Definition] Defined in the header file `boost/range/algorithm/heap_algorithm.hpp` diff --git a/doc/reference/algorithm/prev_permutation.qbk b/doc/reference/algorithm/prev_permutation.qbk index 11642a4..d40eb6a 100644 --- a/doc/reference/algorithm/prev_permutation.qbk +++ b/doc/reference/algorithm/prev_permutation.qbk @@ -4,16 +4,16 @@ `` template -void prev_permutation(BidirectionalRange& rng); +bool prev_permutation(BidirectionalRange& rng); template -void prev_permutation(const BidirectionalRange& rng); +bool prev_permutation(const BidirectionalRange& rng); template -void prev_permutation(BidirectionalRange& rng, Compare pred); +bool prev_permutation(BidirectionalRange& rng, Compare pred); template -void prev_permutation(const BidirectionalRange& rng, Compare pred); +bool prev_permutation(const BidirectionalRange& rng, Compare pred); `` [heading Description] @@ -21,7 +21,7 @@ void prev_permutation(const BidirectionalRange& rng, Compare pred); `prev_permutation` transforms the range of elements `rng` into the lexicographically next smaller permutation of the elements if such a permutation exists. If one does not exist then the range is transformed into the lexicographically largest permutation and `false` is returned. `true` is returned when the next smaller permutation is successfully generated. The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions. - + [heading Definition] Defined in the header file `boost/range/algorithm/permutation.hpp` diff --git a/doc/reference/algorithm/push_heap.qbk b/doc/reference/algorithm/push_heap.qbk index eae2466..ddc7df2 100644 --- a/doc/reference/algorithm/push_heap.qbk +++ b/doc/reference/algorithm/push_heap.qbk @@ -4,16 +4,16 @@ `` template -void push_heap(RandomAccessRange& rng); +RandomAccessRange& push_heap(RandomAccessRange& rng); template -void push_heap(const RandomAccessRange& rng); +const RandomAccessRange& push_heap(const RandomAccessRange& rng); template -void push_heap(RandomAccessRange& rng, Compare pred); +RandomAccessRange& push_heap(RandomAccessRange& rng, Compare pred); template -void push_heap(const RandomAccessRange& rng, Compare pred); +const RandomAccessRange& push_heap(const RandomAccessRange& rng, Compare pred); `` [heading Description] @@ -21,7 +21,7 @@ void push_heap(const RandomAccessRange& rng, Compare pred); `push_heap` adds an element to a heap. It is assumed that `begin(rng)`, `prior(end(rng))` is already a heap and that the element to be added is `*prior(end(rng))`. The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions. - + [heading Definition] Defined in the header file `boost/range/algorithm/heap_algorithm.hpp` diff --git a/doc/reference/algorithm/sort_heap.qbk b/doc/reference/algorithm/sort_heap.qbk index 9a24887..13e4133 100644 --- a/doc/reference/algorithm/sort_heap.qbk +++ b/doc/reference/algorithm/sort_heap.qbk @@ -4,16 +4,16 @@ `` template -void sort_heap(RandomAccessRange& rng); +RandomAccessRange& sort_heap(RandomAccessRange& rng); template -void sort_heap(const RandomAccessRange& rng); +const RandomAccessRange& sort_heap(const RandomAccessRange& rng); template -void sort_heap(RandomAccessRange& rng, Compare pred); +RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare pred); template -void sort_heap(const RandomAccessRange& rng, Compare pred); +const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare pred); `` [heading Description] @@ -21,7 +21,7 @@ void sort_heap(const RandomAccessRange& rng, Compare pred); `sort_heap` turns a heap into a sorted range. The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions. - + [heading Definition] Defined in the header file `boost/range/algorithm/heap_algorithm.hpp` diff --git a/doc/reference/algorithm_ext/erase.qbk b/doc/reference/algorithm_ext/erase.qbk index 64c48a8..5e8c746 100644 --- a/doc/reference/algorithm_ext/erase.qbk +++ b/doc/reference/algorithm_ext/erase.qbk @@ -3,18 +3,20 @@ [heading Prototype] `` -template< - class Container, - class SinglePassRange - > -void erase(Container& target, - iterator_range to_erase); +template +Container& erase( + Container& target, + iterator_range to_erase); `` [heading Description] `erase` the iterator range `to_erase` from the container `target`. +`remove_erase` performs the frequently used combination equivalent to `target.erase(std::remove(target.begin(), target.end(), value), target.end());` + +`remove_erase_if` performs the frequently used combination equivalent to `target.erase(std::remove_if(target.begin(), target.end(), pred), target.end());` + [heading Definition] Defined in the header file `boost/range/algorithm_ext/erase.hpp` diff --git a/doc/reference/algorithm_ext/insert.qbk b/doc/reference/algorithm_ext/insert.qbk index 1d9c567..4d5dc39 100644 --- a/doc/reference/algorithm_ext/insert.qbk +++ b/doc/reference/algorithm_ext/insert.qbk @@ -7,9 +7,9 @@ template< class Container, class SinglePassRange > -void insert(Container& target, - typename Container::iterator before, - const SinglePassRange& from); +Container& insert(Container& target, + typename Container::iterator before, + const SinglePassRange& from); `` [heading Description] diff --git a/doc/reference/algorithm_ext/iota.qbk b/doc/reference/algorithm_ext/iota.qbk index c098708..36cd7ab 100644 --- a/doc/reference/algorithm_ext/iota.qbk +++ b/doc/reference/algorithm_ext/iota.qbk @@ -3,8 +3,8 @@ [heading Prototype] `` -template -iota(SinglePassRange& rng, Value x); +template +ForwardRange& iota(ForwardRange& rng, Value x); `` [heading Description] @@ -18,7 +18,7 @@ Defined in the header file `boost/range/algorithm_ext/iota.hpp` [heading Requirements] -# `SinglePassRange` is a model of the __single_pass_range__ Concept. +# `ForwardRange` is a model of the __forward_range__ Concept. # `Value` is a model of the `Incrementable` Concept. [heading Complexity] diff --git a/doc/reference/algorithm_ext/push_back.qbk b/doc/reference/algorithm_ext/push_back.qbk index f3c8952..101fd30 100644 --- a/doc/reference/algorithm_ext/push_back.qbk +++ b/doc/reference/algorithm_ext/push_back.qbk @@ -7,8 +7,8 @@ template< class Container, class SinglePassRange > -void push_back(Container& target, - const SinglePassRange& from); +Container& push_back(Container& target, + const SinglePassRange& from); `` [heading Description] diff --git a/doc/reference/algorithm_ext/push_front.qbk b/doc/reference/algorithm_ext/push_front.qbk index d827105..edb540c 100644 --- a/doc/reference/algorithm_ext/push_front.qbk +++ b/doc/reference/algorithm_ext/push_front.qbk @@ -7,8 +7,8 @@ template< class Container, class SinglePassRange > -void push_front(Container& target, - const SinglePassRange& from); +Container& push_front(Container& target, + const SinglePassRange& from); `` [heading Description] diff --git a/doc/reference/algorithm_ext/remove_erase.qbk b/doc/reference/algorithm_ext/remove_erase.qbk index 0164768..25fb564 100644 --- a/doc/reference/algorithm_ext/remove_erase.qbk +++ b/doc/reference/algorithm_ext/remove_erase.qbk @@ -3,17 +3,14 @@ [heading Prototype] `` -template< - class Container, - class T - > -void remove_erase(Container& target, - const T& val); +template +Container& remove_erase(Container& target, + const Value& value); `` [heading Description] -`remove_erase` actually eliminates the elements equal to `val` from the container. This +`remove_erase` actually eliminates the elements equal to `value` from the container. This is in contrast to the `remove` algorithm which merely rearranges elements. [heading Definition] diff --git a/doc/reference/algorithm_ext/remove_erase_if.qbk b/doc/reference/algorithm_ext/remove_erase_if.qbk index f0ae749..0b8648e 100644 --- a/doc/reference/algorithm_ext/remove_erase_if.qbk +++ b/doc/reference/algorithm_ext/remove_erase_if.qbk @@ -3,12 +3,9 @@ [heading Prototype] `` -template< - class Container, - class Pred - > -void remove_erase(Container& target, - Pred pred); +template +Container& remove_erase_if(Container& target, + Pred pred); `` [heading Description] diff --git a/doc/reference/algorithms.qbk b/doc/reference/algorithms.qbk index 00b3edb..dca35d4 100644 --- a/doc/reference/algorithms.qbk +++ b/doc/reference/algorithms.qbk @@ -82,6 +82,7 @@ and there is no need to worry about generating an invalid range. Furthermore, if [include algorithm/copy.qbk] [include algorithm/copy_backward.qbk] [include algorithm/fill.qbk] +[include algorithm/fill_n.qbk] [include algorithm/generate.qbk] [include algorithm/inplace_merge.qbk] [include algorithm/merge.qbk] @@ -133,6 +134,7 @@ and there is no need to worry about generating an invalid range. Furthermore, if [include algorithm/push_heap.qbk] [include algorithm/pop_heap.qbk] [include algorithm/make_heap.qbk] +[include algorithm/sort_heap.qbk] [endsect] [section:permutation_algorithms Permutation algorithms] diff --git a/include/boost/range/adaptor/adjacent_filtered.hpp b/include/boost/range/adaptor/adjacent_filtered.hpp index 5f66711..c01f1c1 100644 --- a/include/boost/range/adaptor/adjacent_filtered.hpp +++ b/include/boost/range/adaptor/adjacent_filtered.hpp @@ -28,11 +28,11 @@ namespace boost { - namespace range_detail - { - template< class Iter, class Pred, bool default_pass > - class skip_iterator - : public boost::iterator_adaptor< + namespace range_detail + { + template< class Iter, class Pred, bool default_pass > + class skip_iterator + : public boost::iterator_adaptor< skip_iterator, Iter, BOOST_DEDUCED_TYPENAME std::iterator_traits::value_type, @@ -40,10 +40,10 @@ namespace boost BOOST_DEDUCED_TYPENAME std::iterator_traits::reference, BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type > - , private Pred - { - private: - typedef boost::iterator_adaptor< + , private Pred + { + private: + typedef boost::iterator_adaptor< skip_iterator, Iter, BOOST_DEDUCED_TYPENAME std::iterator_traits::value_type, @@ -52,9 +52,9 @@ namespace boost BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type > base_t; - public: + public: typedef Pred pred_t; - typedef Iter iter_t; + typedef Iter iter_t; skip_iterator() : m_last() {} @@ -66,169 +66,169 @@ namespace boost move_to_next_valid(); } - template - skip_iterator( const skip_iterator& other ) - : base_t(other.base()) - , pred_t(other) - , m_last(other.m_last) {} + template + skip_iterator( const skip_iterator& other ) + : base_t(other.base()) + , pred_t(other) + , m_last(other.m_last) {} void move_to_next_valid() - { - iter_t& it = this->base_reference(); - pred_t& bi_pred = *this; - if (it != m_last) - { - if (default_pass) - { - iter_t nxt = ::boost::next(it); - while (nxt != m_last && !bi_pred(*it, *nxt)) - { - ++it; - ++nxt; - } - } - else - { - iter_t nxt = ::boost::next(it); - for(; nxt != m_last; ++it, ++nxt) - { - if (bi_pred(*it, *nxt)) - { - break; - } - } - if (nxt == m_last) - { - it = m_last; - } - } - } - } + { + iter_t& it = this->base_reference(); + pred_t& bi_pred = *this; + if (it != m_last) + { + if (default_pass) + { + iter_t nxt = ::boost::next(it); + while (nxt != m_last && !bi_pred(*it, *nxt)) + { + ++it; + ++nxt; + } + } + else + { + iter_t nxt = ::boost::next(it); + for(; nxt != m_last; ++it, ++nxt) + { + if (bi_pred(*it, *nxt)) + { + break; + } + } + if (nxt == m_last) + { + it = m_last; + } + } + } + } - void increment() - { - iter_t& it = this->base_reference(); - BOOST_ASSERT( it != m_last ); - ++it; - move_to_next_valid(); - } + void increment() + { + iter_t& it = this->base_reference(); + BOOST_ASSERT( it != m_last ); + ++it; + move_to_next_valid(); + } iter_t m_last; - }; + }; - template< class P, class R, bool default_pass > - struct adjacent_filter_range - : iterator_range< skip_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - P, - default_pass + template< class P, class R, bool default_pass > + struct adjacent_filter_range + : iterator_range< skip_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + P, + default_pass > > - { - private: - typedef skip_iterator< + { + private: + typedef skip_iterator< BOOST_DEDUCED_TYPENAME range_iterator::type, P, default_pass > - skip_iter; + skip_iter; - typedef iterator_range - base_range; + typedef iterator_range + base_range; - typedef BOOST_DEDUCED_TYPENAME range_iterator::type raw_iterator; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type raw_iterator; - public: - adjacent_filter_range( const P& p, R& r ) - : base_range( skip_iter( boost::begin(r), boost::end(r), p), - skip_iter( boost::end(r), boost::end(r), p) ) - { - } - }; + public: + adjacent_filter_range( const P& p, R& r ) + : base_range( skip_iter( boost::begin(r), boost::end(r), p), + skip_iter( boost::end(r), boost::end(r), p) ) + { + } + }; - template< class T > - struct adjacent_holder : holder - { - adjacent_holder( T r ) : holder(r) - { } - }; + template< class T > + struct adjacent_holder : holder + { + adjacent_holder( T r ) : holder(r) + { } + }; - template< class T > - struct adjacent_excl_holder : holder - { - adjacent_excl_holder( T r ) : holder(r) - { } - }; + template< class T > + struct adjacent_excl_holder : holder + { + adjacent_excl_holder( T r ) : holder(r) + { } + }; - template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range - operator|( ForwardRng& r, - const adjacent_holder& f ) - { - return adjacent_filter_range( f.val, r ); - } + template< class ForwardRng, class BinPredicate > + inline adjacent_filter_range + operator|( ForwardRng& r, + const adjacent_holder& f ) + { + return adjacent_filter_range( f.val, r ); + } - template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range - operator|( const ForwardRng& r, - const adjacent_holder& f ) - { - return adjacent_filter_range( f.val, r ); - } + template< class ForwardRng, class BinPredicate > + inline adjacent_filter_range + operator|( const ForwardRng& r, + const adjacent_holder& f ) + { + return adjacent_filter_range( f.val, r ); + } - template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range - operator|( ForwardRng& r, - const adjacent_excl_holder& f ) - { - return adjacent_filter_range( f.val, r ); - } + template< class ForwardRng, class BinPredicate > + inline adjacent_filter_range + operator|( ForwardRng& r, + const adjacent_excl_holder& f ) + { + return adjacent_filter_range( f.val, r ); + } - template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range - operator|( const ForwardRng& r, - const adjacent_excl_holder& f ) - { - return adjacent_filter_range( f.val, r ); - } + template< class ForwardRng, class BinPredicate > + inline adjacent_filter_range + operator|( const ForwardRng& r, + const adjacent_excl_holder& f ) + { + return adjacent_filter_range( f.val, r ); + } - } // 'range_detail' + } // 'range_detail' - // Bring adjacent_filter_range into the boost namespace so that users of - // this library may specify the return type of the '|' operator and - // adjacent_filter() - using range_detail::adjacent_filter_range; + // Bring adjacent_filter_range into the boost namespace so that users of + // this library may specify the return type of the '|' operator and + // adjacent_filter() + using range_detail::adjacent_filter_range; - namespace adaptors - { - namespace - { - const range_detail::forwarder + namespace adaptors + { + namespace + { + const range_detail::forwarder adjacent_filtered = range_detail::forwarder(); - const range_detail::forwarder - adjacent_filtered_excl = - range_detail::forwarder(); - } + const range_detail::forwarder + adjacent_filtered_excl = + range_detail::forwarder(); + } - template - inline adjacent_filter_range - adjacent_filter(ForwardRng& rng, BinPredicate filter_pred) - { - return adjacent_filter_range(filter_pred, rng); - } + template + inline adjacent_filter_range + adjacent_filter(ForwardRng& rng, BinPredicate filter_pred) + { + return adjacent_filter_range(filter_pred, rng); + } - template - inline adjacent_filter_range - adjacent_filter(const ForwardRng& rng, BinPredicate filter_pred) - { - return adjacent_filter_range(filter_pred, rng); - } + template + inline adjacent_filter_range + adjacent_filter(const ForwardRng& rng, BinPredicate filter_pred) + { + return adjacent_filter_range(filter_pred, rng); + } - } // 'adaptors' + } // 'adaptors' } diff --git a/include/boost/range/adaptor/argument_fwd.hpp b/include/boost/range/adaptor/argument_fwd.hpp index 357056b..fbfd40c 100755 --- a/include/boost/range/adaptor/argument_fwd.hpp +++ b/include/boost/range/adaptor/argument_fwd.hpp @@ -20,57 +20,57 @@ namespace boost { - namespace range_detail - { - template< class T > - struct holder - { - T val; - holder( T t ) : val(t) - { } - }; + namespace range_detail + { + template< class T > + struct holder + { + T val; + holder( T t ) : val(t) + { } + }; - template< class T > - struct holder2 - { - T val1, val2; - holder2( T t, T u ) : val1(t), val2(u) - { } - }; - - template< template class Holder > - struct forwarder - { - template< class T > - Holder operator()( T t ) const - { - return Holder(t); - } - }; + template< class T > + struct holder2 + { + T val1, val2; + holder2( T t, T u ) : val1(t), val2(u) + { } + }; + + template< template class Holder > + struct forwarder + { + template< class T > + Holder operator()( T t ) const + { + return Holder(t); + } + }; - template< template class Holder > - struct forwarder2 - { - template< class T > - Holder operator()( T t, T u ) const - { - return Holder(t,u); - } - }; + template< template class Holder > + struct forwarder2 + { + template< class T > + Holder operator()( T t, T u ) const + { + return Holder(t,u); + } + }; - template< template class Holder > - struct forwarder2TU - { - template< class T, class U > - Holder operator()( T t, U u ) const - { - return Holder(t, u); - } - }; + template< template class Holder > + struct forwarder2TU + { + template< class T, class U > + Holder operator()( T t, U u ) const + { + return Holder(t, u); + } + }; - } - + } + } #ifdef BOOST_MSVC diff --git a/include/boost/range/adaptor/copied.hpp b/include/boost/range/adaptor/copied.hpp index 1862b5f..f4cf2d1 100755 --- a/include/boost/range/adaptor/copied.hpp +++ b/include/boost/range/adaptor/copied.hpp @@ -18,40 +18,40 @@ namespace boost { - namespace adaptors - { - struct copied - { - copied(std::size_t t_, std::size_t u_) + namespace adaptors + { + struct copied + { + copied(std::size_t t_, std::size_t u_) : t(t_), u(u_) {} std::size_t t; std::size_t u; - }; + }; - template< class CopyableRandomAccessRng > - inline CopyableRandomAccessRng - operator|( const CopyableRandomAccessRng& r, const copied& f ) - { - iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type > - temp( adaptors::slice( r, f.t, f.u ) ); - return CopyableRandomAccessRng( temp.begin(), temp.end() ); - } + template< class CopyableRandomAccessRng > + inline CopyableRandomAccessRng + operator|( const CopyableRandomAccessRng& r, const copied& f ) + { + iterator_range< + BOOST_DEDUCED_TYPENAME range_iterator::type > + temp( adaptors::slice( r, f.t, f.u ) ); + return CopyableRandomAccessRng( temp.begin(), temp.end() ); + } - template - inline CopyableRandomAccessRange - copy(const CopyableRandomAccessRange& rng, std::size_t t, std::size_t u) - { - iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type> temp( - adaptors::slice(rng, t, u)); + template + inline CopyableRandomAccessRange + copy(const CopyableRandomAccessRange& rng, std::size_t t, std::size_t u) + { + iterator_range< + BOOST_DEDUCED_TYPENAME range_iterator::type> temp( + adaptors::slice(rng, t, u)); return CopyableRandomAccessRange( temp.begin(), temp.end() ); - } - } // 'adaptors' + } + } // 'adaptors' } diff --git a/include/boost/range/adaptor/filtered.hpp b/include/boost/range/adaptor/filtered.hpp index 1bc4799..62888e7 100755 --- a/include/boost/range/adaptor/filtered.hpp +++ b/include/boost/range/adaptor/filtered.hpp @@ -17,84 +17,84 @@ namespace boost { - namespace range_detail - { - template< class P, class R > - struct filter_range : + namespace range_detail + { + template< class P, class R > + struct filter_range : boost::iterator_range< boost::filter_iterator< P, - BOOST_DEDUCED_TYPENAME range_iterator::type + BOOST_DEDUCED_TYPENAME range_iterator::type > > - { - private: - typedef boost::iterator_range< + { + private: + typedef boost::iterator_range< boost::filter_iterator< P, BOOST_DEDUCED_TYPENAME range_iterator::type > > base; - public: - filter_range( P p, R& r ) - : base( make_filter_iterator( p, boost::begin(r), boost::end(r) ), - make_filter_iterator( p, boost::end(r), boost::end(r) ) ) - { } - }; + public: + filter_range( P p, R& r ) + : base( make_filter_iterator( p, boost::begin(r), boost::end(r) ), + make_filter_iterator( p, boost::end(r), boost::end(r) ) ) + { } + }; - template< class T > - struct filter_holder : holder - { - filter_holder( T r ) : holder(r) - { } - }; + template< class T > + struct filter_holder : holder + { + filter_holder( T r ) : holder(r) + { } + }; - template< class InputRng, class Predicate > - inline filter_range - operator|( InputRng& r, - const filter_holder& f ) - { - return filter_range( f.val, r ); - } - - template< class InputRng, class Predicate > - inline filter_range - operator|( const InputRng& r, - const filter_holder& f ) - { - return filter_range( f.val, r ); - } - - } // 'range_detail' - - // Unusual use of 'using' is intended to bring filter_range into the boost namespace - // while leaving the mechanics of the '|' operator in range_detail and maintain - // argument dependent lookup. - // filter_range logically needs to be in the boost namespace to allow user of - // the library to define the return type for filter() - using range_detail::filter_range; - - namespace adaptors - { - namespace - { - const range_detail::forwarder - filtered = - range_detail::forwarder(); - } - - template - inline filter_range - filter(InputRange& rng, Predicate filter_pred) - { - return range_detail::filter_range( filter_pred, rng ); - } - - template - inline filter_range - filter(const InputRange& rng, Predicate filter_pred) - { - return range_detail::filter_range( filter_pred, rng ); + template< class InputRng, class Predicate > + inline filter_range + operator|( InputRng& r, + const filter_holder& f ) + { + return filter_range( f.val, r ); } - } // 'adaptors' + + template< class InputRng, class Predicate > + inline filter_range + operator|( const InputRng& r, + const filter_holder& f ) + { + return filter_range( f.val, r ); + } + + } // 'range_detail' + + // Unusual use of 'using' is intended to bring filter_range into the boost namespace + // while leaving the mechanics of the '|' operator in range_detail and maintain + // argument dependent lookup. + // filter_range logically needs to be in the boost namespace to allow user of + // the library to define the return type for filter() + using range_detail::filter_range; + + namespace adaptors + { + namespace + { + const range_detail::forwarder + filtered = + range_detail::forwarder(); + } + + template + inline filter_range + filter(InputRange& rng, Predicate filter_pred) + { + return range_detail::filter_range( filter_pred, rng ); + } + + template + inline filter_range + filter(const InputRange& rng, Predicate filter_pred) + { + return range_detail::filter_range( filter_pred, rng ); + } + } // 'adaptors' } diff --git a/include/boost/range/adaptor/indexed.hpp b/include/boost/range/adaptor/indexed.hpp index 7050185..5a523ce 100755 --- a/include/boost/range/adaptor/indexed.hpp +++ b/include/boost/range/adaptor/indexed.hpp @@ -40,56 +40,56 @@ namespace boost }; } - namespace range_detail - { - template< class Iter > - class indexed_iterator - : public boost::iterator_adaptor< indexed_iterator, Iter > - { - private: - typedef boost::iterator_adaptor< indexed_iterator, Iter > - base; + namespace range_detail + { + template< class Iter > + class indexed_iterator + : public boost::iterator_adaptor< indexed_iterator, Iter > + { + private: + typedef boost::iterator_adaptor< indexed_iterator, Iter > + base; - typedef BOOST_DEDUCED_TYPENAME base::difference_type index_type; + typedef BOOST_DEDUCED_TYPENAME base::difference_type index_type; - index_type m_index; + index_type m_index; - public: - explicit indexed_iterator( Iter i, index_type index ) - : base(i), m_index(index) - { - BOOST_ASSERT( m_index >= 0 && "Indexed Iterator out of bounds" ); - } + public: + explicit indexed_iterator( Iter i, index_type index ) + : base(i), m_index(index) + { + BOOST_ASSERT( m_index >= 0 && "Indexed Iterator out of bounds" ); + } - index_type index() const - { - return m_index; - } + index_type index() const + { + return m_index; + } - private: - friend class boost::iterator_core_access; + private: + friend class boost::iterator_core_access; - void increment() - { + void increment() + { ++m_index; ++(this->base_reference()); - } + } - void decrement() + void decrement() { BOOST_ASSERT( m_index > 0 && "Indexed Iterator out of bounds" ); --m_index; --(this->base_reference()); } - void advance( index_type n ) + void advance( index_type n ) { m_index += n; BOOST_ASSERT( m_index >= 0 && "Indexed Iterator out of bounds" ); this->base_reference() += n; } - }; + }; template< class Rng > struct indexed_range : @@ -107,45 +107,45 @@ namespace boost { } }; - } // 'range_detail' + } // 'range_detail' - // Make this available to users of this library. It will sometimes be - // required since it is the return type of operator '|' and - // index(). - using range_detail::indexed_range; + // Make this available to users of this library. It will sometimes be + // required since it is the return type of operator '|' and + // index(). + using range_detail::indexed_range; - namespace adaptors - { + namespace adaptors + { template< class SinglePassRange > - inline indexed_range - operator|( SinglePassRange& r, - const indexed& f ) - { - return indexed_range( f.val, r ); - } - - template< class SinglePassRange > - inline indexed_range - operator|( const SinglePassRange& r, - const indexed& f ) - { - return indexed_range( f.val, r ); - } - - template - inline indexed_range - index(SinglePassRange& rng, Index index_value) - { - return indexed_range(index_value, rng); - } - - template - inline indexed_range - index(const SinglePassRange& rng, Index index_value) - { - return indexed_range(index_value, rng); + inline indexed_range + operator|( SinglePassRange& r, + const indexed& f ) + { + return indexed_range( f.val, r ); } - } // 'adaptors' + + template< class SinglePassRange > + inline indexed_range + operator|( const SinglePassRange& r, + const indexed& f ) + { + return indexed_range( f.val, r ); + } + + template + inline indexed_range + index(SinglePassRange& rng, Index index_value) + { + return indexed_range(index_value, rng); + } + + template + inline indexed_range + index(const SinglePassRange& rng, Index index_value) + { + return indexed_range(index_value, rng); + } + } // 'adaptors' } diff --git a/include/boost/range/adaptor/indirected.hpp b/include/boost/range/adaptor/indirected.hpp index 5b13cfb..4abb3ec 100644 --- a/include/boost/range/adaptor/indirected.hpp +++ b/include/boost/range/adaptor/indirected.hpp @@ -16,72 +16,72 @@ namespace boost { - namespace range_detail - { - template< class R > - struct indirect_range : - public boost::iterator_range< + namespace range_detail + { + template< class R > + struct indirect_range : + public boost::iterator_range< boost::indirect_iterator< BOOST_DEDUCED_TYPENAME range_iterator::type > > - { - private: - typedef boost::iterator_range< + { + private: + typedef boost::iterator_range< boost::indirect_iterator< BOOST_DEDUCED_TYPENAME range_iterator::type > > - base; + base; - public: - explicit indirect_range( R& r ) + public: + explicit indirect_range( R& r ) : base( r ) - { } - }; + { } + }; - struct indirect_forwarder {}; + struct indirect_forwarder {}; - template< class InputRng > - inline indirect_range - operator|( InputRng& r, indirect_forwarder ) - { - return indirect_range( r ); - } + template< class InputRng > + inline indirect_range + operator|( InputRng& r, indirect_forwarder ) + { + return indirect_range( r ); + } - template< class InputRng > - inline indirect_range - operator|( const InputRng& r, indirect_forwarder ) - { - return indirect_range( r ); - } + template< class InputRng > + inline indirect_range + operator|( const InputRng& r, indirect_forwarder ) + { + return indirect_range( r ); + } - } // 'range_detail' + } // 'range_detail' - using range_detail::indirect_range; + using range_detail::indirect_range; - namespace adaptors - { - namespace - { - const range_detail::indirect_forwarder indirected = - range_detail::indirect_forwarder(); - } + namespace adaptors + { + namespace + { + const range_detail::indirect_forwarder indirected = + range_detail::indirect_forwarder(); + } - template - inline indirect_range - indirect(InputRange& rng) - { - return indirect_range(rng); - } + template + inline indirect_range + indirect(InputRange& rng) + { + return indirect_range(rng); + } - template - inline indirect_range - indirect(const InputRange& rng) - { - return indirect_range(rng); - } - } // 'adaptors' + template + inline indirect_range + indirect(const InputRange& rng) + { + return indirect_range(rng); + } + } // 'adaptors' } diff --git a/include/boost/range/adaptor/map.hpp b/include/boost/range/adaptor/map.hpp index f790e1a..a8a2c20 100755 --- a/include/boost/range/adaptor/map.hpp +++ b/include/boost/range/adaptor/map.hpp @@ -17,161 +17,161 @@ namespace boost { - namespace range_detail - { - struct map_keys_forwarder {}; - struct map_values_forwarder {}; + namespace range_detail + { + struct map_keys_forwarder {}; + struct map_values_forwarder {}; - template< class Map > - struct select_first - { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type& - result_type; + template< class Map > + struct select_first + { + typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; + typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type& + result_type; - result_type operator()( const pair_t& r ) const - { - return r.first; - } - }; + result_type operator()( const pair_t& r ) const + { + return r.first; + } + }; - template< class Map > - struct select_second_mutable - { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type; + template< class Map > + struct select_second_mutable + { + typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; + typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type; - result_type operator()( pair_t& r ) const - { - return r.second; - } - }; + result_type operator()( pair_t& r ) const + { + return r.second; + } + }; - template< class Map > - struct select_second_const - { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type& - result_type; - - result_type operator()( const pair_t& r ) const - { - return r.second; - } - }; - - template - class select_first_range - : public transform_range< - select_first, - const StdPairRng> - { - typedef transform_range, const StdPairRng> base; - public: - typedef select_first transform_fn_type; - typedef const StdPairRng source_range_type; + template< class Map > + struct select_second_const + { + typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; + typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type& + result_type; + + result_type operator()( const pair_t& r ) const + { + return r.second; + } + }; + + template + class select_first_range + : public transform_range< + select_first, + const StdPairRng> + { + typedef transform_range, const StdPairRng> base; + public: + typedef select_first transform_fn_type; + typedef const StdPairRng source_range_type; - select_first_range(transform_fn_type fn, source_range_type& rng) - : base(fn, rng) - { - } + select_first_range(transform_fn_type fn, source_range_type& rng) + : base(fn, rng) + { + } - select_first_range(const base& other) : base(other) {} - }; - - template - class select_second_mutable_range - : public transform_range< - select_second_mutable, - StdPairRng> - { - typedef transform_range, StdPairRng> base; - public: - typedef select_second_mutable transform_fn_type; - typedef StdPairRng source_range_type; + select_first_range(const base& other) : base(other) {} + }; + + template + class select_second_mutable_range + : public transform_range< + select_second_mutable, + StdPairRng> + { + typedef transform_range, StdPairRng> base; + public: + typedef select_second_mutable transform_fn_type; + typedef StdPairRng source_range_type; - select_second_mutable_range(transform_fn_type fn, source_range_type& rng) - : base(fn, rng) - { - } + select_second_mutable_range(transform_fn_type fn, source_range_type& rng) + : base(fn, rng) + { + } - select_second_mutable_range(const base& other) : base(other) {} - }; - - template - class select_second_const_range - : public transform_range< - select_second_const, - const StdPairRng> - { - typedef transform_range, const StdPairRng> base; - public: - typedef select_second_const transform_fn_type; - typedef const StdPairRng source_range_type; + select_second_mutable_range(const base& other) : base(other) {} + }; + + template + class select_second_const_range + : public transform_range< + select_second_const, + const StdPairRng> + { + typedef transform_range, const StdPairRng> base; + public: + typedef select_second_const transform_fn_type; + typedef const StdPairRng source_range_type; - select_second_const_range(transform_fn_type fn, source_range_type& rng) - : base(fn, rng) - { - } + select_second_const_range(transform_fn_type fn, source_range_type& rng) + : base(fn, rng) + { + } - select_second_const_range(const base& other) : base(other) {} - }; - - template< class StdPairRng > - inline select_first_range - operator|( const StdPairRng& r, map_keys_forwarder ) - { - return operator|( r, - boost::adaptors::transformed( select_first() ) ); - } + select_second_const_range(const base& other) : base(other) {} + }; + + template< class StdPairRng > + inline select_first_range + operator|( const StdPairRng& r, map_keys_forwarder ) + { + return operator|( r, + boost::adaptors::transformed( select_first() ) ); + } - template< class StdPairRng > - inline select_second_mutable_range - operator|( StdPairRng& r, map_values_forwarder ) - { - return operator|( r, - boost::adaptors::transformed( select_second_mutable() ) ); - } + template< class StdPairRng > + inline select_second_mutable_range + operator|( StdPairRng& r, map_values_forwarder ) + { + return operator|( r, + boost::adaptors::transformed( select_second_mutable() ) ); + } - template< class StdPairRng > - inline select_second_const_range - operator|( const StdPairRng& r, map_values_forwarder ) - { - return operator|( r, - boost::adaptors::transformed( select_second_const() ) ); - } - - } // 'range_detail' - - using range_detail::select_first_range; - using range_detail::select_second_mutable_range; - using range_detail::select_second_const_range; + template< class StdPairRng > + inline select_second_const_range + operator|( const StdPairRng& r, map_values_forwarder ) + { + return operator|( r, + boost::adaptors::transformed( select_second_const() ) ); + } + + } // 'range_detail' + + using range_detail::select_first_range; + using range_detail::select_second_mutable_range; + using range_detail::select_second_const_range; - namespace adaptors - { - namespace - { - const range_detail::map_keys_forwarder map_keys = - range_detail::map_keys_forwarder(); + namespace adaptors + { + namespace + { + const range_detail::map_keys_forwarder map_keys = + range_detail::map_keys_forwarder(); - const range_detail::map_values_forwarder map_values = - range_detail::map_values_forwarder(); - } - - template - inline select_first_range - keys(const StdPairRange& rng) - { - return select_first_range( - range_detail::select_first(), rng ); - } - - template - inline select_second_const_range - values(const StdPairRange& rng) - { - return select_second_const_range( - range_detail::select_second_const(), rng ); + const range_detail::map_values_forwarder map_values = + range_detail::map_values_forwarder(); + } + + template + inline select_first_range + keys(const StdPairRange& rng) + { + return select_first_range( + range_detail::select_first(), rng ); + } + + template + inline select_second_const_range + values(const StdPairRange& rng) + { + return select_second_const_range( + range_detail::select_second_const(), rng ); } template @@ -181,8 +181,8 @@ namespace boost return select_second_mutable_range( range_detail::select_second_mutable(), rng ); } - } // 'adaptors' - + } // 'adaptors' + } #endif diff --git a/include/boost/range/adaptor/replaced.hpp b/include/boost/range/adaptor/replaced.hpp index bdc0a2d..3c40918 100644 --- a/include/boost/range/adaptor/replaced.hpp +++ b/include/boost/range/adaptor/replaced.hpp @@ -22,99 +22,99 @@ namespace boost { - namespace range_detail - { - template< class Value > - class replace_value - { - public: - typedef const Value& result_type; - typedef const Value& first_argument_type; + namespace range_detail + { + template< class Value > + class replace_value + { + public: + typedef const Value& result_type; + typedef const Value& first_argument_type; - replace_value(const Value& from, const Value& to) - : m_from(from), m_to(to) - { - } + replace_value(const Value& from, const Value& to) + : m_from(from), m_to(to) + { + } - const Value& operator()(const Value& x) const - { - return (x == m_from) ? m_to : x; - } + const Value& operator()(const Value& x) const + { + return (x == m_from) ? m_to : x; + } - private: - Value m_from; - Value m_to; - }; + private: + Value m_from; + Value m_to; + }; - template< class R > - class replace_range : - public boost::iterator_range< - boost::transform_iterator< - replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, - BOOST_DEDUCED_TYPENAME range_iterator::type > > - { - private: - typedef replace_value< BOOST_DEDUCED_TYPENAME range_value::type > Fn; + template< class R > + class replace_range : + public boost::iterator_range< + boost::transform_iterator< + replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, + BOOST_DEDUCED_TYPENAME range_iterator::type > > + { + private: + typedef replace_value< BOOST_DEDUCED_TYPENAME range_value::type > Fn; - typedef boost::iterator_range< - boost::transform_iterator< - replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, - BOOST_DEDUCED_TYPENAME range_iterator::type > > base_t; + typedef boost::iterator_range< + boost::transform_iterator< + replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, + BOOST_DEDUCED_TYPENAME range_iterator::type > > base_t; - public: - typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; - replace_range( R& r, value_type from, value_type to ) - : base_t( make_transform_iterator( boost::begin(r), Fn(from, to) ), - make_transform_iterator( boost::end(r), Fn(from, to) ) ) - { } - }; + replace_range( R& r, value_type from, value_type to ) + : base_t( make_transform_iterator( boost::begin(r), Fn(from, to) ), + make_transform_iterator( boost::end(r), Fn(from, to) ) ) + { } + }; - template< class T > - class replace_holder : public holder2 - { - public: - replace_holder( const T& from, const T& to ) - : holder2(from, to) - { } - private: - // not assignable - void operator=(const replace_holder&); - }; + template< class T > + class replace_holder : public holder2 + { + public: + replace_holder( const T& from, const T& to ) + : holder2(from, to) + { } + private: + // not assignable + void operator=(const replace_holder&); + }; - template< class InputRng > - inline replace_range - operator|( InputRng& r, - const replace_holder::type>& f ) - { - return replace_range(r, f.val1, f.val2); - } + template< class InputRng > + inline replace_range + operator|( InputRng& r, + const replace_holder::type>& f ) + { + return replace_range(r, f.val1, f.val2); + } - template< class InputRng > - inline replace_range - operator|( const InputRng& r, - const replace_holder::type>& f ) - { - return replace_range(r, f.val1, f.val2); - } - } // 'range_detail' + template< class InputRng > + inline replace_range + operator|( const InputRng& r, + const replace_holder::type>& f ) + { + return replace_range(r, f.val1, f.val2); + } + } // 'range_detail' using range_detail::replace_range; - namespace adaptors - { - namespace - { - const range_detail::forwarder2 - replaced = - range_detail::forwarder2(); - } + namespace adaptors + { + namespace + { + const range_detail::forwarder2 + replaced = + range_detail::forwarder2(); + } - template - inline replace_range - replace(InputRange& rng, - BOOST_DEDUCED_TYPENAME range_value::type from, - BOOST_DEDUCED_TYPENAME range_value::type to) + template + inline replace_range + replace(InputRange& rng, + BOOST_DEDUCED_TYPENAME range_value::type from, + BOOST_DEDUCED_TYPENAME range_value::type to) { return replace_range(rng, from, to); } @@ -128,7 +128,7 @@ namespace boost return replace_range(rng, from ,to); } - } // 'adaptors' + } // 'adaptors' } // 'boost' #endif // include guard diff --git a/include/boost/range/adaptor/replaced_if.hpp b/include/boost/range/adaptor/replaced_if.hpp index 22264a2..9353abd 100644 --- a/include/boost/range/adaptor/replaced_if.hpp +++ b/include/boost/range/adaptor/replaced_if.hpp @@ -22,115 +22,115 @@ namespace boost { - namespace range_detail - { - template< class Pred, class Value > - class replace_value_if - { - public: - typedef const Value& result_type; - typedef const Value& first_argument_type; + namespace range_detail + { + template< class Pred, class Value > + class replace_value_if + { + public: + typedef const Value& result_type; + typedef const Value& first_argument_type; - replace_value_if(const Pred& pred, const Value& to) - : m_pred(pred), m_to(to) - { - } + replace_value_if(const Pred& pred, const Value& to) + : m_pred(pred), m_to(to) + { + } - const Value& operator()(const Value& x) const - { - return m_pred(x) ? m_to : x; - } + const Value& operator()(const Value& x) const + { + return m_pred(x) ? m_to : x; + } - private: - Pred m_pred; - Value m_to; - }; + private: + Pred m_pred; + Value m_to; + }; - template< class Pred, class R > - class replace_if_range : - public boost::iterator_range< - boost::transform_iterator< - replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type >, - BOOST_DEDUCED_TYPENAME range_iterator::type > > - { - private: - typedef replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type > Fn; + template< class Pred, class R > + class replace_if_range : + public boost::iterator_range< + boost::transform_iterator< + replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type >, + BOOST_DEDUCED_TYPENAME range_iterator::type > > + { + private: + typedef replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type > Fn; - typedef boost::iterator_range< - boost::transform_iterator< - replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type >, - BOOST_DEDUCED_TYPENAME range_iterator::type > > base_t; + typedef boost::iterator_range< + boost::transform_iterator< + replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type >, + BOOST_DEDUCED_TYPENAME range_iterator::type > > base_t; - public: - typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; - replace_if_range( R& r, const Pred& pred, value_type to ) - : base_t( make_transform_iterator( boost::begin(r), Fn(pred, to) ), - make_transform_iterator( boost::end(r), Fn(pred, to) ) ) - { } - }; + replace_if_range( R& r, const Pred& pred, value_type to ) + : base_t( make_transform_iterator( boost::begin(r), Fn(pred, to) ), + make_transform_iterator( boost::end(r), Fn(pred, to) ) ) + { } + }; - template< class Pred, class T > - class replace_if_holder - { - public: - replace_if_holder( const Pred& pred, const T& to ) - : m_pred(pred), m_to(to) - { } + template< class Pred, class T > + class replace_if_holder + { + public: + replace_if_holder( const Pred& pred, const T& to ) + : m_pred(pred), m_to(to) + { } - const Pred& pred() const { return m_pred; } - const T& to() const { return m_to; } + const Pred& pred() const { return m_pred; } + const T& to() const { return m_to; } - private: - Pred m_pred; - T m_to; - }; + private: + Pred m_pred; + T m_to; + }; - template< class Pred, class InputRng > - inline replace_if_range - operator|( InputRng& r, - const replace_if_holder::type>& f ) - { - return replace_if_range(r, f.pred(), f.to()); - } + template< class Pred, class InputRng > + inline replace_if_range + operator|( InputRng& r, + const replace_if_holder::type>& f ) + { + return replace_if_range(r, f.pred(), f.to()); + } - template< class Pred, class InputRng > - inline replace_if_range - operator|( const InputRng& r, - const replace_if_holder::type>& f ) - { - return replace_if_range(r, f.pred(), f.to()); - } - } // 'range_detail' + template< class Pred, class InputRng > + inline replace_if_range + operator|( const InputRng& r, + const replace_if_holder::type>& f ) + { + return replace_if_range(r, f.pred(), f.to()); + } + } // 'range_detail' using range_detail::replace_if_range; - namespace adaptors - { - namespace - { - const range_detail::forwarder2TU - replaced_if = - range_detail::forwarder2TU(); - } - - template - inline replace_if_range - replace_if(InputRange& rng, Pred pred, + namespace adaptors + { + namespace + { + const range_detail::forwarder2TU + replaced_if = + range_detail::forwarder2TU(); + } + + template + inline replace_if_range + replace_if(InputRange& rng, Pred pred, BOOST_DEDUCED_TYPENAME range_value::type to) - { - return range_detail::replace_if_range(rng, pred, to); - } + { + return range_detail::replace_if_range(rng, pred, to); + } - template - inline replace_if_range - replace_if(const InputRange& rng, Pred pred, - BOOST_DEDUCED_TYPENAME range_value::type to) - { - return range_detail::replace_if_range(rng, pred, to); - } - } // 'adaptors' - + template + inline replace_if_range + replace_if(const InputRange& rng, Pred pred, + BOOST_DEDUCED_TYPENAME range_value::type to) + { + return range_detail::replace_if_range(rng, pred, to); + } + } // 'adaptors' + } // 'boost' #endif // include guard diff --git a/include/boost/range/adaptor/reversed.hpp b/include/boost/range/adaptor/reversed.hpp index afe7517..229702b 100755 --- a/include/boost/range/adaptor/reversed.hpp +++ b/include/boost/range/adaptor/reversed.hpp @@ -16,75 +16,75 @@ namespace boost { - namespace range_detail - { - template< class R > - struct reverse_range : - public boost::iterator_range< - boost::reverse_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - { - private: - typedef boost::iterator_range< - boost::reverse_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - base; - - public: - typedef boost::reverse_iterator::type> iterator; + namespace range_detail + { + template< class R > + struct reverse_range : + public boost::iterator_range< + boost::reverse_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + { + private: + typedef boost::iterator_range< + boost::reverse_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + base; + + public: + typedef boost::reverse_iterator::type> iterator; - reverse_range( R& r ) - : base( iterator(boost::end(r)), iterator(boost::begin(r)) ) - { } - }; + reverse_range( R& r ) + : base( iterator(boost::end(r)), iterator(boost::begin(r)) ) + { } + }; - struct reverse_forwarder {}; - - template< class BidirectionalRng > - inline reverse_range - operator|( BidirectionalRng& r, reverse_forwarder ) - { - return reverse_range( r ); - } - - template< class BidirectionalRng > - inline reverse_range - operator|( const BidirectionalRng& r, reverse_forwarder ) - { - return reverse_range( r ); - } - - } // 'range_detail' - - using range_detail::reverse_range; - - namespace adaptors - { - namespace - { - const range_detail::reverse_forwarder reversed = - range_detail::reverse_forwarder(); - } - - template - inline reverse_range - reverse(BidirectionalRange& rng) - { - return reverse_range(rng); - } - - template - inline reverse_range - reverse(const BidirectionalRange& rng) - { - return reverse_range(rng); + struct reverse_forwarder {}; + + template< class BidirectionalRng > + inline reverse_range + operator|( BidirectionalRng& r, reverse_forwarder ) + { + return reverse_range( r ); } - } // 'adaptors' - + + template< class BidirectionalRng > + inline reverse_range + operator|( const BidirectionalRng& r, reverse_forwarder ) + { + return reverse_range( r ); + } + + } // 'range_detail' + + using range_detail::reverse_range; + + namespace adaptors + { + namespace + { + const range_detail::reverse_forwarder reversed = + range_detail::reverse_forwarder(); + } + + template + inline reverse_range + reverse(BidirectionalRange& rng) + { + return reverse_range(rng); + } + + template + inline reverse_range + reverse(const BidirectionalRange& rng) + { + return reverse_range(rng); + } + } // 'adaptors' + } // 'boost' #endif diff --git a/include/boost/range/adaptor/strided.hpp b/include/boost/range/adaptor/strided.hpp index 0c394b2..5f4c4fa 100755 --- a/include/boost/range/adaptor/strided.hpp +++ b/include/boost/range/adaptor/strided.hpp @@ -18,132 +18,132 @@ namespace boost { - namespace range_detail - { + namespace range_detail + { - template - class strided_iterator - : public iterator_adaptor< - strided_iterator, - BaseIterator> - { - friend class iterator_core_access; + template + class strided_iterator + : public iterator_adaptor< + strided_iterator, + BaseIterator> + { + friend class iterator_core_access; - typedef iterator_adaptor, BaseIterator> super_t; - - public: - typedef BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type difference_type; - - strided_iterator() : m_stride() { } - - strided_iterator(const strided_iterator& other) - : super_t(other), m_stride(other.m_stride) { } - - explicit strided_iterator(BaseIterator base_it, difference_type stride) - : super_t(base_it), m_stride(stride) { } - - strided_iterator& - operator=(const strided_iterator& other) - { - super_t::operator=(other); - - // Is the interoperation of the stride safe? - m_stride = other.m_stride; - return *this; - } - - void increment() { std::advance(this->base_reference(), m_stride); } - - void decrement() { std::advance(this->base_reference(), -m_stride); } - - void advance(difference_type n) { std::advance(this->base_reference(), n * m_stride); } - - difference_type - distance_to(const strided_iterator& other) const - { - return std::distance(this->base_reference(), other.base_reference()) / m_stride; - } + typedef iterator_adaptor, BaseIterator> super_t; + + public: + typedef BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type difference_type; + + strided_iterator() : m_stride() { } + + strided_iterator(const strided_iterator& other) + : super_t(other), m_stride(other.m_stride) { } + + explicit strided_iterator(BaseIterator base_it, difference_type stride) + : super_t(base_it), m_stride(stride) { } + + strided_iterator& + operator=(const strided_iterator& other) + { + super_t::operator=(other); + + // Is the interoperation of the stride safe? + m_stride = other.m_stride; + return *this; + } + + void increment() { std::advance(this->base_reference(), m_stride); } + + void decrement() { std::advance(this->base_reference(), -m_stride); } + + void advance(difference_type n) { std::advance(this->base_reference(), n * m_stride); } + + difference_type + distance_to(const strided_iterator& other) const + { + return std::distance(this->base_reference(), other.base_reference()) / m_stride; + } - // Using the compiler generated copy constructor and - // and assignment operator - - private: - difference_type m_stride; - }; - - template inline - strided_iterator - make_strided_iterator( - const BaseIterator& first, - BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type stride) - { - return strided_iterator(first, stride); - } + // Using the compiler generated copy constructor and + // and assignment operator + + private: + difference_type m_stride; + }; + + template inline + strided_iterator + make_strided_iterator( + const BaseIterator& first, + BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type stride) + { + return strided_iterator(first, stride); + } - template< class Rng > - class strided_range - : public iterator_range::type> > - { - typedef range_detail::strided_iterator::type> iter_type; - typedef iterator_range super_t; - public: - template< typename Difference > - strided_range(Difference stride, Rng& rng) + template< class Rng > + class strided_range + : public iterator_range::type> > + { + typedef range_detail::strided_iterator::type> iter_type; + typedef iterator_range super_t; + public: + template< typename Difference > + strided_range(Difference stride, Rng& rng) : super_t(make_strided_iterator(boost::begin(rng), stride), make_strided_iterator(boost::end(rng), stride)) - { - } - }; + { + } + }; - template - class strided_holder : public holder - { - public: - strided_holder(Difference value) : holder(value) {} - }; + template + class strided_holder : public holder + { + public: + strided_holder(Difference value) : holder(value) {} + }; - template - inline strided_range - operator|(Rng& rng, const strided_holder& stride) - { - return strided_range(stride.val, rng); - } + template + inline strided_range + operator|(Rng& rng, const strided_holder& stride) + { + return strided_range(stride.val, rng); + } - template - inline strided_range - operator|(const Rng& rng, const strided_holder& stride) - { - return strided_range(stride.val, rng); - } + template + inline strided_range + operator|(const Rng& rng, const strided_holder& stride) + { + return strided_range(stride.val, rng); + } - } // namespace range_detail - - using range_detail::strided_range; + } // namespace range_detail + + using range_detail::strided_range; - namespace adaptors - { - - namespace - { - const range_detail::forwarder - strided = range_detail::forwarder(); - } - - template - inline strided_range - stride(Range& rng, Difference step) - { - return strided_range(step, rng); - } - - template - inline strided_range - stride(const Range& rng, Difference step) - { - return strided_range(step, rng); + namespace adaptors + { + + namespace + { + const range_detail::forwarder + strided = range_detail::forwarder(); } - } // namespace 'adaptors' + template + inline strided_range + stride(Range& rng, Difference step) + { + return strided_range(step, rng); + } + + template + inline strided_range + stride(const Range& rng, Difference step) + { + return strided_range(step, rng); + } + + } // namespace 'adaptors' } // namespace 'boost' #endif diff --git a/include/boost/range/adaptor/tokenized.hpp b/include/boost/range/adaptor/tokenized.hpp index c81d515..6b6a6fa 100755 --- a/include/boost/range/adaptor/tokenized.hpp +++ b/include/boost/range/adaptor/tokenized.hpp @@ -16,122 +16,122 @@ namespace boost { - namespace range_detail - { + namespace range_detail + { - template< class R > - struct token_range : - public boost::iterator_range< - boost::regex_token_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - { - private: - typedef - boost::regex_token_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type - > - regex_iter; - - typedef BOOST_DEDUCED_TYPENAME regex_iter::regex_type - regex_type; - - typedef boost::iterator_range - base; + template< class R > + struct token_range : + public boost::iterator_range< + boost::regex_token_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + { + private: + typedef + boost::regex_token_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + regex_iter; + + typedef BOOST_DEDUCED_TYPENAME regex_iter::regex_type + regex_type; + + typedef boost::iterator_range + base; - public: - template< class Regex, class Submatch, class Flag > - token_range( R& r, const Regex& re, const Submatch& sub, Flag f ) - : base( regex_iter( boost::begin(r), boost::end(r), - regex_type(re), sub, f ), - regex_iter() ) - { } - }; + public: + template< class Regex, class Submatch, class Flag > + token_range( R& r, const Regex& re, const Submatch& sub, Flag f ) + : base( regex_iter( boost::begin(r), boost::end(r), + regex_type(re), sub, f ), + regex_iter() ) + { } + }; - template< class T, class U, class V > - struct regex_holder - { - const T& re; - const U& sub; - V f; + template< class T, class U, class V > + struct regex_holder + { + const T& re; + const U& sub; + V f; - regex_holder( const T& rex, const U& subm, V flag ) : - re(rex), sub(subm), f(flag) - { } - private: - // Not assignable - void operator=(const regex_holder&); - }; + regex_holder( const T& rex, const U& subm, V flag ) : + re(rex), sub(subm), f(flag) + { } + private: + // Not assignable + void operator=(const regex_holder&); + }; - struct regex_forwarder - { - template< class Regex > - regex_holder - operator()( const Regex& re, - int submatch = 0, - regex_constants::match_flag_type f = - regex_constants::match_default ) const - { - return regex_holder( re, submatch, f ); - } - - template< class Regex, class Submatch > - regex_holder - operator()( const Regex& re, - const Submatch& sub, - regex_constants::match_flag_type f = - regex_constants::match_default ) const - { - return regex_holder( re, sub, f ); - } - }; - - template< class BidirectionalRng, class R, class S, class F > - inline token_range - operator|( BidirectionalRng& r, - const regex_holder& f ) - { - return token_range( r, f.re, f.sub, f.f ); - } + struct regex_forwarder + { + template< class Regex > + regex_holder + operator()( const Regex& re, + int submatch = 0, + regex_constants::match_flag_type f = + regex_constants::match_default ) const + { + return regex_holder( re, submatch, f ); + } + + template< class Regex, class Submatch > + regex_holder + operator()( const Regex& re, + const Submatch& sub, + regex_constants::match_flag_type f = + regex_constants::match_default ) const + { + return regex_holder( re, sub, f ); + } + }; + + template< class BidirectionalRng, class R, class S, class F > + inline token_range + operator|( BidirectionalRng& r, + const regex_holder& f ) + { + return token_range( r, f.re, f.sub, f.f ); + } - template< class BidirectionalRng, class R, class S, class F > - inline token_range - operator|( const BidirectionalRng& r, - const regex_holder& f ) - { - return token_range( r, f.re, f.sub, f.f ); - } - - } // 'range_detail' + template< class BidirectionalRng, class R, class S, class F > + inline token_range + operator|( const BidirectionalRng& r, + const regex_holder& f ) + { + return token_range( r, f.re, f.sub, f.f ); + } + + } // 'range_detail' using range_detail::token_range; - namespace adaptors - { - namespace - { - const range_detail::regex_forwarder tokenized = - range_detail::regex_forwarder(); - } - - template - inline token_range - tokenize(BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f) - { - return token_range(rng, reg, sub, f); - } - - template - inline token_range - tokenize(const BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f) - { - return token_range(rng, reg, sub, f); - } - } // 'adaptors' - + namespace adaptors + { + namespace + { + const range_detail::regex_forwarder tokenized = + range_detail::regex_forwarder(); + } + + template + inline token_range + tokenize(BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f) + { + return token_range(rng, reg, sub, f); + } + + template + inline token_range + tokenize(const BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f) + { + return token_range(rng, reg, sub, f); + } + } // 'adaptors' + } #endif diff --git a/include/boost/range/adaptor/transformed.hpp b/include/boost/range/adaptor/transformed.hpp index 0eeaee7..00297ca 100755 --- a/include/boost/range/adaptor/transformed.hpp +++ b/include/boost/range/adaptor/transformed.hpp @@ -17,87 +17,87 @@ namespace boost { - namespace range_detail - { + namespace range_detail + { - template< class F, class R > - struct transform_range : - public boost::iterator_range< - boost::transform_iterator< F, - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - { - private: - typedef boost::iterator_range< - boost::transform_iterator< F, - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - base; + template< class F, class R > + struct transform_range : + public boost::iterator_range< + boost::transform_iterator< F, + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + { + private: + typedef boost::iterator_range< + boost::transform_iterator< F, + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + base; - public: - typedef F transform_fn_type; - typedef R source_range_type; - - transform_range( F f, R& r ) - : base( make_transform_iterator( boost::begin(r), f ), - make_transform_iterator( boost::end(r), f ) ) - - { } - }; + public: + typedef F transform_fn_type; + typedef R source_range_type; + + transform_range( F f, R& r ) + : base( make_transform_iterator( boost::begin(r), f ), + make_transform_iterator( boost::end(r), f ) ) + + { } + }; - template< class T > - struct transform_holder : holder - { - transform_holder( T r ) : holder(r) - { } - }; - - template< class InputRng, class UnaryFunction > - inline transform_range - operator|( InputRng& r, - const transform_holder& f ) - { - return transform_range( f.val, r ); - } - - template< class InputRng, class UnaryFunction > - inline transform_range - operator|( const InputRng& r, - const transform_holder& f ) - { - return transform_range( f.val, r ); - } - - } // 'range_detail' + template< class T > + struct transform_holder : holder + { + transform_holder( T r ) : holder(r) + { } + }; + + template< class InputRng, class UnaryFunction > + inline transform_range + operator|( InputRng& r, + const transform_holder& f ) + { + return transform_range( f.val, r ); + } + + template< class InputRng, class UnaryFunction > + inline transform_range + operator|( const InputRng& r, + const transform_holder& f ) + { + return transform_range( f.val, r ); + } + + } // 'range_detail' - using range_detail::transform_range; - - namespace adaptors - { - namespace - { - const range_detail::forwarder - transformed = + using range_detail::transform_range; + + namespace adaptors + { + namespace + { + const range_detail::forwarder + transformed = range_detail::forwarder(); - } - - template - inline transform_range - transform(InputRange& rng, UnaryFunction fn) - { - return transform_range(fn, rng); - } - - template - inline transform_range - transform(const InputRange& rng, UnaryFunction fn) - { - return transform_range(fn, rng); - } - } // 'adaptors' - + } + + template + inline transform_range + transform(InputRange& rng, UnaryFunction fn) + { + return transform_range(fn, rng); + } + + template + inline transform_range + transform(const InputRange& rng, UnaryFunction fn) + { + return transform_range(fn, rng); + } + } // 'adaptors' + } #endif diff --git a/include/boost/range/adaptor/uniqued.hpp b/include/boost/range/adaptor/uniqued.hpp index ddaf3fe..ad6f7f4 100755 --- a/include/boost/range/adaptor/uniqued.hpp +++ b/include/boost/range/adaptor/uniqued.hpp @@ -16,74 +16,74 @@ namespace boost { - namespace range_detail - { - struct unique_forwarder { }; + namespace range_detail + { + struct unique_forwarder { }; - struct unique_not_equal_to - { - typedef bool result_type; + struct unique_not_equal_to + { + typedef bool result_type; - template< class T > - bool operator()( const T& l, const T& r ) const - { - return !(l == r); - } - }; + template< class T > + bool operator()( const T& l, const T& r ) const + { + return !(l == r); + } + }; - template - class unique_range : public adjacent_filter_range - { - typedef adjacent_filter_range base; - public: - explicit unique_range(ForwardRng& rng) - : base(unique_not_equal_to(), rng) - { - } - }; + template + class unique_range : public adjacent_filter_range + { + typedef adjacent_filter_range base; + public: + explicit unique_range(ForwardRng& rng) + : base(unique_not_equal_to(), rng) + { + } + }; - template< class ForwardRng > - inline unique_range - operator|( ForwardRng& r, - unique_forwarder ) - { - return unique_range(r); - } - - template< class ForwardRng > - inline unique_range - operator|( const ForwardRng& r, - unique_forwarder ) - { - return unique_range(r); - } - - } // 'range_detail' - - using range_detail::unique_range; - - namespace adaptors - { - namespace - { - const range_detail::unique_forwarder uniqued = - range_detail::unique_forwarder(); - } - - template - inline unique_range - unique(ForwardRange& rng) - { - return unique_range(rng); - } - - template - inline unique_range - unique(const ForwardRange& rng) - { - return unique_range(rng); + template< class ForwardRng > + inline unique_range + operator|( ForwardRng& r, + unique_forwarder ) + { + return unique_range(r); } - } // 'adaptors' + + template< class ForwardRng > + inline unique_range + operator|( const ForwardRng& r, + unique_forwarder ) + { + return unique_range(r); + } + + } // 'range_detail' + + using range_detail::unique_range; + + namespace adaptors + { + namespace + { + const range_detail::unique_forwarder uniqued = + range_detail::unique_forwarder(); + } + + template + inline unique_range + unique(ForwardRange& rng) + { + return unique_range(rng); + } + + template + inline unique_range + unique(const ForwardRange& rng) + { + return unique_range(rng); + } + } // 'adaptors' } diff --git a/include/boost/range/adaptors.hpp b/include/boost/range/adaptors.hpp index a1fad4f..92062a9 100755 --- a/include/boost/range/adaptors.hpp +++ b/include/boost/range/adaptors.hpp @@ -22,8 +22,9 @@ #include #include #include +#include #include #include #include -#endif +#endif diff --git a/include/boost/range/algorithm/equal.hpp b/include/boost/range/algorithm/equal.hpp index e210ef5..7226440 100755 --- a/include/boost/range/algorithm/equal.hpp +++ b/include/boost/range/algorithm/equal.hpp @@ -20,7 +20,7 @@ namespace boost { // An implementation of equality comparison that is optimized for iterator // traversal categories less than RandomAccessTraversal. - template< class SinglePassTraversalReadableIterator1, + template< class SinglePassTraversalReadableIterator1, class SinglePassTraversalReadableIterator2, class IteratorCategoryTag1, class IteratorCategoryTag2 > diff --git a/include/boost/range/algorithm/generate.hpp b/include/boost/range/algorithm/generate.hpp index 97a0d9d..bd63a48 100755 --- a/include/boost/range/algorithm/generate.hpp +++ b/include/boost/range/algorithm/generate.hpp @@ -33,15 +33,6 @@ inline ForwardRange& generate( ForwardRange& rng, Generator gen ) return rng; } -/// \overload -template< class ForwardRange, class Generator > -inline const ForwardRange& generate(const ForwardRange& rng, Generator gen) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - std::generate(boost::begin(rng), boost::end(rng), gen); - return rng; -} - } // namespace range using range::generate; } // namespace boost diff --git a/include/boost/range/algorithm/heap_algorithm.hpp b/include/boost/range/algorithm/heap_algorithm.hpp index 857a30f..64df3e9 100755 --- a/include/boost/range/algorithm/heap_algorithm.hpp +++ b/include/boost/range/algorithm/heap_algorithm.hpp @@ -27,34 +27,20 @@ namespace boost /// \pre RandomAccessRange is a model of the RandomAccessRangeConcept /// \pre Compare is a model of the BinaryPredicateConcept template -inline void push_heap(RandomAccessRange& rng) +inline RandomAccessRange& push_heap(RandomAccessRange& rng) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::push_heap(boost::begin(rng), boost::end(rng)); -} - -/// \overload -template -inline void push_heap(const RandomAccessRange& rng) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::push_heap(boost::begin(rng), boost::end(rng)); + return rng; } /// \overload template -inline void push_heap(RandomAccessRange& rng, Compare comp_pred) +inline RandomAccessRange& push_heap(RandomAccessRange& rng, Compare comp_pred) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::push_heap(boost::begin(rng), boost::end(rng), comp_pred); -} - -/// \overload -template -inline void push_heap(const RandomAccessRange& rng, Compare comp_pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::push_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; } /// \brief template function pop_heap @@ -64,34 +50,20 @@ inline void push_heap(const RandomAccessRange& rng, Compare comp_pred) /// \pre RandomAccessRange is a model of the RandomAccessRangeConcept /// \pre Compare is a model of the BinaryPredicateConcept template -inline void pop_heap(RandomAccessRange& rng) +inline RandomAccessRange& pop_heap(RandomAccessRange& rng) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::pop_heap(boost::begin(rng), boost::end(rng)); -} - -/// \overload -template -inline void pop_heap(const RandomAccessRange& rng) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::pop_heap(boost::begin(rng),boost::end(rng)); + return rng; } /// \overload template -inline void pop_heap(RandomAccessRange& rng, Compare comp_pred) +inline RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare comp_pred) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::pop_heap(boost::begin(rng), boost::end(rng), comp_pred); -} - -/// \overload -template -inline void pop_heap(const RandomAccessRange& rng, Compare comp_pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::pop_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; } /// \brief template function make_heap @@ -101,34 +73,20 @@ inline void pop_heap(const RandomAccessRange& rng, Compare comp_pred) /// \pre RandomAccessRange is a model of the RandomAccessRangeConcept /// \pre Compare is a model of the BinaryPredicateConcept template -inline void make_heap(RandomAccessRange& rng) +inline RandomAccessRange& make_heap(RandomAccessRange& rng) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::make_heap(boost::begin(rng), boost::end(rng)); -} - -/// \overload -template -inline void make_heap(const RandomAccessRange& rng) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::make_heap(boost::begin(rng),boost::end(rng)); + return rng; } /// \overload template -inline void make_heap(RandomAccessRange& rng, Compare comp_pred) +inline RandomAccessRange& make_heap(RandomAccessRange& rng, Compare comp_pred) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::make_heap(boost::begin(rng), boost::end(rng), comp_pred); -} - -/// \overload -template -inline void make_heap(const RandomAccessRange& rng, Compare comp_pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::make_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; } /// \brief template function sort_heap @@ -138,34 +96,20 @@ inline void make_heap(const RandomAccessRange& rng, Compare comp_pred) /// \pre RandomAccessRange is a model of the RandomAccessRangeConcept /// \pre Compare is a model of the BinaryPredicateConcept template -inline void sort_heap(RandomAccessRange& rng) +inline RandomAccessRange& sort_heap(RandomAccessRange& rng) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::sort_heap(boost::begin(rng), boost::end(rng)); -} - -/// \overload -template -inline void sort_heap(const RandomAccessRange& rng) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::sort_heap(boost::begin(rng), boost::end(rng)); + return rng; } /// \overload template -inline void sort_heap(RandomAccessRange& rng, Compare comp_pred) +inline RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare comp_pred) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::sort_heap(boost::begin(rng), boost::end(rng), comp_pred); -} - -/// \overload -template -inline void sort_heap(const RandomAccessRange& rng, Compare comp_pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::sort_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; } } // namespace range diff --git a/include/boost/range/algorithm/nth_element.hpp b/include/boost/range/algorithm/nth_element.hpp index 3e06baf..a605595 100755 --- a/include/boost/range/algorithm/nth_element.hpp +++ b/include/boost/range/algorithm/nth_element.hpp @@ -27,40 +27,44 @@ namespace boost /// \pre RandomAccessRange is a model of the RandomAccessRangeConcept /// \pre BinaryPredicate is a model of the BinaryPredicateConcept template -inline void nth_element(RandomAccessRange& rng, +inline RandomAccessRange& nth_element(RandomAccessRange& rng, BOOST_DEDUCED_TYPENAME range_iterator::type nth) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::nth_element(boost::begin(rng), nth, boost::end(rng)); + return rng; } /// \overload template -inline void nth_element(const RandomAccessRange& rng, +inline const RandomAccessRange& nth_element(const RandomAccessRange& rng, BOOST_DEDUCED_TYPENAME range_iterator::type nth) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::nth_element(boost::begin(rng),nth,boost::end(rng)); + std::nth_element(boost::begin(rng), nth, boost::end(rng)); + return rng; } /// \overload template -inline void nth_element(RandomAccessRange& rng, +inline RandomAccessRange& nth_element(RandomAccessRange& rng, BOOST_DEDUCED_TYPENAME range_iterator::type nth, BinaryPredicate sort_pred) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::nth_element(boost::begin(rng), nth, boost::end(rng), sort_pred); + return rng; } /// \overload template -inline void nth_element(const RandomAccessRange& rng, +inline const RandomAccessRange& nth_element(const RandomAccessRange& rng, BOOST_DEDUCED_TYPENAME range_iterator::type nth, BinaryPredicate sort_pred) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::nth_element(boost::begin(rng),nth,boost::end(rng), sort_pred); + std::nth_element(boost::begin(rng), nth, boost::end(rng), sort_pred); + return rng; } } // namespace range diff --git a/include/boost/range/algorithm/partial_sort.hpp b/include/boost/range/algorithm/partial_sort.hpp index e38c4be..1797c55 100755 --- a/include/boost/range/algorithm/partial_sort.hpp +++ b/include/boost/range/algorithm/partial_sort.hpp @@ -27,41 +27,24 @@ namespace boost /// \pre RandomAccessRange is a model of the RandomAccessRangeConcept /// \pre BinaryPredicate is a model of the BinaryPredicateConcept template -inline void partial_sort(RandomAccessRange& rng, +inline RandomAccessRange& partial_sort(RandomAccessRange& rng, BOOST_DEDUCED_TYPENAME range_iterator::type middle) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::partial_sort(boost::begin(rng), middle, boost::end(rng)); -} - -/// \overload -template -inline void partial_sort(const RandomAccessRange& rng, - BOOST_DEDUCED_TYPENAME range_iterator::type middle) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::partial_sort(boost::begin(rng), middle, boost::end(rng)); + return rng; } /// \overload template -inline void partial_sort(RandomAccessRange& rng, +inline RandomAccessRange& partial_sort(RandomAccessRange& rng, BOOST_DEDUCED_TYPENAME range_iterator::type middle, BinaryPredicate sort_pred) { BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); std::partial_sort(boost::begin(rng), middle, boost::end(rng), sort_pred); -} - -/// \overload -template -inline void partial_sort(const RandomAccessRange& rng, - BOOST_DEDUCED_TYPENAME range_iterator::type middle, - BinaryPredicate sort_pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::partial_sort(boost::begin(rng), middle, boost::end(rng), sort_pred); + return rng; } } // namespace range diff --git a/include/boost/range/algorithm/partial_sort_copy.hpp b/include/boost/range/algorithm/partial_sort_copy.hpp index 8cf3510..a2fe761 100755 --- a/include/boost/range/algorithm/partial_sort_copy.hpp +++ b/include/boost/range/algorithm/partial_sort_copy.hpp @@ -28,30 +28,24 @@ namespace boost /// \pre SinglePassRange is a model of the SinglePassRangeConcept /// \pre RandomAccessRange is a model of the Mutable_RandomAccessRangeConcept /// \pre BinaryPredicate is a model of the BinaryPredicateConcept -template -inline typename range_iterator::type +template +inline BOOST_DEDUCED_TYPENAME range_iterator::type partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2) { BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); - BOOST_RANGE_CONCEPT_ASSERT((WriteableRandomAccessRangeConcept)); - BOOST_RANGE_CONCEPT_ASSERT((range_detail::SameTypeConcept::type, typename range_value::type>)); - BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept::type>)); return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), boost::begin(rng2), boost::end(rng2)); } /// \overload -template -inline typename range_iterator::type +template +inline BOOST_DEDUCED_TYPENAME range_iterator::type partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); - BOOST_RANGE_CONCEPT_ASSERT((WriteableRandomAccessRangeConcept)); - BOOST_RANGE_CONCEPT_ASSERT((range_detail::SameTypeConcept::type, typename range_value::type>)); - BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, typename range_value::type>)); return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), boost::begin(rng2), boost::end(rng2), pred); diff --git a/include/boost/range/algorithm/partition.hpp b/include/boost/range/algorithm/partition.hpp index 05f41da..6404918 100755 --- a/include/boost/range/algorithm/partition.hpp +++ b/include/boost/range/algorithm/partition.hpp @@ -34,15 +34,6 @@ partition(ForwardRange& rng, UnaryPredicate pred) return std::partition(boost::begin(rng),boost::end(rng),pred); } -/// \overload -template -inline BOOST_DEDUCED_TYPENAME range_iterator::type -partition(const ForwardRange& rng, UnaryPredicate pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - return std::partition(boost::begin(rng),boost::end(rng),pred); -} - // range_return overloads /// \overload @@ -56,17 +47,6 @@ partition(ForwardRange& rng, UnaryPredicate pred) pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng); } -/// \overload -template< range_return_value re, class ForwardRange, - class UnaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type -partition(const ForwardRange& rng, UnaryPredicate pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - return boost::range_return:: - pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng); -} - } // namespace range using range::partition; } // namespace boost diff --git a/include/boost/range/algorithm/random_shuffle.hpp b/include/boost/range/algorithm/random_shuffle.hpp index eeae3d7..0b17333 100755 --- a/include/boost/range/algorithm/random_shuffle.hpp +++ b/include/boost/range/algorithm/random_shuffle.hpp @@ -34,15 +34,6 @@ inline RandomAccessRange& random_shuffle(RandomAccessRange& rng) return rng; } -/// \overload -template -inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::random_shuffle(boost::begin(rng),boost::end(rng)); - return rng; -} - /// \overload template inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen) @@ -52,15 +43,6 @@ inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen) return rng; } -/// \overload -template -inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng, Generator& gen) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::random_shuffle(boost::begin(rng), boost::end(rng), gen); - return rng; -} - } // namespace range using range::random_shuffle; } // namespace boost diff --git a/include/boost/range/algorithm/remove.hpp b/include/boost/range/algorithm/remove.hpp index 699a7cd..638dff2 100755 --- a/include/boost/range/algorithm/remove.hpp +++ b/include/boost/range/algorithm/remove.hpp @@ -34,15 +34,6 @@ remove(ForwardRange& rng, const Value& val) return std::remove(boost::begin(rng),boost::end(rng),val); } -/// \overload -template< class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_iterator::type -remove(const ForwardRange& rng, const Value& val) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - return std::remove(boost::begin(rng),boost::end(rng),val); -} - // range_return overloads /// \overload @@ -56,17 +47,6 @@ remove(ForwardRange& rng, const Value& val) rng); } -/// \overload -template< range_return_value re, class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_return::type -remove(const ForwardRange& rng, const Value& val) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - return range_return::pack( - std::remove(boost::begin(rng), boost::end(rng), val), - rng); -} - } // namespace range using range::remove; } // namespace boost diff --git a/include/boost/range/algorithm/remove_copy_if.hpp b/include/boost/range/algorithm/remove_copy_if.hpp index 665b359..791a38f 100755 --- a/include/boost/range/algorithm/remove_copy_if.hpp +++ b/include/boost/range/algorithm/remove_copy_if.hpp @@ -31,7 +31,7 @@ namespace boost remove_copy_if(SinglePassRange& rng, OutputIterator out_it, Predicate pred) { boost::function_requires< SinglePassRangeConcept >(); - return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred); + return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred); } } diff --git a/include/boost/range/algorithm/remove_if.hpp b/include/boost/range/algorithm/remove_if.hpp index babcddc..349e7a4 100755 --- a/include/boost/range/algorithm/remove_if.hpp +++ b/include/boost/range/algorithm/remove_if.hpp @@ -35,15 +35,6 @@ remove_if(ForwardRange& rng, UnaryPredicate pred) return std::remove_if(boost::begin(rng), boost::end(rng), pred); } -/// \overload -template< class ForwardRange, class UnaryPredicate > -inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type -remove_if(const ForwardRange& rng, UnaryPredicate pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - return std::remove_if(boost::begin(rng),boost::end(rng),pred); -} - // range_return overloads /// \overload @@ -57,17 +48,6 @@ remove_if(ForwardRange& rng, UnaryPredicate pred) rng); } -/// \overload -template< range_return_value re, class ForwardRange, class UnaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type -remove_if(const ForwardRange& rng, UnaryPredicate pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - return range_return::pack( - std::remove_if(boost::begin(rng), boost::end(rng), pred), - rng); -} - } // namespace range using range::remove_if; } // namespace boost diff --git a/include/boost/range/algorithm/replace.hpp b/include/boost/range/algorithm/replace.hpp index 44d3e4c..3f2d72c 100755 --- a/include/boost/range/algorithm/replace.hpp +++ b/include/boost/range/algorithm/replace.hpp @@ -35,17 +35,6 @@ replace(ForwardRange& rng, const Value& what, return rng; } -/// \overload -template< class ForwardRange, class Value > -inline const ForwardRange& -replace(const ForwardRange& rng, const Value& what, - const Value& with_what) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - std::replace(boost::begin(rng), boost::end(rng), what, with_what); - return rng; -} - } // namespace range using range::replace; } // namespace boost; diff --git a/include/boost/range/algorithm/replace_if.hpp b/include/boost/range/algorithm/replace_if.hpp index 93d5a1f..393a4ca 100755 --- a/include/boost/range/algorithm/replace_if.hpp +++ b/include/boost/range/algorithm/replace_if.hpp @@ -36,17 +36,6 @@ inline ForwardRange& return rng; } -/// \overload -template< class ForwardRange, class UnaryPredicate, class Value > -inline const ForwardRange& - replace_if(const ForwardRange& rng, UnaryPredicate pred, - const Value& val) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - std::replace_if(boost::begin(rng), boost::end(rng), pred, val); - return rng; -} - } // namespace range using range::replace_if; } // namespace boost diff --git a/include/boost/range/algorithm/reverse.hpp b/include/boost/range/algorithm/reverse.hpp index 20a7eb1..8741d66 100755 --- a/include/boost/range/algorithm/reverse.hpp +++ b/include/boost/range/algorithm/reverse.hpp @@ -34,15 +34,6 @@ inline BidirectionalRange& reverse(BidirectionalRange& rng) return rng; } -/// \overload -template -inline const BidirectionalRange& reverse(const BidirectionalRange& rng) -{ - BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); - std::reverse(boost::begin(rng), boost::end(rng)); - return rng; -} - } // namespace range using range::reverse; } // namespace boost diff --git a/include/boost/range/algorithm/reverse_copy.hpp b/include/boost/range/algorithm/reverse_copy.hpp index 381f157..d86145d 100755 --- a/include/boost/range/algorithm/reverse_copy.hpp +++ b/include/boost/range/algorithm/reverse_copy.hpp @@ -26,15 +26,7 @@ namespace boost /// range-based version of the reverse_copy std algorithm /// /// \pre BidirectionalRange is a model of the BidirectionalRangeConcept -template -inline OutputIterator reverse_copy(BidirectionalRange& rng, OutputIterator out) -{ - BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); - return std::reverse_copy(boost::begin(rng), boost::end(rng), out); -} - -/// \overload -template +template inline OutputIterator reverse_copy(const BidirectionalRange& rng, OutputIterator out) { BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); diff --git a/include/boost/range/algorithm/rotate.hpp b/include/boost/range/algorithm/rotate.hpp index 2372a00..aef6062 100755 --- a/include/boost/range/algorithm/rotate.hpp +++ b/include/boost/range/algorithm/rotate.hpp @@ -25,26 +25,15 @@ namespace boost /// range-based version of the rotate std algorithm /// /// \pre Rng meets the requirements for a Forward range -template +template inline ForwardRange& rotate(ForwardRange& rng, - typename range_iterator::type middle) + BOOST_DEDUCED_TYPENAME range_iterator::type middle) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); std::rotate(boost::begin(rng), middle, boost::end(rng)); return rng; } -/// \overload -template -inline const ForwardRange& - rotate(const ForwardRange& rng, - typename range_iterator::type middle) -{ - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - std::rotate(boost::begin(rng), middle, boost::end(rng)); - return rng; -} - } // namespace range using range::rotate; } // namespace boost diff --git a/include/boost/range/algorithm/rotate_copy.hpp b/include/boost/range/algorithm/rotate_copy.hpp index 9030f73..0409ac5 100755 --- a/include/boost/range/algorithm/rotate_copy.hpp +++ b/include/boost/range/algorithm/rotate_copy.hpp @@ -28,9 +28,9 @@ namespace boost /// \pre Rng meets the requirements for a Forward range template inline OutputIterator rotate_copy( - const ForwardRange& rng, - typename range_iterator::type middle, - OutputIterator target + const ForwardRange& rng, + BOOST_DEDUCED_TYPENAME range_iterator::type middle, + OutputIterator target ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); diff --git a/include/boost/range/algorithm/search.hpp b/include/boost/range/algorithm/search.hpp index 45d7ade..28cc6e6 100755 --- a/include/boost/range/algorithm/search.hpp +++ b/include/boost/range/algorithm/search.hpp @@ -45,8 +45,8 @@ search(const ForwardRange1& rng1, const ForwardRange2& rng2) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - return std::search(boost::begin(rng1),boost::end(rng1), - boost::begin(rng2),boost::end(rng2)); + return std::search(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2)); } /// \overload @@ -63,13 +63,12 @@ search(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) /// \overload template< class ForwardRange1, class ForwardRange2, class BinaryPredicate > inline BOOST_DEDUCED_TYPENAME range_iterator::type -search(const ForwardRange1& rng1, const ForwardRange2& rng2, - BinaryPredicate pred) +search(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); - return std::search(boost::begin(rng1),boost::end(rng1), - boost::begin(rng2),boost::end(rng2),pred); + return std::search(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2), pred); } // range_return overloads @@ -118,8 +117,7 @@ search(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) template< range_return_value re, class ForwardRange1, class ForwardRange2, class BinaryPredicate > inline BOOST_DEDUCED_TYPENAME range_return::type -search(const ForwardRange1& rng1, const ForwardRange2& rng2, - BinaryPredicate pred) +search(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); diff --git a/include/boost/range/algorithm/search_n.hpp b/include/boost/range/algorithm/search_n.hpp index cd0340b..2ced140 100755 --- a/include/boost/range/algorithm/search_n.hpp +++ b/include/boost/range/algorithm/search_n.hpp @@ -31,8 +31,8 @@ namespace boost /// \pre Value is a model of the EqualityComparableConcept /// \pre ForwardRange's value type is a model of the EqualityComparableConcept /// \pre Object's of ForwardRange's value type can be compared for equality with Objects of type Value -template< typename ForwardRange, typename Integer, typename Value > -inline typename range_iterator::type +template< class ForwardRange, class Integer, class Value > +inline BOOST_DEDUCED_TYPENAME range_iterator::type search_n(ForwardRange& rng, Integer count, const Value& value) { BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); @@ -40,8 +40,8 @@ search_n(ForwardRange& rng, Integer count, const Value& value) } /// \overload -template< typename ForwardRange, typename Integer, typename Value > -inline typename range_iterator::type +template< class ForwardRange, class Integer, class Value > +inline BOOST_DEDUCED_TYPENAME range_iterator::type search_n(const ForwardRange& rng, Integer count, const Value& value) { BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); @@ -49,29 +49,29 @@ search_n(const ForwardRange& rng, Integer count, const Value& value) } /// \overload -template< typename ForwardRange, typename Integer, class Value, - typename BinaryPredicate > -inline typename range_iterator::type +template< class ForwardRange, class Integer, class Value, + class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type search_n(ForwardRange& rng, Integer count, const Value& value, BinaryPredicate binary_pred) { BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, const Value&>)); + BOOST_DEDUCED_TYPENAME range_value::type, const Value&>)); return std::search_n(boost::begin(rng), boost::end(rng), count, value, binary_pred); } /// \overload -template< typename ForwardRange, typename Integer, typename Value, - typename BinaryPredicate > -inline typename range_iterator::type +template< class ForwardRange, class Integer, class Value, + class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type search_n(const ForwardRange& rng, Integer count, const Value& value, BinaryPredicate binary_pred) { BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, const Value&>)); + BOOST_DEDUCED_TYPENAME range_value::type, const Value&>)); return std::search_n(boost::begin(rng), boost::end(rng), count, value, binary_pred); } @@ -79,9 +79,9 @@ search_n(const ForwardRange& rng, Integer count, const Value& value, // range_return overloads /// \overload -template< range_return_value re, typename ForwardRange, typename Integer, - typename Value > -inline typename range_return::type +template< range_return_value re, class ForwardRange, class Integer, + class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type search_n(ForwardRange& rng, Integer count, const Value& value) { BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); @@ -92,9 +92,9 @@ search_n(ForwardRange& rng, Integer count, const Value& value) } /// \overload -template< range_return_value re, typename ForwardRange, typename Integer, +template< range_return_value re, class ForwardRange, class Integer, class Value > -inline typename range_return::type +inline BOOST_DEDUCED_TYPENAME range_return::type search_n(const ForwardRange& rng, Integer count, const Value& value) { BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); @@ -105,15 +105,15 @@ search_n(const ForwardRange& rng, Integer count, const Value& value) } /// \overload -template< range_return_value re, typename ForwardRange, typename Integer, - typename Value, typename BinaryPredicate > -inline typename range_return::type +template< range_return_value re, class ForwardRange, class Integer, + class Value, class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type search_n(ForwardRange& rng, Integer count, const Value& value, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, + BOOST_DEDUCED_TYPENAME range_value::type, const Value&>)); return range_return:: pack(std::search_n(boost::begin(rng), boost::end(rng), @@ -122,15 +122,15 @@ search_n(ForwardRange& rng, Integer count, const Value& value, } /// \overload -template< range_return_value re, typename ForwardRange, typename Integer, - typename Value, typename BinaryPredicate > -inline typename range_return::type +template< range_return_value re, class ForwardRange, class Integer, + class Value, class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type search_n(const ForwardRange& rng, Integer count, const Value& value, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, + BOOST_DEDUCED_TYPENAME range_value::type, const Value&>)); return range_return:: pack(std::search_n(boost::begin(rng), boost::end(rng), diff --git a/include/boost/range/algorithm/sort.hpp b/include/boost/range/algorithm/sort.hpp index a160907..0c6e3b2 100755 --- a/include/boost/range/algorithm/sort.hpp +++ b/include/boost/range/algorithm/sort.hpp @@ -34,15 +34,6 @@ inline RandomAccessRange& sort(RandomAccessRange& rng) return rng; } -/// \overload -template -inline const RandomAccessRange& sort(const RandomAccessRange& rng) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::sort(boost::begin(rng),boost::end(rng)); - return rng; -} - /// \overload template inline RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred) @@ -52,15 +43,6 @@ inline RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred) return rng; } -/// \overload -template -inline const RandomAccessRange& sort(const RandomAccessRange& rng, BinaryPredicate pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::sort(boost::begin(rng), boost::end(rng), pred); - return rng; -} - } // namespace range using range::sort; } // namespace boost diff --git a/include/boost/range/algorithm/stable_sort.hpp b/include/boost/range/algorithm/stable_sort.hpp index d18da4d..6a27aa4 100755 --- a/include/boost/range/algorithm/stable_sort.hpp +++ b/include/boost/range/algorithm/stable_sort.hpp @@ -34,15 +34,6 @@ inline RandomAccessRange& stable_sort(RandomAccessRange& rng) return rng; } -/// \overload -template -inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::stable_sort(boost::begin(rng), boost::end(rng)); - return rng; -} - /// \overload template inline RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate sort_pred) @@ -52,15 +43,6 @@ inline RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate so return rng; } -/// \overload -template -inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng, BinaryPredicate sort_pred) -{ - BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); - std::stable_sort(boost::begin(rng), boost::end(rng), sort_pred); - return rng; -} - } // namespace range using range::stable_sort; } // namespace boost diff --git a/include/boost/range/algorithm/swap_ranges.hpp b/include/boost/range/algorithm/swap_ranges.hpp index 1acee0d..5b8967a 100755 --- a/include/boost/range/algorithm/swap_ranges.hpp +++ b/include/boost/range/algorithm/swap_ranges.hpp @@ -22,7 +22,7 @@ namespace boost { namespace range_detail { - template + template void swap_ranges_impl(Iterator1 it1, Iterator1 last1, Iterator2 it2, Iterator2 last2, single_pass_traversal_tag, @@ -36,7 +36,7 @@ namespace boost } } - template + template void swap_ranges_impl(Iterator1 it1, Iterator1 last1, Iterator2 it2, Iterator2 last2, random_access_traversal_tag, @@ -47,13 +47,13 @@ namespace boost std::swap_ranges(it1, last1, it2); } - template + template void swap_ranges_impl(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) { swap_ranges_impl(first1, last1, first2, last2, - typename iterator_traversal::type(), - typename iterator_traversal::type()); + BOOST_DEDUCED_TYPENAME iterator_traversal::type(), + BOOST_DEDUCED_TYPENAME iterator_traversal::type()); } } // namespace range_detail @@ -66,7 +66,7 @@ namespace boost /// /// \pre SinglePassRange1 is a model of the SinglePassRangeConcept /// \pre SinglePassRange2 is a model of the SinglePassRangeConcept -template< typename SinglePassRange1, typename SinglePassRange2 > +template< class SinglePassRange1, class SinglePassRange2 > inline SinglePassRange2& swap_ranges(SinglePassRange1& range1, SinglePassRange2& range2) { diff --git a/include/boost/range/algorithm_ext/for_each.hpp b/include/boost/range/algorithm_ext/for_each.hpp index 6a3b35c..a470e2b 100755 --- a/include/boost/range/algorithm_ext/for_each.hpp +++ b/include/boost/range/algorithm_ext/for_each.hpp @@ -19,55 +19,55 @@ namespace boost { - namespace range_detail - { - template - inline Fn2 for_each_impl(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - Fn2 fn) - { - for (; first1 != last1 && first2 != last2; ++first1, ++first2) - { - fn(*first1, *first2); - } - return fn; - } - } + namespace range_detail + { + template + inline Fn2 for_each_impl(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Fn2 fn) + { + for (; first1 != last1 && first2 != last2; ++first1, ++first2) + { + fn(*first1, *first2); + } + return fn; + } + } - namespace range - { - template - inline Fn2 for_each(const SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn) - { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + namespace range + { + template + inline Fn2 for_each(const SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn) + { + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - return ::boost::range_detail::for_each_impl( + return ::boost::range_detail::for_each_impl( ::boost::begin(rng1), ::boost::end(rng1), ::boost::begin(rng2), ::boost::end(rng2), fn); - } + } - template - inline Fn2 for_each(const SinglePassRange1& rng1, SinglePassRange2& rng2, Fn2 fn) - { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + template + inline Fn2 for_each(const SinglePassRange1& rng1, SinglePassRange2& rng2, Fn2 fn) + { + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - return ::boost::range_detail::for_each_impl( + return ::boost::range_detail::for_each_impl( ::boost::begin(rng1), ::boost::end(rng1), ::boost::begin(rng2), ::boost::end(rng2), fn); - } + } - template - inline Fn2 for_each(SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn) - { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + template + inline Fn2 for_each(SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn) + { + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - return ::boost::range_detail::for_each_impl( + return ::boost::range_detail::for_each_impl( ::boost::begin(rng1), ::boost::end(rng1), ::boost::begin(rng2), ::boost::end(rng2), fn); - } + } template inline Fn2 for_each(SinglePassRange1& rng1, SinglePassRange2& rng2, Fn2 fn) @@ -79,8 +79,8 @@ namespace boost ::boost::begin(rng1), ::boost::end(rng1), ::boost::begin(rng2), ::boost::end(rng2), fn); } - } // namespace range - using range::for_each; + } // namespace range + using range::for_each; } // namespace boost #endif // include guard diff --git a/include/boost/range/counting_range.hpp b/include/boost/range/counting_range.hpp index c1ca5ec..bf22f7c 100755 --- a/include/boost/range/counting_range.hpp +++ b/include/boost/range/counting_range.hpp @@ -25,41 +25,41 @@ namespace boost { - template - inline iterator_range > - counting_range(Value first, Value last) - { - typedef counting_iterator counting_iterator_t; - typedef iterator_range result_t; - return result_t(counting_iterator_t(first), - counting_iterator_t(last)); - } + template + inline iterator_range > + counting_range(Value first, Value last) + { + typedef counting_iterator counting_iterator_t; + typedef iterator_range result_t; + return result_t(counting_iterator_t(first), + counting_iterator_t(last)); + } - template - inline iterator_range::type> > - counting_range(const Range& rng) - { - typedef counting_iterator::type> counting_iterator_t; - typedef iterator_range result_t; - return boost::empty(rng) - ? result_t() - : result_t( + template + inline iterator_range::type> > + counting_range(const Range& rng) + { + typedef counting_iterator::type> counting_iterator_t; + typedef iterator_range result_t; + return boost::empty(rng) + ? result_t() + : result_t( counting_iterator_t(*boost::begin(rng)), counting_iterator_t(*boost::prior(boost::end(rng)))); - } + } - template - inline iterator_range::type> > - counting_range(Range& rng) - { - typedef counting_iterator::type> counting_iterator_t; - typedef iterator_range result_t; - return boost::empty(rng) - ? result_t() - : result_t( + template + inline iterator_range::type> > + counting_range(Range& rng) + { + typedef counting_iterator::type> counting_iterator_t; + typedef iterator_range result_t; + return boost::empty(rng) + ? result_t() + : result_t( counting_iterator_t(*boost::begin(rng)), counting_iterator_t(*boost::prior(boost::end(rng)))); - } + } } // namespace boost #if BOOST_MSVC >= 1400 diff --git a/include/boost/range/detail/demote_iterator_traversal_tag.hpp b/include/boost/range/detail/demote_iterator_traversal_tag.hpp index 4351c85..5d77678 100755 --- a/include/boost/range/detail/demote_iterator_traversal_tag.hpp +++ b/include/boost/range/detail/demote_iterator_traversal_tag.hpp @@ -15,8 +15,8 @@ namespace boost { - namespace range_detail - { + namespace range_detail + { template struct demote_iterator_traversal_tag @@ -26,7 +26,7 @@ struct demote_iterator_traversal_tag #define BOOST_DEMOTE_TRAVERSAL_TAG( Tag1, Tag2, ResultTag ) \ template<> struct demote_iterator_traversal_tag< Tag1 , Tag2 > \ { \ - typedef ResultTag type; \ + typedef ResultTag type; \ }; BOOST_DEMOTE_TRAVERSAL_TAG( no_traversal_tag, no_traversal_tag, no_traversal_tag ) @@ -73,7 +73,7 @@ BOOST_DEMOTE_TRAVERSAL_TAG( random_access_traversal_tag, random_access_traversal #undef BOOST_DEMOTE_TRAVERSAL_TAG - } // namespace range_detail + } // namespace range_detail } // namespace boost #endif // include guard diff --git a/include/boost/range/istream_range.hpp b/include/boost/range/istream_range.hpp index fac17a4..f0e9ef4 100755 --- a/include/boost/range/istream_range.hpp +++ b/include/boost/range/istream_range.hpp @@ -16,19 +16,24 @@ */ #include +#include #include -#include +#include namespace boost { - template inline - range > - istream_range(std::basic_istream& in) - { - return range >( - std::istream_iterator(in), - std::istream_iterator()); - } + namespace range + { + template inline + iterator_range > + istream_range(std::basic_istream& in) + { + return iterator_range >( + std::istream_iterator(in), + std::istream_iterator()); + } + } // namespace range + using range::istream_range; } // namespace boost #endif // include guard diff --git a/include/boost/range/join.hpp b/include/boost/range/join.hpp index 374df86..518026c 100644 --- a/include/boost/range/join.hpp +++ b/include/boost/range/join.hpp @@ -21,46 +21,46 @@ namespace boost template iterator_range::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME add_const< - BOOST_DEDUCED_TYPENAME range_value::type>::type> + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME add_const< + BOOST_DEDUCED_TYPENAME range_value::type>::type> > join(const SinglePassRange1& r1, const SinglePassRange2& r2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - typedef range_detail::join_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME add_const< - BOOST_DEDUCED_TYPENAME range_value::type>::type> iterator_t; + typedef range_detail::join_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME add_const< + BOOST_DEDUCED_TYPENAME range_value::type>::type> iterator_t; - return iterator_range( - iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), - iterator_t(r1, r2, range_detail::join_iterator_end_tag())); + return iterator_range( + iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), + iterator_t(r1, r2, range_detail::join_iterator_end_tag())); } template iterator_range::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_value::type> + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_value::type> > join(SinglePassRange1& r1, SinglePassRange2& r2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - typedef range_detail::join_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_value::type> iterator_t; + typedef range_detail::join_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_value::type> iterator_t; - return iterator_range( - iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), - iterator_t(r1, r2, range_detail::join_iterator_end_tag())); + return iterator_range( + iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), + iterator_t(r1, r2, range_detail::join_iterator_end_tag())); } } // namespace boost diff --git a/include/boost/range/numeric.hpp b/include/boost/range/numeric.hpp index 17e2cfe..0a76151 100755 --- a/include/boost/range/numeric.hpp +++ b/include/boost/range/numeric.hpp @@ -20,7 +20,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #if defined(_MSC_VER) && _MSC_VER >= 1000 - #pragma once + #pragma once #endif #ifndef BOOST_RANGE_NUMERIC_HPP @@ -36,82 +36,82 @@ namespace boost { - template< class SinglePassRange, class Value > - inline Value accumulate( const SinglePassRange& rng, Value init ) - { + template< class SinglePassRange, class Value > + inline Value accumulate( const SinglePassRange& rng, Value init ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::accumulate( boost::begin(rng), boost::end(rng), init ); - } + return std::accumulate( boost::begin(rng), boost::end(rng), init ); + } - template< class SinglePassRange, class Value, class BinaryOperation > - inline Value accumulate( const SinglePassRange& rng, Value init, BinaryOperation op ) - { + template< class SinglePassRange, class Value, class BinaryOperation > + inline Value accumulate( const SinglePassRange& rng, Value init, BinaryOperation op ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::accumulate( boost::begin(rng), boost::end(rng), init, op ); - } + return std::accumulate( boost::begin(rng), boost::end(rng), init, op ); + } - template< class SinglePassRange1, class SinglePassRange2, class Value > - inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init ) - { + template< class SinglePassRange1, class SinglePassRange2, class Value > + inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init ) + { boost::function_requires< SinglePassRangeConcept >(); boost::function_requires< SinglePassRangeConcept >(); BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) ); - return std::inner_product( boost::begin(rng1), boost::end(rng1), + return std::inner_product( boost::begin(rng1), boost::end(rng1), boost::begin(rng2), init ); - } + } - template< class SinglePassRange1, + template< class SinglePassRange1, class SinglePassRange2, class Value, - class BinaryOperation1, class BinaryOperation2 > - inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, + class BinaryOperation1, class BinaryOperation2 > + inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init, - BinaryOperation1 op1, BinaryOperation2 op2 ) - { + BinaryOperation1 op1, BinaryOperation2 op2 ) + { boost::function_requires< SinglePassRangeConcept >(); boost::function_requires< SinglePassRangeConcept >(); BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) ); - return std::inner_product( boost::begin(rng1), boost::end(rng1), + return std::inner_product( boost::begin(rng1), boost::end(rng1), boost::begin(rng2), init, op1, op2 ); - } + } - template< class SinglePassRange, class OutputIterator > - inline OutputIterator partial_sum ( const SinglePassRange& rng, - OutputIterator result ) - { + template< class SinglePassRange, class OutputIterator > + inline OutputIterator partial_sum ( const SinglePassRange& rng, + OutputIterator result ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::partial_sum( boost::begin(rng), boost::end(rng), result ); - } + return std::partial_sum( boost::begin(rng), boost::end(rng), result ); + } - template< class SinglePassRange, class OutputIterator, class BinaryOperation > - inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result, - BinaryOperation op ) - { + template< class SinglePassRange, class OutputIterator, class BinaryOperation > + inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result, + BinaryOperation op ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::partial_sum( boost::begin(rng), boost::end(rng), result, op ); - } + return std::partial_sum( boost::begin(rng), boost::end(rng), result, op ); + } - template< class SinglePassRange, class OutputIterator > - inline OutputIterator adjacent_difference ( const SinglePassRange& rng, - OutputIterator result ) - { + template< class SinglePassRange, class OutputIterator > + inline OutputIterator adjacent_difference ( const SinglePassRange& rng, + OutputIterator result ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::adjacent_difference( boost::begin(rng), boost::end(rng), - result ); - } + return std::adjacent_difference( boost::begin(rng), boost::end(rng), + result ); + } - template< class SinglePassRange, class OutputIterator, class BinaryOperation > - inline OutputIterator adjacent_difference ( const SinglePassRange& rng, - OutputIterator result, - BinaryOperation op ) - { + template< class SinglePassRange, class OutputIterator, class BinaryOperation > + inline OutputIterator adjacent_difference ( const SinglePassRange& rng, + OutputIterator result, + BinaryOperation op ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::adjacent_difference( boost::begin(rng), boost::end(rng), - result, op ); - } - + return std::adjacent_difference( boost::begin(rng), boost::end(rng), + result, op ); + } + } #endif diff --git a/include/boost/range/size_type.hpp b/include/boost/range/size_type.hpp index 9993d55..8c184f8 100644 --- a/include/boost/range/size_type.hpp +++ b/include/boost/range/size_type.hpp @@ -68,7 +68,7 @@ namespace boost template< class T > struct range_size - : detail::range_size + : detail::range_size { }; } // namespace boost diff --git a/include/boost/range/unbounded_range.hpp b/include/boost/range/unbounded_range.hpp deleted file mode 100755 index 570a0a4..0000000 --- a/include/boost/range/unbounded_range.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef BOOST_RANGE_UNBOUNDED_RANGE_HPP -#define BOOST_RANGE_UNBOUNDED_RANGE_HPP - -#include -#include - -namespace boost -{ - template< class Iter > - struct unbounded_iterator_range : iterator_range - { - explicit unbounded_iterator_range( Iter r ) - : iterator_range( r, r ) - { - // - // Remark: by storing the same iterator - // twice, we can still allow - // comparison to execute without leading to - // operations on singular iterators - // - } - - private: - - bool empty() const - { - return false; - } - // - // Hide members that are illegal to use. - // - /* - void end() const; - void size() const; - void empty() const; - void equal() const; - operator bool() const; - bool operator==( unbounded_iterator_range ); - bool operator!=( unbounded_iterator_range ); - template< class S > - void operator[]( S s ) const; - template< class D > - void advance_end( D d ) const; - void back() const; - */ - }; - - template< class Iter > - inline unbounded_iterator_range unbounded_range( Iter r ) - { - return unbounded_iterator_range(r); - } - - namespace detail - { - char is_unbounded_range( ... ); - template< class Iter > - long is_unbounded_range( const unbounded_iterator_range* ); - } - - template< class T > - struct is_unbounded_range - { - private: - static T* ptr_; - - public: - BOOST_STATIC_CONSTANT( bool, - value = sizeof(long) == sizeof(detail::is_unbounded_range(ptr_) ) ); - }; -} - -#endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 97600d5..2b2466f 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -42,6 +42,7 @@ test-suite range : [ range-test adaptor_test/reversed ] [ range-test adaptor_test/sliced ] [ range-test adaptor_test/strided ] + [ range-test adaptor_test/strided2 ] [ range-test adaptor_test/tokenized ] [ range-test adaptor_test/transformed ] [ range-test adaptor_test/uniqued ] @@ -128,11 +129,13 @@ test-suite range : [ range-test counting_range ] [ range-test extension_mechanism ] [ range-test irange ] + [ range-test istream_range ] [ range-test iterator_pair ] [ range-test iterator_range ] # [ range-test mfc : $(VC71_ROOT)/atlmfc/include ] [ range-test join ] [ range-test partial_workaround ] + [ range-test pointer_as_iterator ] [ range-test reversible_range ] [ range-test std_container ] [ range-test string ] diff --git a/test/adaptor_test/adjacent_filtered_example.cpp b/test/adaptor_test/adjacent_filtered_example.cpp index b3538e8..ce132d6 100644 --- a/test/adaptor_test/adjacent_filtered_example.cpp +++ b/test/adaptor_test/adjacent_filtered_example.cpp @@ -55,4 +55,4 @@ init_unit_test_suite(int argc, char* argv[]) test->add( BOOST_TEST_CASE( &adjacent_filtered_example_test ) ); return test; -} \ No newline at end of file +} diff --git a/test/adaptor_test/copied_example.cpp b/test/adaptor_test/copied_example.cpp index f662a45..154a110 100644 --- a/test/adaptor_test/copied_example.cpp +++ b/test/adaptor_test/copied_example.cpp @@ -55,4 +55,4 @@ init_unit_test_suite(int argc, char* argv[]) test->add( BOOST_TEST_CASE( &copied_example_test ) ); return test; -} \ No newline at end of file +} diff --git a/test/adaptor_test/strided2.cpp b/test/adaptor_test/strided2.cpp new file mode 100644 index 0000000..4ac91f5 --- /dev/null +++ b/test/adaptor_test/strided2.cpp @@ -0,0 +1,67 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// + +// This test was added due to a report that the Range Adaptors: +// 1. Caused havoc when using namespace boost::adaptors was used +// 2. Did not work with non-member functions +// 3. The strided adaptor could not be composed with sliced +// +// None of these issues could be reproduced on GCC 4.4, but this +// work makes for useful additional test coverage since this +// uses chaining of adaptors and non-member functions whereas +// most of the tests avoid this use case. + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +namespace boost +{ + namespace + { + int times_two(int x) { return x * 2; } + + void strided_test2() + { + using namespace boost::adaptors; + using namespace boost::assign; + std::vector v; + boost::push_back(v, boost::irange(0,10)); + std::vector z; + boost::push_back(z, v | sliced(2,6) | strided(2) | transformed(×_two)); + std::vector reference; + reference += 4,8; + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + z.begin(), z.end() ); + } + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.adaptor.strided2" ); + + test->add( BOOST_TEST_CASE( &boost::strided_test2 ) ); + + return test; +} diff --git a/test/algorithm_ext_test/push_front.cpp b/test/algorithm_ext_test/push_front.cpp index ebc09a8..a5f5fb9 100644 --- a/test/algorithm_ext_test/push_front.cpp +++ b/test/algorithm_ext_test/push_front.cpp @@ -21,6 +21,15 @@ namespace { + struct DoubleValue + { + template< class Value > + Value operator()(Value x) + { + return x * 2; + } + }; + template< class Container > void test_push_front_impl(std::size_t n) { @@ -34,10 +43,14 @@ namespace BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), test.begin(), test.end() ); - // Do it again to push onto non-empty container - reference.insert(reference.begin(), reference.begin(), reference.end()); + // copy the orignal reference sequence + Container reference_copy(reference); + std::transform(reference.begin(), reference.end(), reference.begin(), DoubleValue()); - boost::push_front(test, boost::irange(0, n)); + // Do it again to push onto non-empty container + reference.insert(reference.end(), reference_copy.begin(), reference_copy.end()); + + boost::push_front(test, boost::irange(0, n * 2, 2)); BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), test.begin(), test.end() ); diff --git a/test/algorithm_test/find.cpp b/test/algorithm_test/find.cpp index 6b3d532..fd179f1 100644 --- a/test/algorithm_test/find.cpp +++ b/test/algorithm_test/find.cpp @@ -36,16 +36,16 @@ namespace boost return boost::find(cont, 3); } - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::find(cont, 3); - } - }; + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::find(cont, 3); + } + }; template BOOST_DEDUCED_TYPENAME range_iterator::type diff --git a/test/algorithm_test/find_end.cpp b/test/algorithm_test/find_end.cpp index fb44e52..a126e87 100644 --- a/test/algorithm_test/find_end.cpp +++ b/test/algorithm_test/find_end.cpp @@ -35,7 +35,7 @@ namespace boost { } - container2_t cont() { return m_cont; } + container2_t cont() { return m_cont; } template BOOST_DEDUCED_TYPENAME range_iterator::type @@ -45,14 +45,14 @@ namespace boost } template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::find_end(cont, policy.cont()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::find_end(cont, policy.cont()); + } }; template @@ -77,8 +77,8 @@ namespace boost { } - container2_t& cont() { return m_cont; } - BinaryPredicate& pred() { return m_pred; } + container2_t& cont() { return m_cont; } + BinaryPredicate& pred() { return m_pred; } template BOOST_DEDUCED_TYPENAME range_iterator::type @@ -88,14 +88,14 @@ namespace boost } template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::find_end(cont, policy.cont(), policy.pred()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::find_end(cont, policy.cont(), policy.pred()); + } }; template diff --git a/test/algorithm_test/find_first_of.cpp b/test/algorithm_test/find_first_of.cpp index b3d18e2..9ff7adb 100644 --- a/test/algorithm_test/find_first_of.cpp +++ b/test/algorithm_test/find_first_of.cpp @@ -35,7 +35,7 @@ namespace boost { } - container2_t& cont() { return m_cont; } + container2_t& cont() { return m_cont; } template BOOST_DEDUCED_TYPENAME range_iterator::type @@ -45,14 +45,14 @@ namespace boost } template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::find_first_of(cont, policy.cont()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::find_first_of(cont, policy.cont()); + } }; template @@ -77,8 +77,8 @@ namespace boost { } - container2_t& cont() { return m_cont; } - BinaryPredicate& pred() { return m_pred; } + container2_t& cont() { return m_cont; } + BinaryPredicate& pred() { return m_pred; } template BOOST_DEDUCED_TYPENAME range_iterator::type @@ -88,14 +88,14 @@ namespace boost } template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::find_first_of(cont, policy.cont(), policy.pred()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::find_first_of(cont, policy.cont(), policy.pred()); + } }; template diff --git a/test/algorithm_test/find_if.cpp b/test/algorithm_test/find_if.cpp index 4ee85a2..a5fe459 100644 --- a/test/algorithm_test/find_if.cpp +++ b/test/algorithm_test/find_if.cpp @@ -41,15 +41,15 @@ namespace boost return boost::find_if(cont, m_pred); } - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(find_if_test_policy& policy, Container& cont) - { - return boost::find_if(cont, policy.pred()); - } + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(find_if_test_policy& policy, Container& cont) + { + return boost::find_if(cont, policy.pred()); + } }; template @@ -59,7 +59,7 @@ namespace boost return std::find_if(cont.begin(), cont.end(), m_pred); } - UnaryPredicate& pred() { return m_pred; } + UnaryPredicate& pred() { return m_pred; } private: UnaryPredicate m_pred; diff --git a/test/algorithm_test/for_each.cpp b/test/algorithm_test/for_each.cpp index 56f2ef5..ac517ad 100644 --- a/test/algorithm_test/for_each.cpp +++ b/test/algorithm_test/for_each.cpp @@ -83,4 +83,4 @@ init_unit_test_suite(int argc, char* argv[]) test->add( BOOST_TEST_CASE( &boost::test_for_each ) ); return test; -} \ No newline at end of file +} diff --git a/test/algorithm_test/lower_bound.cpp b/test/algorithm_test/lower_bound.cpp index 44cc120..ca622bc 100644 --- a/test/algorithm_test/lower_bound.cpp +++ b/test/algorithm_test/lower_bound.cpp @@ -36,16 +36,16 @@ namespace boost return boost::lower_bound(cont, 5); } - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::lower_bound(cont, 5); - } - }; + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::lower_bound(cont, 5); + } + }; template< class Container > BOOST_DEDUCED_TYPENAME range_iterator::type @@ -66,15 +66,15 @@ namespace boost } template< range_return_value return_type > - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::lower_bound( - cont, 5, policy.pred()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::lower_bound( + cont, 5, policy.pred()); + } }; template @@ -85,10 +85,10 @@ namespace boost cont.begin(), cont.end(), 5, m_pred); } - BinaryPredicate& pred() { return m_pred; } + BinaryPredicate& pred() { return m_pred; } - private: - BinaryPredicate m_pred; + private: + BinaryPredicate m_pred; }; template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::max_element(cont); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::max_element(cont); + } }; template< class Container > @@ -66,17 +66,17 @@ namespace boost return boost::max_element(cont, Pred()); } - Pred pred() const { return Pred(); } + Pred pred() const { return Pred(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::max_element(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::max_element(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/min_element.cpp b/test/algorithm_test/min_element.cpp index 400372d..c68a655 100644 --- a/test/algorithm_test/min_element.cpp +++ b/test/algorithm_test/min_element.cpp @@ -37,14 +37,14 @@ namespace boost } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::min_element(cont); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::min_element(cont); + } }; template< class Container > @@ -66,17 +66,17 @@ namespace boost return boost::min_element(cont, Pred()); } - Pred pred() const { return Pred(); } + Pred pred() const { return Pred(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::min_element(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::min_element(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/partition.cpp b/test/algorithm_test/partition.cpp index e71c9a7..3f0ce61 100644 --- a/test/algorithm_test/partition.cpp +++ b/test/algorithm_test/partition.cpp @@ -44,17 +44,17 @@ namespace boost return boost::partition(cont, UnaryPredicate()); } - UnaryPredicate pred() const { return UnaryPredicate(); } + UnaryPredicate pred() const { return UnaryPredicate(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::partition(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::partition(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/stable_partition.cpp b/test/algorithm_test/stable_partition.cpp index 99db6be..fad4bef 100644 --- a/test/algorithm_test/stable_partition.cpp +++ b/test/algorithm_test/stable_partition.cpp @@ -44,17 +44,17 @@ namespace boost return boost::stable_partition(cont, UnaryPredicate()); } - UnaryPredicate pred() const { return UnaryPredicate(); } + UnaryPredicate pred() const { return UnaryPredicate(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::stable_partition(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::stable_partition(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/unique.cpp b/test/algorithm_test/unique.cpp index f5d75cf..2e2ebfa 100644 --- a/test/algorithm_test/unique.cpp +++ b/test/algorithm_test/unique.cpp @@ -41,14 +41,14 @@ namespace boost } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::unique(cont); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::unique(cont); + } }; template< class Container > @@ -73,17 +73,17 @@ namespace boost return std::unique(cont.begin(), cont.end(), Pred()); } - Pred pred() const { return Pred(); } + Pred pred() const { return Pred(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::unique(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::unique(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/upper_bound.cpp b/test/algorithm_test/upper_bound.cpp index 3df7164..2eb64cf 100644 --- a/test/algorithm_test/upper_bound.cpp +++ b/test/algorithm_test/upper_bound.cpp @@ -35,16 +35,16 @@ namespace boost return boost::upper_bound(cont, 5); } - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::upper_bound(cont, 5); - } - }; + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::upper_bound(cont, 5); + } + }; template< class Container > BOOST_DEDUCED_TYPENAME range_iterator::type @@ -65,15 +65,15 @@ namespace boost } template< range_return_value result_type> - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::upper_bound( - cont, 5, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::upper_bound( + cont, 5, policy.pred()); + } }; template @@ -83,11 +83,11 @@ namespace boost return std::upper_bound( cont.begin(), cont.end(), 5, BinaryPredicate()); } - - BinaryPredicate& pred() { return m_pred; } - - private: - BinaryPredicate m_pred; + + BinaryPredicate& pred() { return m_pred; } + + private: + BinaryPredicate m_pred; }; templateadd( BOOST_TEST_CASE( &boost::counting_range_test ) ); return test; -} \ No newline at end of file +} diff --git a/test/istream_range.cpp b/test/istream_range.cpp new file mode 100644 index 0000000..b3e16db --- /dev/null +++ b/test/istream_range.cpp @@ -0,0 +1,51 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + // Test an integer range with a step size of 1. + void test_istream_range() + { + std::stringstream s; + std::vector reference; + for (int i = 0; i < 10; ++i) + { + reference.push_back(i); + s << i << " "; + } + + std::vector target; + boost::push_back(target, boost::range::istream_range(s)); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target.begin(), target.end() ); + } + +} // namespace anonymous namespace + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.istream_range" ); + + test->add(BOOST_TEST_CASE( &test_istream_range )); + + return test; +} diff --git a/test/iterator_range.cpp b/test/iterator_range.cpp index cf22463..7c53a8b 100644 --- a/test/iterator_range.cpp +++ b/test/iterator_range.cpp @@ -61,7 +61,7 @@ void check_iterator_range() BOOST_CHECK_EQUAL( r2.size(), size( r2 ) ); BOOST_CHECK_EQUAL( std::distance( r.begin(), r.end() ), - std::distance( boost::begin( r2 ), boost::end( r2 ) ) ); + std::distance( boost::begin( r2 ), boost::end( r2 ) ) ); std::cout << r << r2; diff --git a/test/pointer_as_iterator.cpp b/test/pointer_as_iterator.cpp new file mode 100644 index 0000000..e0e28d0 --- /dev/null +++ b/test/pointer_as_iterator.cpp @@ -0,0 +1,39 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + void test_pointer_as_iterator() + { + boost::array arr; + boost::iterator_range r(arr.begin(), arr.end()); + r[0]; + } +} // anonymous namespace + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.pointer_as_iterator" ); + + test->add(BOOST_TEST_CASE( &test_pointer_as_iterator )); + + return test; +} diff --git a/test/test_driver/range_return_test_driver.hpp b/test/test_driver/range_return_test_driver.hpp index 6f4fc3b..eb52474 100644 --- a/test/test_driver/range_return_test_driver.hpp +++ b/test/test_driver/range_return_test_driver.hpp @@ -379,25 +379,25 @@ namespace boost range_result, reference_it); } - template< range_return_value result_type, class Container, class TestPolicy > - struct test_range - { - void operator()(Container& cont, TestPolicy policy) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; - typedef BOOST_DEDUCED_TYPENAME range_return::type range_return_t; - typedef BOOST_DEDUCED_TYPENAME TestPolicy::template test_range test_range_t; + template< range_return_value result_type, class Container, class TestPolicy > + struct test_range + { + void operator()(Container& cont, TestPolicy policy) + { + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; + typedef BOOST_DEDUCED_TYPENAME range_return::type range_return_t; + typedef BOOST_DEDUCED_TYPENAME TestPolicy::template test_range test_range_t; - Container reference(cont); - Container test_cont(cont); + Container reference(cont); + Container test_cont(cont); - range_return_t range_result = test_range_t()(policy, test_cont); - iterator_t reference_it = policy.reference(reference); + range_return_t range_result = test_range_t()(policy, test_cont); + iterator_t reference_it = policy.reference(reference); - check_results::check(test_cont, reference, + check_results::check(test_cont, reference, range_result, reference_it); - } - }; + } + }; }; } } From f9eeb5d447718df30e5d6ae5997e90676ae5d30e Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Fri, 23 Apr 2010 23:18:59 +0000 Subject: [PATCH 35/73] Boost.Range correct missing items from merge by merging these changes manually. This changeset is what should have happened with the prior svn merge operation. [SVN r61519] --- include/boost/range/algorithm/fill_n.hpp | 1 + include/boost/range/algorithm_ext/erase.hpp | 9 ++++++--- include/boost/range/algorithm_ext/insert.hpp | 7 ++++--- include/boost/range/algorithm_ext/iota.hpp | 4 +++- include/boost/range/algorithm_ext/push_back.hpp | 3 ++- include/boost/range/algorithm_ext/push_front.hpp | 3 ++- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/boost/range/algorithm/fill_n.hpp b/include/boost/range/algorithm/fill_n.hpp index f827135..29d7d6f 100755 --- a/include/boost/range/algorithm/fill_n.hpp +++ b/include/boost/range/algorithm/fill_n.hpp @@ -26,6 +26,7 @@ namespace boost /// range-based version of the fill_n std algorithm /// /// \pre ForwardRange is a model of the ForwardRangeConcept +/// \pre n <= std::distance(boost::begin(rng), boost::end(rng)) template< class ForwardRange, class Size, class Value > inline ForwardRange& fill_n(ForwardRange& rng, Size n, const Value& val) { diff --git a/include/boost/range/algorithm_ext/erase.hpp b/include/boost/range/algorithm_ext/erase.hpp index 3b0e037..107d32b 100755 --- a/include/boost/range/algorithm_ext/erase.hpp +++ b/include/boost/range/algorithm_ext/erase.hpp @@ -24,29 +24,32 @@ namespace boost { template< class Container > -inline void erase( Container& on, +inline Container& erase( Container& on, iterator_range to_erase ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); on.erase( boost::begin(to_erase), boost::end(to_erase) ); + return on; } template< class Container, class T > -inline void remove_erase( Container& on, const T& val ) +inline Container& remove_erase( Container& on, const T& val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); on.erase( std::remove(boost::begin(on), boost::end(on), val), boost::end(on)); + return on; } template< class Container, class Pred > -inline void remove_erase_if( Container& on, Pred pred ) +inline Container& remove_erase_if( Container& on, Pred pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); on.erase( std::remove_if(boost::begin(on), boost::end(on), pred), boost::end(on)); + return on; } } // namespace range diff --git a/include/boost/range/algorithm_ext/insert.hpp b/include/boost/range/algorithm_ext/insert.hpp index a887f15..b9adfdd 100755 --- a/include/boost/range/algorithm_ext/insert.hpp +++ b/include/boost/range/algorithm_ext/insert.hpp @@ -23,15 +23,16 @@ namespace boost { template< class Container, class Range > -inline void insert( Container& on, - BOOST_DEDUCED_TYPENAME Container::iterator before, - const Range& from ) +inline Container& insert( Container& on, + BOOST_DEDUCED_TYPENAME Container::iterator before, + const Range& from ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( (void*)&on != (void*)&from && "cannot copy from a container to itself" ); on.insert( before, boost::begin(from), boost::end(from) ); + return on; } } // namespace range diff --git a/include/boost/range/algorithm_ext/iota.hpp b/include/boost/range/algorithm_ext/iota.hpp index 4a03a59..65cbc89 100644 --- a/include/boost/range/algorithm_ext/iota.hpp +++ b/include/boost/range/algorithm_ext/iota.hpp @@ -22,7 +22,7 @@ namespace boost { template< class ForwardRange, class Value > -inline void iota( ForwardRange& rng, Value x ) +inline ForwardRange& iota( ForwardRange& rng, Value x ) { BOOST_CONCEPT_ASSERT(( ForwardRangeConcept )); typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; @@ -30,6 +30,8 @@ inline void iota( ForwardRange& rng, Value x ) iterator_t last_target = ::boost::end(rng); for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x) *target = x; + + return rng; } } // namespace range diff --git a/include/boost/range/algorithm_ext/push_back.hpp b/include/boost/range/algorithm_ext/push_back.hpp index e52de41..51a7a7b 100755 --- a/include/boost/range/algorithm_ext/push_back.hpp +++ b/include/boost/range/algorithm_ext/push_back.hpp @@ -23,13 +23,14 @@ namespace boost { template< class Container, class Range > -inline void push_back( Container& on, const Range& from ) +inline Container& push_back( Container& on, const Range& from ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( (void*)&on != (void*)&from && "cannot copy from a container to itself" ); on.insert( on.end(), boost::begin(from), boost::end(from) ); + return on; } } // namespace range diff --git a/include/boost/range/algorithm_ext/push_front.hpp b/include/boost/range/algorithm_ext/push_front.hpp index 6ee269b..470d793 100755 --- a/include/boost/range/algorithm_ext/push_front.hpp +++ b/include/boost/range/algorithm_ext/push_front.hpp @@ -23,13 +23,14 @@ namespace boost { template< class Container, class Range > -inline void push_front( Container& on, const Range& from ) +inline Container& push_front( Container& on, const Range& from ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( (void*)&on != (void*)&from && "cannot copy from a container to itself" ); on.insert( on.begin(), boost::begin(from), boost::end(from) ); + return on; } } // namespace range From 88001ada3797e2d54f0b6fc81f51c498a0815bc7 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sun, 9 May 2010 01:23:32 +0000 Subject: [PATCH 36/73] Merge standards-conformance fixes for Boost.Range [SVN r61864] --- test/extension_mechanism.cpp | 2 ++ 1 file changed, 2 insertions(+) mode change 100755 => 100644 test/extension_mechanism.cpp diff --git a/test/extension_mechanism.cpp b/test/extension_mechanism.cpp old mode 100755 new mode 100644 index a206afb..9e9891a --- a/test/extension_mechanism.cpp +++ b/test/extension_mechanism.cpp @@ -41,6 +41,8 @@ namespace Foo // struct X { + X() : vec() { } + typedef std::vector data_t; typedef data_t::iterator iterator; typedef data_t::const_iterator const_iterator; From 794fd3e226ac14fb3f75737258cb3ecc4eccd898 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sun, 9 May 2010 01:32:55 +0000 Subject: [PATCH 37/73] Move Boost.Range's join_iterator intrusive_ptr_add_ref and intrusive_ptr_release where ADL will actually find them [SVN r61867] --- include/boost/range/detail/join_iterator.hpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/include/boost/range/detail/join_iterator.hpp b/include/boost/range/detail/join_iterator.hpp index 792f834..76ebbfe 100644 --- a/include/boost/range/detail/join_iterator.hpp +++ b/include/boost/range/detail/join_iterator.hpp @@ -71,24 +71,19 @@ private: mutable reference_count_t count; }; -} // range_detail - template -inline void intrusive_ptr_add_ref(const range_detail::join_iterator_link* p) +inline void intrusive_ptr_add_ref(const join_iterator_link* p) { p->add_reference(); } template -inline void intrusive_ptr_release(const range_detail::join_iterator_link* p) +inline void intrusive_ptr_release(const join_iterator_link* p) { if (p->release_reference()) delete p; } -namespace range_detail -{ - class join_iterator_begin_tag {}; class join_iterator_end_tag {}; From ca2328ed872151a470dcb4417aac319cbff37c25 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 26 Jun 2010 12:30:09 +0000 Subject: [PATCH 38/73] Merge documentation fixes. * Use `doc/src/*.css` instead of `doc/html/*.css`. * Remove wiki and people directories. * Some documentation fixes. * Left out `minimal.css` changes and boostbook changes because of clashes. [SVN r63347] --- doc/Jamfile.v2 | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 5195b32..82a8d7f 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -19,8 +19,6 @@ boostbook quickbook boost_range.qbk : boost.root=../../../.. - boost.libraries=../../../libraries.htm - html.stylesheet=../../../../doc/html/boostbook.css chunk.section.depth=4 chunk.first.sections=1 toc.section.depth=3 From 26c095d0228413e8c4335c80658594658cb08a4d Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Sun, 18 Jul 2010 11:36:34 +0000 Subject: [PATCH 39/73] Boost.Range merge of bug fixes and documentation [SVN r64120] --- doc/history_ack.qbk | 9 +- doc/html/index.html | 18 +- doc/html/range/concepts.html | 12 +- .../range/concepts/bidirectional_range.html | 28 +- doc/html/range/concepts/concept_checking.html | 38 +-- doc/html/range/concepts/forward_range.html | 22 +- doc/html/range/concepts/overview.html | 20 +- .../range/concepts/random_access_range.html | 24 +- .../range/concepts/single_pass_range.html | 28 +- doc/html/range/examples.html | 48 ++-- doc/html/range/faq.html | 109 +++----- doc/html/range/history_ack.html | 84 +++--- doc/html/range/introduction.html | 123 ++++----- doc/html/range/library_headers.html | 12 +- doc/html/range/library_headers/adaptors.html | 12 +- doc/html/range/library_headers/algorithm.html | 12 +- .../library_headers/algorithm_extensions.html | 12 +- doc/html/range/library_headers/general.html | 12 +- doc/html/range/mfc_atl.html | 16 +- doc/html/range/mfc_atl/atl_ranges.html | 12 +- doc/html/range/mfc_atl/const_ranges.html | 12 +- doc/html/range/mfc_atl/mfc_ranges.html | 12 +- doc/html/range/mfc_atl/references.html | 28 +- doc/html/range/mfc_atl/requirements.html | 20 +- doc/html/range/portability.html | 52 ++-- doc/html/range/reference.html | 12 +- doc/html/range/reference/adaptors.html | 12 +- .../adaptors/adaptors_reference.html | 75 ----- .../adaptors/general_requirements.html | 66 ++--- .../reference/adaptors/introduction.html | 46 ++-- .../range/reference/adaptors/reference.html | 12 +- .../adaptors/reference/adjacent_filtered.html | 49 ++-- .../reference/adaptors/reference/copied.html | 48 ++-- .../adaptors/reference/filtered.html | 50 ++-- .../reference/adaptors/reference/indexed.html | 40 +-- .../adaptors/reference/indirected.html | 43 +-- .../adaptors/reference/map_keys.html | 41 +-- .../adaptors/reference/map_values.html | 41 +-- .../adaptors/reference/replaced.html | 64 +++-- .../adaptors/reference/replaced_if.html | 59 ++-- .../adaptors/reference/reversed.html | 32 +-- .../reference/adaptors/reference/sliced.html | 44 +-- .../reference/adaptors/reference/strided.html | 42 +-- .../adaptors/reference/tokenized.html | 79 +++--- .../adaptors/reference/transformed.html | 49 ++-- .../reference/adaptors/reference/uniqued.html | 40 +-- doc/html/range/reference/algorithms.html | 12 +- doc/html/range/reference/algorithms/heap.html | 12 +- .../reference/algorithms/heap/make_heap.html | 80 +++--- .../reference/algorithms/heap/pop_heap.html | 90 +++--- .../reference/algorithms/heap/push_heap.html | 90 +++--- .../reference/algorithms/heap/sort_heap.html | 82 +++--- .../range/reference/algorithms/mutating.html | 12 +- .../reference/algorithms/mutating/copy.html | 60 ++-- .../algorithms/mutating/copy_backward.html | 60 ++-- .../reference/algorithms/mutating/fill.html | 48 ++-- .../reference/algorithms/mutating/fill_n.html | 48 ++-- .../algorithms/mutating/generate.html | 64 ++--- .../algorithms/mutating/inplace_merge.html | 104 +++---- .../reference/algorithms/mutating/merge.html | 206 +++++++------- .../algorithms/mutating/nth_element.html | 80 +++--- .../algorithms/mutating/partial_sort.html | 80 +++--- .../algorithms/mutating/partition.html | 44 +-- .../algorithms/mutating/random_shuffle.html | 62 ++--- .../reference/algorithms/mutating/remove.html | 48 ++-- .../algorithms/mutating/remove_copy.html | 48 ++-- .../algorithms/mutating/remove_copy_if.html | 40 +-- .../algorithms/mutating/remove_if.html | 48 ++-- .../algorithms/mutating/replace.html | 58 ++-- .../algorithms/mutating/replace_copy.html | 54 ++-- .../algorithms/mutating/replace_copy_if.html | 60 ++-- .../algorithms/mutating/replace_if.html | 62 ++--- .../algorithms/mutating/reverse.html | 36 +-- .../algorithms/mutating/reverse_copy.html | 42 +-- .../reference/algorithms/mutating/rotate.html | 44 +-- .../algorithms/mutating/rotate_copy.html | 50 ++-- .../reference/algorithms/mutating/sort.html | 80 +++--- .../algorithms/mutating/stable_partition.html | 40 +-- .../algorithms/mutating/stable_sort.html | 80 +++--- .../algorithms/mutating/swap_ranges.html | 50 ++-- .../algorithms/mutating/transform.html | 140 +++++----- .../reference/algorithms/mutating/unique.html | 68 ++--- .../algorithms/mutating/unique_copy.html | 84 +++--- doc/html/range/reference/algorithms/new.html | 12 +- .../reference/algorithms/new/copy_n.html | 42 +-- .../range/reference/algorithms/new/erase.html | 28 +- .../reference/algorithms/new/for_each.html | 60 ++-- .../reference/algorithms/new/insert.html | 44 +-- .../range/reference/algorithms/new/iota.html | 37 +-- .../reference/algorithms/new/is_sorted.html | 44 +-- .../reference/algorithms/new/overwrite.html | 58 ++-- .../reference/algorithms/new/push_back.html | 44 +-- .../reference/algorithms/new/push_front.html | 44 +-- .../algorithms/new/remove_erase.html | 28 +- .../algorithms/new/remove_erase_if.html | 34 +-- .../reference/algorithms/non_mutating.html | 12 +- .../non_mutating/adjacent_find.html | 60 ++-- .../non_mutating/binary_search.html | 82 +++--- .../algorithms/non_mutating/count.html | 48 ++-- .../algorithms/non_mutating/count_if.html | 48 ++-- .../algorithms/non_mutating/equal.html | 96 +++---- .../algorithms/non_mutating/equal_range.html | 82 +++--- .../algorithms/non_mutating/find.html | 46 ++-- .../algorithms/non_mutating/find_end.html | 94 +++---- .../non_mutating/find_first_of.html | 86 +++--- .../algorithms/non_mutating/find_if.html | 44 +-- .../algorithms/non_mutating/for_each.html | 50 ++-- .../non_mutating/lexicographical_compare.html | 104 +++---- .../algorithms/non_mutating/lower_bound.html | 82 +++--- .../algorithms/non_mutating/max_element.html | 58 ++-- .../algorithms/non_mutating/min_element.html | 58 ++-- .../algorithms/non_mutating/mismatch.html | 98 +++---- .../algorithms/non_mutating/search.html | 96 +++---- .../algorithms/non_mutating/search_n.html | 84 +++--- .../algorithms/non_mutating/upper_bound.html | 82 +++--- .../range/reference/algorithms/numeric.html | 12 +- .../algorithms/numeric/accumulate.html | 96 +++---- .../numeric/adjacent_difference.html | 110 ++++---- .../algorithms/numeric/inner_product.html | 138 +++++----- .../algorithms/numeric/partial_sum.html | 98 +++---- .../reference/algorithms/permutation.html | 12 +- .../permutation/next_permutation.html | 80 +++--- .../permutation/prev_permutation.html | 80 +++--- .../range_algorithm_introduction.html | 257 ++++++++++++++++++ doc/html/range/reference/algorithms/set.html | 12 +- .../reference/algorithms/set/includes.html | 126 ++++----- .../algorithms/set/set_difference.html | 138 +++++----- .../algorithms/set/set_intersection.html | 138 +++++----- .../set/set_symmetric_difference.html | 138 +++++----- .../reference/algorithms/set/set_union.html | 138 +++++----- .../reference/concept_implementation.html | 12 +- .../concept_implementation/semantics.html | 14 +- .../semantics/functions.html | 12 +- .../semantics/metafunctions.html | 12 +- .../concept_implementation/synopsis.html | 12 +- doc/html/range/reference/extending.html | 12 +- .../range/reference/extending/method_1.html | 12 +- .../range/reference/extending/method_2.html | 12 +- .../range/reference/extending/method_3.html | 12 +- .../extending/method_3/method_3_1.html | 28 +- .../extending/method_3/method_3_2.html | 30 +- doc/html/range/reference/overview.html | 70 +++++ doc/html/range/reference/ranges.html | 12 +- .../reference/ranges/counting_range.html | 28 +- doc/html/range/reference/ranges/irange.html | 35 +-- .../range/reference/ranges/istream_range.html | 18 +- doc/html/range/reference/utilities.html | 24 +- .../reference/utilities/iterator_range.html | 113 +++----- doc/html/range/reference/utilities/join.html | 16 +- .../range/reference/utilities/sub_range.html | 14 +- doc/html/range/style_guide.html | 66 +++-- doc/html/range/upgrade.html | 12 +- doc/html/range/upgrade/upgrade_from_1_34.html | 56 ++-- doc/html/range/upgrade/upgrade_from_1_42.html | 38 +-- doc/introduction.qbk | 71 ++--- doc/reference/adaptors/adjacent_filtered.html | 101 ------- doc/reference/adaptors/copied.html | 93 ------- doc/reference/adaptors/filtered.html | 108 -------- doc/reference/adaptors/indexed.html | 117 -------- doc/reference/adaptors/indirected.html | 95 ------- doc/reference/adaptors/map_keys.html | 99 ------- doc/reference/adaptors/map_values.html | 98 ------- doc/reference/adaptors/replaced.html | 107 -------- doc/reference/adaptors/replaced_if.html | 114 -------- doc/reference/adaptors/reversed.html | 91 ------- doc/reference/adaptors/sliced.html | 94 ------- doc/reference/adaptors/strided.html | 94 ------- doc/reference/adaptors/tokenized.html | 118 -------- doc/reference/adaptors/transformed.html | 107 -------- doc/reference/adaptors/uniqued.html | 95 ------- .../boost/range/adaptor/adjacent_filtered.hpp | 9 +- include/boost/range/adaptor/map.hpp | 56 ++-- include/boost/range/adaptor/replaced.hpp | 22 +- include/boost/range/adaptor/sliced.hpp | 28 +- include/boost/range/algorithm/copy.hpp | 2 +- .../boost/range/algorithm/copy_backward.hpp | 2 +- include/boost/range/algorithm/equal.hpp | 8 +- include/boost/range/algorithm/fill.hpp | 9 + include/boost/range/algorithm/fill_n.hpp | 10 + include/boost/range/algorithm/find.hpp | 30 +- include/boost/range/algorithm/find_end.hpp | 73 ++++- .../boost/range/algorithm/find_first_of.hpp | 74 ++++- include/boost/range/algorithm/find_if.hpp | 30 +- include/boost/range/algorithm/generate.hpp | 9 + .../boost/range/algorithm/heap_algorithm.hpp | 72 +++++ include/boost/range/algorithm/lower_bound.hpp | 63 ++++- .../boost/range/algorithm/partial_sort.hpp | 22 ++ .../range/algorithm/partial_sort_copy.hpp | 28 +- include/boost/range/algorithm/partition.hpp | 20 ++ .../boost/range/algorithm/random_shuffle.hpp | 18 ++ include/boost/range/algorithm/remove.hpp | 20 ++ include/boost/range/algorithm/remove_copy.hpp | 4 +- .../boost/range/algorithm/remove_copy_if.hpp | 6 +- include/boost/range/algorithm/remove_if.hpp | 20 ++ include/boost/range/algorithm/replace.hpp | 11 + .../boost/range/algorithm/replace_copy.hpp | 4 +- .../boost/range/algorithm/replace_copy_if.hpp | 4 +- include/boost/range/algorithm/replace_if.hpp | 11 + include/boost/range/algorithm/reverse.hpp | 9 + .../boost/range/algorithm/reverse_copy.hpp | 2 +- include/boost/range/algorithm/rotate.hpp | 10 + include/boost/range/algorithm/search_n.hpp | 8 +- include/boost/range/algorithm/sort.hpp | 18 ++ include/boost/range/algorithm/stable_sort.hpp | 18 ++ include/boost/range/algorithm/swap_ranges.hpp | 45 +++ include/boost/range/algorithm/upper_bound.hpp | 64 ++++- include/boost/range/algorithm_ext/iota.hpp | 13 + .../boost/range/algorithm_ext/is_sorted.hpp | 6 +- .../boost/range/algorithm_ext/overwrite.hpp | 27 ++ include/boost/range/detail/join_iterator.hpp | 84 ++---- include/boost/range/irange.hpp | 40 ++- include/boost/range/join.hpp | 71 +++-- include/boost/range/numeric.hpp | 47 ++-- test/Jamfile.v2 | 9 + test/adaptor_test/map.cpp | 44 +++ test/algorithm_test/adjacent_find.cpp | 8 +- test/algorithm_test/binary_search.cpp | 4 + test/algorithm_test/copy.cpp | 7 + test/algorithm_test/copy_backward.cpp | 4 + test/algorithm_test/copy_n.cpp | 70 +++++ test/algorithm_test/count.cpp | 40 +-- test/algorithm_test/count_if.cpp | 14 + test/algorithm_test/equal.cpp | 40 +++ test/algorithm_test/equal_range.cpp | 14 +- test/algorithm_test/fill.cpp | 6 + test/algorithm_test/find.cpp | 14 +- test/algorithm_test/find_end.cpp | 28 +- test/algorithm_test/find_first_of.cpp | 32 ++- test/algorithm_test/find_if.cpp | 10 +- test/algorithm_test/for_each.cpp | 21 +- test/algorithm_test/generate.cpp | 6 + test/algorithm_test/heap.cpp | 23 ++ test/algorithm_test/includes.cpp | 8 + test/algorithm_test/inplace_merge.cpp | 19 ++ .../lexicographical_compare.cpp | 14 +- test/algorithm_test/lower_bound.cpp | 23 +- test/algorithm_test/max_element.cpp | 24 +- test/algorithm_test/merge.cpp | 80 ++++++ test/algorithm_test/min_element.cpp | 22 +- test/algorithm_test/mismatch.cpp | 245 ++++++++++------- test/algorithm_test/next_permutation.cpp | 21 +- test/algorithm_test/nth_element.cpp | 26 ++ test/algorithm_test/partial_sort.cpp | 22 ++ test/algorithm_test/partition.cpp | 32 ++- test/algorithm_test/prev_permutation.cpp | 24 +- test/algorithm_test/random_shuffle.cpp | 19 ++ test/algorithm_test/remove.cpp | 11 +- test/algorithm_test/remove_copy.cpp | 107 ++++++++ test/algorithm_test/remove_copy_if.cpp | 113 ++++++++ test/algorithm_test/remove_if.cpp | 12 +- test/algorithm_test/replace.cpp | 9 +- test/algorithm_test/replace_copy.cpp | 110 ++++++++ test/algorithm_test/replace_copy_if.cpp | 115 ++++++++ test/algorithm_test/replace_if.cpp | 10 +- test/algorithm_test/reverse.cpp | 12 +- test/algorithm_test/reverse_copy.cpp | 97 +++++++ test/algorithm_test/rotate.cpp | 16 +- test/algorithm_test/rotate_copy.cpp | 112 ++++++++ test/algorithm_test/search.cpp | 16 ++ test/algorithm_test/search_n.cpp | 93 +++++++ test/algorithm_test/set_difference.cpp | 44 +++ test/algorithm_test/set_intersection.cpp | 44 +++ .../set_symmetric_difference.cpp | 44 +++ test/algorithm_test/set_union.cpp | 40 +++ test/algorithm_test/sort.cpp | 16 +- test/algorithm_test/stable_partition.cpp | 28 +- test/algorithm_test/stable_sort.cpp | 22 +- test/algorithm_test/swap_ranges.cpp | 116 ++++++++ test/algorithm_test/transform.cpp | 34 ++- test/algorithm_test/unique.cpp | 26 +- test/algorithm_test/unique_copy.cpp | 158 +++++++++++ test/algorithm_test/upper_bound.cpp | 25 +- test/replace_copy.cpp | 0 test/string.cpp | 58 +++- test/test_function/true_predicate.hpp | 29 ++ 275 files changed, 7445 insertions(+), 5987 deletions(-) delete mode 100644 doc/html/range/reference/adaptors/adaptors_reference.html create mode 100644 doc/html/range/reference/algorithms/range_algorithm_introduction.html create mode 100644 doc/html/range/reference/overview.html delete mode 100755 doc/reference/adaptors/adjacent_filtered.html delete mode 100755 doc/reference/adaptors/copied.html delete mode 100755 doc/reference/adaptors/filtered.html delete mode 100755 doc/reference/adaptors/indexed.html delete mode 100755 doc/reference/adaptors/indirected.html delete mode 100755 doc/reference/adaptors/map_keys.html delete mode 100755 doc/reference/adaptors/map_values.html delete mode 100755 doc/reference/adaptors/replaced.html delete mode 100755 doc/reference/adaptors/replaced_if.html delete mode 100755 doc/reference/adaptors/reversed.html delete mode 100755 doc/reference/adaptors/sliced.html delete mode 100755 doc/reference/adaptors/strided.html delete mode 100755 doc/reference/adaptors/tokenized.html delete mode 100755 doc/reference/adaptors/transformed.html delete mode 100755 doc/reference/adaptors/uniqued.html create mode 100644 test/algorithm_test/copy_n.cpp create mode 100644 test/algorithm_test/remove_copy.cpp create mode 100644 test/algorithm_test/remove_copy_if.cpp create mode 100644 test/algorithm_test/replace_copy.cpp create mode 100644 test/algorithm_test/replace_copy_if.cpp create mode 100644 test/algorithm_test/reverse_copy.cpp create mode 100644 test/algorithm_test/rotate_copy.cpp create mode 100644 test/algorithm_test/search_n.cpp create mode 100644 test/algorithm_test/swap_ranges.cpp create mode 100644 test/algorithm_test/unique_copy.cpp create mode 100644 test/replace_copy.cpp create mode 100644 test/test_function/true_predicate.hpp diff --git a/doc/history_ack.qbk b/doc/history_ack.qbk index 545b3ab..73ce9e8 100644 --- a/doc/history_ack.qbk +++ b/doc/history_ack.qbk @@ -26,11 +26,18 @@ the result of a merge of all of the RangeEx features into Boost.Range. There were an enormous number of very significant contributors through all stages of this library. +Prior to Boost.RangeEx there had been a number of Range library implementations, +these include library implementations by Eric Niebler, Adobe, +Shunsuke Sogame etc. Eric Niebler contributed the Range Adaptor idea which is +arguably the single biggest innovation in this library. Inevitably a great deal +of commonality evolved in each of these libraries, but a considerable amount +of effort was expended to learn from all of the divergent techniques. + The people in the following list all made contributions in the form of reviews, user feedback, design suggestions, or defect detection: * Thorsten Ottosen: review management, design advice, documentation feedback -* Eric Niebler: feedback +* Eric Niebler: early implementation, and review feedback * Joel de Guzman: review * Mathias Gaunard: review * David Abrahams: implementation advice diff --git a/doc/html/index.html b/doc/html/index.html index f6095bd..90355b6 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -2,8 +2,8 @@ Chapter 1. Range 2.0 - - + + @@ -11,14 +11,14 @@

    - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -
    Next
    -
    +
    Next
    +

    Chapter 1. Range 2.0

    @@ -29,8 +29,8 @@ Neil Groves
    -
    -

    +

    +

    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)

    @@ -142,10 +142,10 @@

    - +

    Last revised: April 28, 2010 at 17:51:33 GMT

    Last revised: July 17, 2010 at 19:34:42 GMT


    -
    Next
    +
    Next
    diff --git a/doc/html/range/concepts.html b/doc/html/range/concepts.html index c384122..b071de6 100644 --- a/doc/html/range/concepts.html +++ b/doc/html/range/concepts.html @@ -2,8 +2,8 @@ Range Concepts - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -45,7 +45,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/concepts/bidirectional_range.html b/doc/html/range/concepts/bidirectional_range.html index 72c8c28..a8decd6 100644 --- a/doc/html/range/concepts/bidirectional_range.html +++ b/doc/html/range/concepts/bidirectional_range.html @@ -2,8 +2,8 @@ Bidirectional Range - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -75,7 +75,7 @@ Traversal Iterator.

    - + Refinement of
    @@ -83,7 +83,7 @@ Forward Range

    - + Associated types
    @@ -136,7 +136,7 @@
    - + Valid expressions
    @@ -221,7 +221,7 @@
    - + Complexity guarantees
    @@ -232,7 +232,7 @@ Forward Range.

    - + Invariants
    @@ -272,7 +272,7 @@
    - + See also

    @@ -294,7 +294,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/concepts/concept_checking.html b/doc/html/range/concepts/concept_checking.html index 30d3850..ca397ff 100644 --- a/doc/html/range/concepts/concept_checking.html +++ b/doc/html/range/concepts/concept_checking.html @@ -2,8 +2,8 @@ Concept Checking - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -62,24 +62,24 @@

    - + See also

    @@ -102,7 +102,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/concepts/forward_range.html b/doc/html/range/concepts/forward_range.html index 61ec9e8..1910a37 100644 --- a/doc/html/range/concepts/forward_range.html +++ b/doc/html/range/concepts/forward_range.html @@ -2,8 +2,8 @@ Forward Range - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -73,14 +73,14 @@ Traversal Iterator.

    - + Refinement of

    Single Pass Range

    - + Associated types
    @@ -132,7 +132,7 @@
    - + See also

    @@ -154,7 +154,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/concepts/overview.html b/doc/html/range/concepts/overview.html index 7cd19e8..0fa9643 100644 --- a/doc/html/range/concepts/overview.html +++ b/doc/html/range/concepts/overview.html @@ -2,8 +2,8 @@ Overview - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -41,11 +41,11 @@

    • - own the elements that can be accessed through it, -
    • + own the elements that can be accessed through it, +
    • - have copy semantics, -
    • + have copy semantics, +

    Because of the second requirement, a Range object must be passed by (const @@ -73,7 +73,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/concepts/random_access_range.html b/doc/html/range/concepts/random_access_range.html index 379410e..05cbdc0 100644 --- a/doc/html/range/concepts/random_access_range.html +++ b/doc/html/range/concepts/random_access_range.html @@ -2,8 +2,8 @@ Random Access Range - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Description

    @@ -35,7 +35,7 @@ Access Traversal Iterator.

    - + Refinement of
    @@ -43,7 +43,7 @@ Bidirectional Range

    - + Valid expressions
    @@ -89,7 +89,7 @@
    - + Expression semantics
    @@ -139,7 +139,7 @@
    - + Complexity guarantees
    @@ -147,7 +147,7 @@ boost::size(a) completes in amortized constant time.

    - + Invariants
    @@ -181,7 +181,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/concepts/single_pass_range.html b/doc/html/range/concepts/single_pass_range.html index 32bcef4..a2372ac 100644 --- a/doc/html/range/concepts/single_pass_range.html +++ b/doc/html/range/concepts/single_pass_range.html @@ -2,8 +2,8 @@ Single Pass Range - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -73,7 +73,7 @@ Pass Iterator.

    - + Associated types
    @@ -126,7 +126,7 @@
    - + Valid expressions
    @@ -198,7 +198,7 @@
    - + Expression semantics
    @@ -266,7 +266,7 @@
    - + Complexity guarantees
    @@ -276,7 +276,7 @@ constant time.

    - + Invariants
    @@ -316,7 +316,7 @@
    - + See also

    @@ -344,7 +344,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/examples.html b/doc/html/range/examples.html index 4be5b97..14aad79 100644 --- a/doc/html/range/examples.html +++ b/doc/html/range/examples.html @@ -2,8 +2,8 @@ Examples - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -31,19 +31,31 @@

    @@ -56,7 +68,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/faq.html b/doc/html/range/faq.html index cb21529..6a689f1 100644 --- a/doc/html/range/faq.html +++ b/doc/html/range/faq.html @@ -2,8 +2,8 @@ FAQ - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    FAQ

    @@ -31,84 +31,47 @@ and range_const_iterator<C>::type for std::pair<iterator, iterator>?

    -
    -

    -

    -

    - In general it is not possible nor desirable to find a corresponding const_iterator. When it is possible to - come up with one, the client might choose to construct a std::pair<const_iterator,const_iterator> - object. -

    -

    -

    -
    -
    -

    -

    -

    - Note that an iterator_range is somewhat more - convenient than a pair - and that a sub_range does propagate const-ness. -

    -

    -

    -
    +

    + In general it is not possible nor desirable to find a corresponding const_iterator. When it is possible to + come up with one, the client might choose to construct a std::pair<const_iterator,const_iterator> object. +

    +

    + Note that an iterator_range is somewhat more + convenient than a pair and + that a sub_range does propagate const-ness. +

    2. Why is there not supplied more types or more functions?

    -
    -

    -

    -

    - The library has been kept small because its current interface will serve - most purposes. If and when a genuine need arises for more functionality, - it can be implemented. -

    -

    -

    -
    +

    + The library has been kept small because its current interface will serve + most purposes. If and when a genuine need arises for more functionality, + it can be implemented. +

    3. How should I implement generic algorithms for ranges?

    -
    -

    -

    -

    - One should always start with a generic algorithm that takes two iterators - (or more) as input. Then use Boost.Range to build handier versions on top - of the iterator based algorithm. Please notice that once the range version - of the algorithm is done, it makes sense not to expose the iterator version - in the public interface. -

    -

    -

    -
    +

    + One should always start with a generic algorithm that takes two iterators + (or more) as input. Then use Boost.Range to build handier versions on top + of the iterator based algorithm. Please notice that once the range version + of the algorithm is done, it makes sense not to expose the iterator version + in the public interface. +

    4. Why is there no Incrementable Range concept?

    -
    -

    -

    -

    - Even though we speak of incrementable iterators, it would not make much - sense for ranges; for example, we cannot determine the size and emptiness - of a range since we cannot even compare its iterators. -

    -

    -

    -
    -
    -

    -

    -

    - Note also that incrementable iterators are derived from output iterators - and so there exist no output range. -

    -

    -

    -
    +

    + Even though we speak of incrementable iterators, it would not make much sense + for ranges; for example, we cannot determine the size and emptiness of a + range since we cannot even compare its iterators. +

    +

    + Note also that incrementable iterators are derived from output iterators + and so there exist no output range. +

    @@ -120,7 +83,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/history_ack.html b/doc/html/range/history_ack.html index 37d497d..66191b9 100644 --- a/doc/html/range/history_ack.html +++ b/doc/html/range/history_ack.html @@ -2,8 +2,8 @@ History and Acknowledgement - - + + @@ -12,21 +12,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHome +PrevUpHome
    -
    +

    - + Version 1 - before Boost 1.43

    @@ -60,26 +60,26 @@

    • - Pavol Droba for help with documentation and implementation -
    • + Pavol Droba for help with documentation and implementation +
    • - Pavel Vozenilek for help with porting the library -
    • + Pavel Vozenilek for help with porting the library +
    • - Jonathan Turkanis and John Torjo for help with documentation -
    • + Jonathan Turkanis and John Torjo for help with documentation +
    • - Hartmut Kaiser for being review manager -
    • + Hartmut Kaiser for being review manager +
    • - Jonathan Turkanis for porting the lib (as far sa possible) to vc6 and vc7. -
    • + Jonathan Turkanis for porting the lib (as far sa possible) to vc6 and vc7. +

    The concept checks and their documentation was provided by Daniel Walker.

    - + Version 2 - Boost 1.43 and beyond

    @@ -91,41 +91,49 @@ There were an enormous number of very significant contributors through all stages of this library.

    +

    + Prior to Boost.RangeEx there had been a number of Range library implementations, + these include library implementations by Eric Niebler, Adobe, Shunsuke Sogame + etc. Eric Niebler contributed the Range Adaptor idea which is arguably the + single biggest innovation in this library. Inevitably a great deal of commonality + evolved in each of these libraries, but a considerable amount of effort was + expended to learn from all of the divergent techniques. +

    The people in the following list all made contributions in the form of reviews, user feedback, design suggestions, or defect detection:

    • - Thorsten Ottosen: review management, design advice, documentation feedback -
    • + Thorsten Ottosen: review management, design advice, documentation feedback +
    • - Eric Niebler: feedback -
    • + Eric Niebler: early implementation, and review feedback +
    • - Joel de Guzman: review -
    • + Joel de Guzman: review +
    • - Mathias Gaunard: review -
    • + Mathias Gaunard: review +
    • - David Abrahams: implementation advice -
    • + David Abrahams: implementation advice +
    • - Robert Jones: defect reports, usage feedback -
    • + Robert Jones: defect reports, usage feedback +
    • - Sean Parent: contributed experience from the Adobe range library -
    • + Sean Parent: contributed experience from the Adobe range library +
    • - Arno Schoedl: implementations, and review -
    • + Arno Schoedl: implementations, and review +
    • - Rogier van Dalen: review -
    • + Rogier van Dalen: review +
    • - Vincente Botet: review, documentation feedback -
    • + Vincente Botet: review, documentation feedback +

    Regardless of how I write this section it will never truly fairly capture the @@ -142,7 +150,7 @@


    -PrevUpHome +PrevUpHome
    diff --git a/doc/html/range/introduction.html b/doc/html/range/introduction.html index 7bedc97..5ea6f50 100644 --- a/doc/html/range/introduction.html +++ b/doc/html/range/introduction.html @@ -2,8 +2,8 @@ Introduction - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -59,83 +59,58 @@

    • - simpler implementation and specification of generic range algorithms -
    • + simpler implementation and specification of generic range algorithms +
    • - more flexible, compact and maintainable client code -
    • + more flexible, compact and maintainable client code +
    • - safe use of built-in arrays (for legacy code; why else would you use built-in - arrays?) -
    • + safe use of built-in arrays (for legacy code; why else would you use built-in + arrays?) +
    -

    - Below are given a small example (the complete example can be found here - ): -

    +

    + + Example + - Iterate over the values in a map +

    -
    //
    -// example: extracting bounds in a generic algorithm
    -//
    -template< class ForwardReadableRange, class T >
    -inline typename boost::range_iterator< ForwardReadableRange >::type
    -find( ForwardReadableRange& c, const T& value )
    -{
    -   return std::find( boost::begin( c ), boost::end( c ), value );
    -}
    -
    -template< class ForwardReadableRange, class T >
    -inline typename boost::range_iterator< const ForwardReadableRange >::type
    -find( const ForwardReadableRange& c, const T& value )
    -{
    -   return std::find( boost::begin( c ), boost::end( c ), value );
    -}
    -
    -//
    -// replace first value and return its index
    -//
    -template< class ForwardReadableWriteableRange, class T >
    -inline typename boost::range_size< ForwardReadableWriteableRange >::type
    -my_generic_replace( ForwardReadableWriteableRange& c, const T& value, const T& replacement )
    -{
    -   typename boost::range_iterator< ForwardReadableWriteableRange >::type found = find( c, value );
    -
    -   if( found != boost::end( c ) )
    -       *found = replacement;
    -   return std::distance( boost::begin( c ), found );
    -}
    -
    -//
    -// usage
    -//
    -const int N = 5;
    -std::vector<int> my_vector;
    -int values[] = { 1,2,3,4,5,6,7,8,9 };
    -
    -my_vector.assign( values, boost::end( values ) );
    -typedef std::vector<int>::iterator iterator;
    -std::pair<iterator,iterator>       my_view( boost::begin( my_vector ),
    -                                            boost::begin( my_vector ) + N );
    -char  str_val[] = "a string";
    -char* str       = str_val;
    -
    -std::cout << my_generic_replace( my_vector, 4, 2 );
    -std::cout << my_generic_replace( my_view, 4, 2 );
    -std::cout << my_generic_replace( str, 'a', 'b' );
    -
    -// prints '3', '5' and '0'
    -
    +
    using namespace boost;
    +using namespace boost::adaptors;
    +for_each( my_map | map_values, fn );
    +

    +

    + + Example + - Iterate over the keys in a map +

    +

    + +

    +
    using namespace boost;
    +using namespace boost::adaptors;
    +for_each( my_map | map_keys, fn );
    +
    +

    +

    +

    + + Example + - Push the even values from a map in reverse order into the container target +

    +

    + +

    +
    using namespace boost;
    +using namespace boost::adaptors;
    +// Assume that is_even is a predicate that has been implemented elsewhere...
    +push_back(target, my_map | map_values | filtered(is_even()) | reversed);
    +

    - By using the free-standing functions and metafunctions, - the code automatically works for all the types supported by this library; now - and in the future. Notice that we have to provide two versions of find() since - we cannot forward a non-const rvalue with reference arguments (see this article - about The - Forwarding Problem ).

    @@ -148,7 +123,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/library_headers.html b/doc/html/range/library_headers.html index 0e06413..93a048f 100644 --- a/doc/html/range/library_headers.html +++ b/doc/html/range/library_headers.html @@ -2,8 +2,8 @@ Library Headers - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -44,7 +44,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/library_headers/adaptors.html b/doc/html/range/library_headers/adaptors.html index f8810a4..d6948ea 100644 --- a/doc/html/range/library_headers/adaptors.html +++ b/doc/html/range/library_headers/adaptors.html @@ -2,8 +2,8 @@ Adaptors - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -226,7 +226,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/library_headers/algorithm.html b/doc/html/range/library_headers/algorithm.html index 6beb47e..cab83e7 100644 --- a/doc/html/range/library_headers/algorithm.html +++ b/doc/html/range/library_headers/algorithm.html @@ -2,8 +2,8 @@ Algorithm - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -677,7 +677,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/library_headers/algorithm_extensions.html b/doc/html/range/library_headers/algorithm_extensions.html index f3dd061..7a4db8f 100644 --- a/doc/html/range/library_headers/algorithm_extensions.html +++ b/doc/html/range/library_headers/algorithm_extensions.html @@ -2,8 +2,8 @@ Algorithm Extensions - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    Algorithm Extensions @@ -166,7 +166,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/library_headers/general.html b/doc/html/range/library_headers/general.html index 558fe74..5996f99 100644 --- a/doc/html/range/library_headers/general.html +++ b/doc/html/range/library_headers/general.html @@ -2,8 +2,8 @@ General - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -545,7 +545,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/mfc_atl.html b/doc/html/range/mfc_atl.html index c0f1c6d..72221f9 100644 --- a/doc/html/range/mfc_atl.html +++ b/doc/html/range/mfc_atl.html @@ -2,8 +2,8 @@ MFC/ATL (courtesy of Shunsuke Sogame) - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Introduction

    @@ -100,7 +100,7 @@

    - + Overview

    @@ -135,7 +135,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/mfc_atl/atl_ranges.html b/doc/html/range/mfc_atl/atl_ranges.html index 65ee355..6c96f33 100644 --- a/doc/html/range/mfc_atl/atl_ranges.html +++ b/doc/html/range/mfc_atl/atl_ranges.html @@ -2,8 +2,8 @@ ATL Ranges - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -368,7 +368,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/mfc_atl/const_ranges.html b/doc/html/range/mfc_atl/const_ranges.html index 2e047f6..cf41223 100644 --- a/doc/html/range/mfc_atl/const_ranges.html +++ b/doc/html/range/mfc_atl/const_ranges.html @@ -2,8 +2,8 @@ const Ranges - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -119,7 +119,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/mfc_atl/mfc_ranges.html b/doc/html/range/mfc_atl/mfc_ranges.html index af0c6e9..57655a2 100644 --- a/doc/html/range/mfc_atl/mfc_ranges.html +++ b/doc/html/range/mfc_atl/mfc_ranges.html @@ -2,8 +2,8 @@ MFC Ranges - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -474,7 +474,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/mfc_atl/references.html b/doc/html/range/mfc_atl/references.html index 124a538..1d0a7a4 100644 --- a/doc/html/range/mfc_atl/references.html +++ b/doc/html/range/mfc_atl/references.html @@ -2,8 +2,8 @@ References - - + + @@ -13,25 +13,31 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    + @@ -44,7 +50,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/mfc_atl/requirements.html b/doc/html/range/mfc_atl/requirements.html index 131433f..8c0a80a 100644 --- a/doc/html/range/mfc_atl/requirements.html +++ b/doc/html/range/mfc_atl/requirements.html @@ -2,8 +2,8 @@ Requirements - - + + @@ -13,26 +13,26 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    • - Boost C++ Libraries Version 1.34.0 or later (no compilation required) -
    • + Boost C++ Libraries Version 1.34.0 or later (no compilation required) +
    • - Visual C++ 7.1 or later (for MFC and ATL) -
    • + Visual C++ 7.1 or later (for MFC and ATL) +
    @@ -45,7 +45,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/portability.html b/doc/html/range/portability.html index 45d3a07..e2afd81 100644 --- a/doc/html/range/portability.html +++ b/doc/html/range/portability.html @@ -2,8 +2,8 @@ Portability - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -47,32 +47,32 @@

    1. - do not use built-in arrays, -
    2. + do not use built-in arrays, +
    3. - do not pass rvalues to begin(), - end() - and iterator_range Range constructors - and assignment operators, -
    4. + do not pass rvalues to begin(), + end() + and iterator_range Range constructors + and assignment operators, +
    5. - use const_begin() - and const_end() - whenever your code by intention is read-only; this will also solve most rvalue - problems, -
    6. + use const_begin() + and const_end() + whenever your code by intention is read-only; this will also solve most + rvalue problems, +
    7. - do not rely on ADL: -
        + do not rely on ADL: +
        • - if you overload functions, include that header before the headers in - this library, -
        • + if you overload functions, include that header before the headers + in this library, +
        • - put all overloads in namespace boost. -
        • + put all overloads in namespace boost. +
        - +
    @@ -85,7 +85,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference.html b/doc/html/range/reference.html index cbff24d..9b31bb4 100644 --- a/doc/html/range/reference.html +++ b/doc/html/range/reference.html @@ -2,8 +2,8 @@ Reference - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -89,7 +89,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors.html b/doc/html/range/reference/adaptors.html index b649558..59564f9 100644 --- a/doc/html/range/reference/adaptors.html +++ b/doc/html/range/reference/adaptors.html @@ -2,8 +2,8 @@ Range Adaptors - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -44,7 +44,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/adaptors_reference.html b/doc/html/range/reference/adaptors/adaptors_reference.html deleted file mode 100644 index d284888..0000000 --- a/doc/html/range/reference/adaptors/adaptors_reference.html +++ /dev/null @@ -1,75 +0,0 @@ - - - -Reference - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    - - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/adaptors/general_requirements.html b/doc/html/range/reference/adaptors/general_requirements.html index 63abc37..83d19c0 100644 --- a/doc/html/range/reference/adaptors/general_requirements.html +++ b/doc/html/range/reference/adaptors/general_requirements.html @@ -2,8 +2,8 @@ General Requirements - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    General Requirements @@ -33,40 +33,40 @@

    • -fwdRng is an expression - of a type R that models - ForwardRange -
    • + fwdRng is an expression + of a type R that models + ForwardRange +
    • -biRng is an expression - of a type R that models - BidirectionalRange -
    • + biRng is an expression + of a type R that models + BidirectionalRange +
    • -rndRng is an expression - of a type R that models - RandomAccessRange -
    • + rndRng is an expression + of a type R that models + RandomAccessRange +
    • -pred is an expression - of a type that models UnaryPredicate -
    • + pred is an expression + of a type that models UnaryPredicate +
    • -bi_pred is an expression - of a type that models BinaryPredicate -
    • + bi_pred is an expression + of a type that models BinaryPredicate +
    • -fun is an expression - of a type that models UnaryFunction -
    • + fun is an expression + of a type that models UnaryFunction +
    • -value, new_value and old_value - are objects convertible to boost::range_value<R>::type -
    • + value, new_value and old_value + are objects convertible to boost::range_value<R>::type +
    • -n,m are integer expressions convertible - to range_difference<R>::type -
    • + n,m are integer expressions convertible + to range_difference<R>::type +

    Also note that boost::range_value<R>::type must be implicitly convertible to @@ -135,7 +135,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/introduction.html b/doc/html/range/reference/adaptors/introduction.html index 1982491..bdf55ce 100644 --- a/doc/html/range/reference/adaptors/introduction.html +++ b/doc/html/range/reference/adaptors/introduction.html @@ -2,8 +2,8 @@ Introduction and motivation - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    Introduction and motivation @@ -122,7 +122,7 @@ situations, you will really appreciate the succinctness of operator|().

    - + Composition of Adaptors
    @@ -132,8 +132,14 @@ to algorithms. For example, consider these Range algorithms:

      -
    • boost::copy( rng, out )
    • -
    • boost::count( rng, pred )
    • +
    • + boost::copy( rng, out ) +
    • +
    • + boost::count( + rng, + pred ) +

    What should we do if we only want to copy an element a @@ -142,13 +148,17 @@ The naive answer would be to use these algorithms:

      -
    • boost::copy_if( - rng, - pred, - out )
    • -
    • boost::count_if( - rng, - pred )
    • +
    • + boost::copy_if( + rng, + pred, + out ) +
    • +
    • + boost::count_if( + rng, + pred ) +

    These algorithms are only defined to maintain a one to one relationship @@ -159,7 +169,7 @@ is the design solution to this problem.

    - + Range Adaptor alternative to copy_if algorithm
    @@ -176,7 +186,7 @@

    - + Range Adaptor alternative to count_if algorithm
    @@ -268,7 +278,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference.html b/doc/html/range/reference/adaptors/reference.html index a76fbcb..b026090 100644 --- a/doc/html/range/reference/adaptors/reference.html +++ b/doc/html/range/reference/adaptors/reference.html @@ -2,8 +2,8 @@ Reference - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -57,7 +57,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference/adjacent_filtered.html b/doc/html/range/reference/adaptors/reference/adjacent_filtered.html index c6d4404..31128ea 100644 --- a/doc/html/range/reference/adaptors/reference/adjacent_filtered.html +++ b/doc/html/range/reference/adaptors/reference/adjacent_filtered.html @@ -2,8 +2,8 @@ adjacent_filtered - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    adjacent_filtered @@ -77,29 +77,30 @@
    • -Precondition: The value_type - of the range is convertible to both argument types of bi_pred. -
    • + Precondition: The value_type of the range is convertible + to both argument types of bi_pred. +
    • -Postcondition: For all adjacent elements - [x,y] in the returned range, bi_pred(x,y) - is true. -
    • + Postcondition: For all adjacent + elements [x,y] in the returned range, bi_pred(x,y) + is true. +
    • -Throws: Whatever the copy constructor - of bi_pred might throw. -
    • + Throws: Whatever the copy constructor + of bi_pred might + throw. +
    • -Range Category:Single - Pass Range -
    • + Range Category: Single + Pass Range +
    • -Returned Range Category: The minimum - of the range category of rng - and Forward Range -
    • + Returned Range Category: The minimum + of the range category of rng + and Forward Range +
    -
    +
    adjacent_filtered example @@ -151,7 +152,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference/copied.html b/doc/html/range/reference/adaptors/reference/copied.html index 24b72f1..b690eba 100644 --- a/doc/html/range/reference/adaptors/reference/copied.html +++ b/doc/html/range/reference/adaptors/reference/copied.html @@ -2,8 +2,8 @@ copied - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -78,28 +78,28 @@
    • -Precondition:0 - <= n - && n - <= m - && m - < distance(rng) -
    • + Precondition: 0 + <= n + && n + <= m + && m + < distance(rng) +
    • -Returns: A new iterator_range - that holds the sliced range [n,m) - of the original range. -
    • + Returns: A new iterator_range + that holds the sliced range [n,m) + of the original range. +
    • -Range Category:Random - Access Range -
    • + Range Category: Random + Access Range +
    • -Returned Range Category:Random - Access Range -
    • + Returned Range Category: Random + Access Range +
    -
    +
    copied example @@ -150,7 +150,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference/filtered.html b/doc/html/range/reference/adaptors/reference/filtered.html index 6ce9f3c..1d21ce0 100644 --- a/doc/html/range/reference/adaptors/reference/filtered.html +++ b/doc/html/range/reference/adaptors/reference/filtered.html @@ -2,8 +2,8 @@ filtered - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -76,30 +76,30 @@
    • -Precondition: The value_type - of the range is convertible to the argument type of pred. -
    • + Precondition: The value_type of the range is convertible + to the argument type of pred. +
    • -Postcondition: For all adjacent elements - [x] in the returned range, pred(x) - is true. -
    • + Postcondition: For all adjacent + elements [x] in the returned range, pred(x) + is true. +
    • -Throws: Whatever the copy constructor - of pred might throw. -
    • + Throws: Whatever the copy constructor + of pred might throw. +
    • -Range Category:Forward - Range -
    • + Range Category: Forward + Range +
    • -Returned Range Category: The minimum - of the range category of rng - and Bidirectional - Range -
    • + Returned Range Category: The minimum + of the range category of rng + and Bidirectional + Range +
    -
    +
    filtered example @@ -153,7 +153,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference/indexed.html b/doc/html/range/reference/adaptors/reference/indexed.html index 3ef95df..45bcbef 100644 --- a/doc/html/range/reference/adaptors/reference/indexed.html +++ b/doc/html/range/reference/adaptors/reference/indexed.html @@ -2,8 +2,8 @@ indexed - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -75,23 +75,23 @@
    • -Returns: A range adapted to return - both the element and the associated index. The returned range consists - of iterators that have in addition to the usual iterator member functions - an index() - member function that returns the appropriate index for the element - in the sequence corresponding with the iterator. -
    • + Returns: A range adapted to return + both the element and the associated index. The returned range consists + of iterators that have in addition to the usual iterator member functions + an index() + member function that returns the appropriate index for the element + in the sequence corresponding with the iterator. +
    • -Range Category:Single - Pass Range -
    • + Range Category: Single + Pass Range +
    • -Returned Range Category: The range - category of rng -
    • + Returned Range Category: The range + category of rng +
    -
    +
    indexed example @@ -184,7 +184,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference/indirected.html b/doc/html/range/reference/adaptors/reference/indirected.html index 7dc0558..7360891 100644 --- a/doc/html/range/reference/adaptors/reference/indirected.html +++ b/doc/html/range/reference/adaptors/reference/indirected.html @@ -2,8 +2,8 @@ indirected - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -75,24 +75,27 @@
    • -Precondition: The value_type - of the range defines unary operator*() -
    • + Precondition: The value_type of the range defines + unary operator*() +
    • -Postcondition: For all elements x in the returned range, x is the result of *y - where y is the corresponding - element in the original range. -
    • + Postcondition: For all elements + x in the returned + range, x is the result + of *y + where y is the corresponding + element in the original range. +
    • -Range Category:Single - Pass Range -
    • + Range Category: Single + Pass Range +
    • -Returned Range Category: The range - category of rng -
    • + Returned Range Category: The range + category of rng +
    -
    +
    indirected example @@ -144,7 +147,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference/map_keys.html b/doc/html/range/reference/adaptors/reference/map_keys.html index 6c69774..3b8e621 100644 --- a/doc/html/range/reference/adaptors/reference/map_keys.html +++ b/doc/html/range/reference/adaptors/reference/map_keys.html @@ -2,8 +2,8 @@ map_keys - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -75,23 +75,26 @@
    • -Precondition: The value_type - of the range is an instantiation of std::pair. -
    • + Precondition: The value_type of the range is an instantiation + of std::pair. +
    • -Postcondition: For all elements x in the returned range, x is the result of y.first where y - is the corresponding element in the original range. -
    • + Postcondition: For all elements + x in the returned + range, x is the result + of y.first where y + is the corresponding element in the original range. +
    • -Range Category:Single - Pass Range -
    • + Range Category: Single + Pass Range +
    • -Returned Range Category: The range - category of rng. -
    • + Returned Range Category: The range + category of rng. +
    -
    +
    map_keys example @@ -144,7 +147,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference/map_values.html b/doc/html/range/reference/adaptors/reference/map_values.html index 6a906b2..c55f9ae 100644 --- a/doc/html/range/reference/adaptors/reference/map_values.html +++ b/doc/html/range/reference/adaptors/reference/map_values.html @@ -2,8 +2,8 @@ map_values - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -75,23 +75,26 @@
    • -Precondition: The value_type - of the range is an instantiation of std::pair. -
    • + Precondition: The value_type of the range is an instantiation + of std::pair. +
    • -Postcondition: For all elements x in the returned range, x is the result of y.second where y - is the corresponding element in the original range. -
    • + Postcondition: For all elements + x in the returned + range, x is the result + of y.second where y + is the corresponding element in the original range. +
    • -Range Category:Single - Pass Range -
    • + Range Category: Single + Pass Range +
    • -Returned Range Category: The range - category of rng. -
    • + Returned Range Category: The range + category of rng. +
    -
    +
    map_values example @@ -144,7 +147,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/adaptors/reference/replaced.html b/doc/html/range/reference/adaptors/reference/replaced.html index 3bcfff4..da45959 100644 --- a/doc/html/range/reference/adaptors/reference/replaced.html +++ b/doc/html/range/reference/adaptors/reference/replaced.html @@ -2,8 +2,8 @@ replaced - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -78,37 +78,41 @@
    • -Precondition:
        + Precondition: +
        • -new_value is convertible - to the value_type - of the range. -
        • + new_value is + convertible to the value_type + of the range. +
        • -old_value is convertible - to the value_type - of the range. -
        • + old_value is + convertible to the value_type + of the range. +
        - +
      • -Postcondition: For all elements x in the returned range, the value - x is equal to the value - of (y - == old_value) ? new_value : - y where y - is the corresponding element in the original range. -
      • + Postcondition: For all elements + x in the returned + range, the value x + is equal to the value of (y == + old_value) + ? new_value + : y + where y is the corresponding + element in the original range. +
      • -Range Category:Forward - Range -
      • + Range Category: Forward + Range +
      • -Returned Range Category: The range - category of rng. -
      • + Returned Range Category: The range + category of rng. +
      -
      +
      replaced example @@ -159,7 +163,7 @@
      -PrevUpHomeNext +PrevUpHomeNext
      diff --git a/doc/html/range/reference/adaptors/reference/replaced_if.html b/doc/html/range/reference/adaptors/reference/replaced_if.html index dbd181e..b3b77e3 100644 --- a/doc/html/range/reference/adaptors/reference/replaced_if.html +++ b/doc/html/range/reference/adaptors/reference/replaced_if.html @@ -2,8 +2,8 @@ replaced_if - - + + @@ -13,16 +13,16 @@ - +
      Boost C++ Libraries HomeLibrariesLibraries People FAQ More

      -PrevUpHomeNext +PrevUpHomeNext
      -
      +
      replaced_if @@ -79,36 +79,37 @@
      • -Precondition:
          + Precondition: +
          • - The range value_type - is convertible to the argument type of pred. -
          • + The range value_type + is convertible to the argument type of pred. +
          • -new_value is convertible - to the value_type - of the range. -
          • + new_value is + convertible to the value_type + of the range. +
          - +
        • -Postconditions: For all elements - x in the returned range, - the value x is equal - to the value of pred(y) ? new_value : - y where y - is the corresponding element in the original range. -
        • + Postconditions: For all elements + x in the returned + range, the value x + is equal to the value of pred(y) ? new_value : + y where y + is the corresponding element in the original range. +
        • -Range Category:Forward - Range -
        • + Range Category: Forward + Range +
        • -Returned Range Category: The range - category of rng. -
        • + Returned Range Category: The range + category of rng. +
        -
        +
        replaced_if example @@ -164,7 +165,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/adaptors/reference/reversed.html b/doc/html/range/reference/adaptors/reference/reversed.html index f8d2f26..2b192f9 100644 --- a/doc/html/range/reference/adaptors/reference/reversed.html +++ b/doc/html/range/reference/adaptors/reference/reversed.html @@ -2,8 +2,8 @@ reversed - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -75,19 +75,19 @@
        • -Returns: A range whose iterators behave - as if they were the original iterators wrapped in reverse_iterator. -
        • + Returns: A range whose iterators + behave as if they were the original iterators wrapped in reverse_iterator. +
        • -Range Category:Bidirectional - Range -
        • + Range Category: Bidirectional + Range +
        • -Returned Range Category: The range - category of rng. -
        • + Returned Range Category: The range + category of rng. +
        -
        +
        reversed example @@ -138,7 +138,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/adaptors/reference/sliced.html b/doc/html/range/reference/adaptors/reference/sliced.html index 757aaaf..c0dfed0 100644 --- a/doc/html/range/reference/adaptors/reference/sliced.html +++ b/doc/html/range/reference/adaptors/reference/sliced.html @@ -2,8 +2,8 @@ sliced - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -78,26 +78,26 @@
        -
        +
        sliced example @@ -148,7 +148,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/adaptors/reference/strided.html b/doc/html/range/reference/adaptors/reference/strided.html index b641325..2cbb302 100644 --- a/doc/html/range/reference/adaptors/reference/strided.html +++ b/doc/html/range/reference/adaptors/reference/strided.html @@ -2,8 +2,8 @@ strided - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -76,25 +76,25 @@
        • -Precondition:0 - <= n - && n - < distance(rng) -
        • + Precondition: 0 + <= n + && n + < distance(rng) +
        • -Returns: A new range based on rng where traversal is performed - in steps of n. -
        • + Returns: A new range based on rng where traversal is performed + in steps of n. +
        • -Range Category:Random - Access Range -
        • + Range Category: Random + Access Range +
        • -Returned Range Category:Random - Access Range -
        • + Returned Range Category: Random + Access Range +
        -
        +
        strided example @@ -145,7 +145,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/adaptors/reference/tokenized.html b/doc/html/range/reference/adaptors/reference/tokenized.html index 32f57e6..66e5cd7 100644 --- a/doc/html/range/reference/adaptors/reference/tokenized.html +++ b/doc/html/range/reference/adaptors/reference/tokenized.html @@ -2,8 +2,8 @@ tokenized - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -88,47 +88,50 @@
        • -Precondition:
            + Precondition: +
            • - Let T denote typename range_value<decltype(rng)>::type, - then regex has - the type basic_regex<T> or is implicitly convertible - to one of these types. -
            • + Let T denote + typename range_value<decltype(rng)>::type, + then regex + has the type basic_regex<T> or is implicitly convertible + to one of these types. +
            • -i has the type - int. -
            • + i has the type + int. +
            • - the value_type - of rndRng is int. -
            • + the value_type + of rndRng is + int. +
            • -flags has the type - regex_constants::syntax_option_type. -
            • + flags has the + type regex_constants::syntax_option_type. +
            - +
          • -Returns: A range whose iterators behave - as if they were the original iterators wrapped in regex_token_iterator. - The first iterator in the range would be constructed by forwarding - all the arguments of tokenized() to the regex_token_iterator - constructor. -
          • + Returns: A range whose iterators + behave as if they were the original iterators wrapped in regex_token_iterator. The first + iterator in the range would be constructed by forwarding all the + arguments of tokenized() to the regex_token_iterator + constructor. +
          • -Throws: Whatever constructing and - copying equivalent regex_token_iterators - might throw. -
          • + Throws: Whatever constructing and + copying equivalent regex_token_iterators + might throw. +
          • -Range Category:Random - Access Range -
          • + Range Category: Random + Access Range +
          • -Returned Range Category:Random - Access Range -
          • + Returned Range Category: Random + Access Range +
        @@ -141,7 +144,7 @@

        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/adaptors/reference/transformed.html b/doc/html/range/reference/adaptors/reference/transformed.html index 43b8758..9631986 100644 --- a/doc/html/range/reference/adaptors/reference/transformed.html +++ b/doc/html/range/reference/adaptors/reference/transformed.html @@ -2,8 +2,8 @@ transformed - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        transformed @@ -77,28 +77,31 @@
        • -Precondition: The value_type - of the range is convertible to the argument type of fun. -
        • + Precondition: The value_type of the range is convertible + to the argument type of fun. +
        • -Postcondition: For all elements x in the returned range, x is the result of fun(y) - where y is the corresponding - element in the original range. -
        • + Postcondition: For all elements + x in the returned + range, x is the result + of fun(y) + where y is the corresponding + element in the original range. +
        • -Throws: Whatever the copy-constructor - of fun might throw. -
        • + Throws: Whatever the copy-constructor + of fun might throw. +
        • -Range Category:Single - Pass Range -
        • + Range Category: Single + Pass Range +
        • -Returned Range Category: The range - category of rng. -
        • + Returned Range Category: The range + category of rng. +
        -
        +
        transformed example @@ -155,7 +158,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/adaptors/reference/uniqued.html b/doc/html/range/reference/adaptors/reference/uniqued.html index 65fdc6e..6ab4c59 100644 --- a/doc/html/range/reference/adaptors/reference/uniqued.html +++ b/doc/html/range/reference/adaptors/reference/uniqued.html @@ -2,8 +2,8 @@ uniqued - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -75,24 +75,24 @@
        • -Precondition: The value_type - of the range is comparable with operator==(). -
        • + Precondition: The value_type of the range is comparable + with operator==(). +
        • -Postcondition: For all adjacent elements - [x,y] in the returned range, x==y is false. -
        • + Postcondition: For all adjacent + elements [x,y] in the returned range, x==y is false. +
        • -Range Category:Forward - Range -
        • + Range Category: Forward + Range +
        • -Returned Range Category: The minimum - of the range concept of rng - and Forward Range. -
        • + Returned Range Category: The minimum + of the range concept of rng + and Forward Range. +
        -
        +
        uniqued example @@ -141,7 +141,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms.html b/doc/html/range/reference/algorithms.html index a8b27ff..0bc9f39 100644 --- a/doc/html/range/reference/algorithms.html +++ b/doc/html/range/reference/algorithms.html @@ -2,8 +2,8 @@ Range Algorithm - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -50,7 +50,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/heap.html b/doc/html/range/reference/algorithms/heap.html index c06c707..045ea7b 100644 --- a/doc/html/range/reference/algorithms/heap.html +++ b/doc/html/range/reference/algorithms/heap.html @@ -2,8 +2,8 @@ Heap algorithms - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -43,7 +43,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/heap/make_heap.html b/doc/html/range/reference/algorithms/heap/make_heap.html index a847fc7..ce7157e 100644 --- a/doc/html/range/reference/algorithms/heap/make_heap.html +++ b/doc/html/range/reference/algorithms/heap/make_heap.html @@ -2,8 +2,8 @@ make_heap - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -48,7 +48,7 @@

        - + Description

        @@ -60,14 +60,14 @@ the predicate versions.

        - + Definition

        Defined in the header file boost/range/algorithm/heap_algorithm.hpp

        - + Requirements

        @@ -75,50 +75,50 @@

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -RandomAccessRange's - value type is a model of the LessThanComparableConcept. -
        • + RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
        • - The ordering of objects of type RandomAccessRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
        • + The ordering of objects of type RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

        For the predicate versions:

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -Compare is a model - of the StrictWeakOrderingConcept. -
        • + Compare is a model + of the StrictWeakOrderingConcept. +
        • -RandomAccessRange's - value type is convertible to both of Compare's - argument types. -
        • + RandomAccessRange's + value type is convertible to both of Compare's + argument types. +
        - + Complexity

        @@ -137,7 +137,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/heap/pop_heap.html b/doc/html/range/reference/algorithms/heap/pop_heap.html index 6cf064d..b00c3ac 100644 --- a/doc/html/range/reference/algorithms/heap/pop_heap.html +++ b/doc/html/range/reference/algorithms/heap/pop_heap.html @@ -2,8 +2,8 @@ pop_heap - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -48,7 +48,7 @@

        - + Description

        @@ -62,14 +62,14 @@ the predicate versions.

        - + Definition

        Defined in the header file boost/range/algorithm/heap_algorithm.hpp

        - + Requirements

        @@ -77,60 +77,62 @@

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -RandomAccessRange's - value type is a model of the LessThanComparableConcept. -
        • + RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
        • - The ordering of objects of type RandomAccessRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
        • + The ordering of objects of type RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

        For the predicate versions:

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -Compare is a model - of the StrictWeakOrderingConcept. -
        • + Compare is a model + of the StrictWeakOrderingConcept. +
        • -RandomAccessRange's - value type is convertible to both of Compare's - argument types. -
        • + RandomAccessRange's + value type is convertible to both of Compare's + argument types. +
        - + Precondition:
          -
        • !empty(rng)
        • -rng is a heap. -
        • + !empty(rng) + +
        • + rng is a heap. +
        - + Complexity

        @@ -149,7 +151,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/heap/push_heap.html b/doc/html/range/reference/algorithms/heap/push_heap.html index f4497b6..ece6dbf 100644 --- a/doc/html/range/reference/algorithms/heap/push_heap.html +++ b/doc/html/range/reference/algorithms/heap/push_heap.html @@ -2,8 +2,8 @@ push_heap - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -48,7 +48,7 @@

        - + Description

        @@ -62,14 +62,14 @@ the predicate versions.

        - + Definition

        Defined in the header file boost/range/algorithm/heap_algorithm.hpp

        - + Requirements

        @@ -77,60 +77,62 @@

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -RandomAccessRange's - value type is a model of the LessThanComparableConcept. -
        • + RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
        • - The ordering of objects of type RandomAccessRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
        • + The ordering of objects of type RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

        For the predicate versions:

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -Compare is a model - of the StrictWeakOrderingConcept. -
        • + Compare is a model + of the StrictWeakOrderingConcept. +
        • -RandomAccessRange's - value type is convertible to both of Compare's - argument types. -
        • + RandomAccessRange's + value type is convertible to both of Compare's + argument types. +
        - + Precondition:
          -
        • !empty(rng)
        • -[begin(rng), prior(end(rng))) is a heap. -
        • + !empty(rng) + +
        • + [begin(rng), prior(end(rng))) is a heap. +
        - + Complexity

        @@ -147,7 +149,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/heap/sort_heap.html b/doc/html/range/reference/algorithms/heap/sort_heap.html index c5bb9b3..77a5dab 100644 --- a/doc/html/range/reference/algorithms/heap/sort_heap.html +++ b/doc/html/range/reference/algorithms/heap/sort_heap.html @@ -2,8 +2,8 @@ sort_heap - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -48,7 +48,7 @@

        - + Description

        @@ -61,14 +61,14 @@ the predicate versions.

        - + Definition

        Defined in the header file boost/range/algorithm/heap_algorithm.hpp

        - + Requirements

        @@ -76,57 +76,57 @@

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -RandomAccessRange's - value type is a model of the LessThanComparableConcept. -
        • + RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
        • - The ordering of objects of type RandomAccessRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
        • + The ordering of objects of type RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

        For the predicate versions:

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -Compare is a model - of the StrictWeakOrderingConcept. -
        • + Compare is a model + of the StrictWeakOrderingConcept. +
        • -RandomAccessRange's - value type is convertible to both of Compare's - argument types. -
        • + RandomAccessRange's + value type is convertible to both of Compare's + argument types. +
        - + Precondition:

        rng is a heap.

        - + Complexity

        @@ -146,7 +146,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating.html b/doc/html/range/reference/algorithms/mutating.html index 1990363..7a7d945 100644 --- a/doc/html/range/reference/algorithms/mutating.html +++ b/doc/html/range/reference/algorithms/mutating.html @@ -2,8 +2,8 @@ Mutating algorithms - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -85,7 +85,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/copy.html b/doc/html/range/reference/algorithms/mutating/copy.html index 854c4ac..671e761 100644 --- a/doc/html/range/reference/algorithms/mutating/copy.html +++ b/doc/html/range/reference/algorithms/mutating/copy.html @@ -2,8 +2,8 @@ copy - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -39,7 +39,7 @@

        - + Description

        @@ -50,49 +50,49 @@ distance(source_rng)

        - + Definition

        Defined in the header file boost/range/algorithm/copy.hpp

        - + Requirements
        • -SinglePassRange is - a model of the Single - Pass Range Concept. -
        • + SinglePassRange is + a model of the Single + Pass Range Concept. +
        • -OutputIterator is a - model of the OutputIteratorConcept. -
        • + OutputIterator is + a model of the OutputIteratorConcept. +
        • - The value_type of - Single Pass Range - Concept is convertible to a type in OutputIterator's - set of value types. -
        • + The value_type of + Single Pass Range + Concept is convertible to a type in OutputIterator's + set of value types. +
        - + Precondition:
        • -out_it is not an iterator - within the source_rng. -
        • + out_it is not an + iterator within the source_rng. +
        • -[out_it, out_it - + distance(source_rng)) is a valid range. -
        • + [out_it, out_it + + distance(source_rng)) is a valid range. +
        - + Complexity

        @@ -109,7 +109,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/copy_backward.html b/doc/html/range/reference/algorithms/mutating/copy_backward.html index c1d1266..7c909c1 100644 --- a/doc/html/range/reference/algorithms/mutating/copy_backward.html +++ b/doc/html/range/reference/algorithms/mutating/copy_backward.html @@ -2,8 +2,8 @@ copy_backward - - + + @@ -13,22 +13,22 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -42,7 +42,7 @@

        - + Description

        @@ -60,49 +60,49 @@ denotes the end of the output sequence.

        - + Definition

        Defined in the header file boost/range/algorithm/copy_backward.hpp

        - + Requirements
        • -BidirectionalRange - is a model of Bidirectional - Range Concept. -
        • + BidirectionalRange + is a model of Bidirectional + Range Concept. +
        • -OutputIterator is a - model of the OutputIteratorConcept. -
        • + OutputIterator is + a model of the OutputIteratorConcept. +
        • - The value_type of - Bidirectional Range - Concept is convertible to a type in OutputIterator's - set of value types. -
        • + The value_type of + Bidirectional + Range Concept is convertible to a type in OutputIterator's + set of value types. +
        - + Precondition:
        • -out_it is not an iterator - within the source_rng. -
        • + out_it is not an + iterator within the source_rng. +
        • -[out_it, out_it - + distance(source_rng)) is a valid range. -
        • + [out_it, out_it + + distance(source_rng)) is a valid range. +
        - + Complexity

        @@ -119,7 +119,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/fill.html b/doc/html/range/reference/algorithms/mutating/fill.html index 5f5da38..013fa91 100644 --- a/doc/html/range/reference/algorithms/mutating/fill.html +++ b/doc/html/range/reference/algorithms/mutating/fill.html @@ -2,8 +2,8 @@ fill - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -39,7 +39,7 @@

        - + Description

        @@ -48,37 +48,37 @@ in the range rng.

        - + Definition

        Defined in the header file boost/range/algorithm/fill.hpp

        - + Requirements
        • -ForwardRange is a model - of the Forward Range - Concept. -
        • + ForwardRange is a + model of the Forward + Range Concept. +
        • -ForwardRange is mutable. -
        • + ForwardRange is mutable. +
        • -Value is a model of - the AssignableConcept. -
        • + Value is a model + of the AssignableConcept. +
        • -Value is convertible - to ForwardRange's value - type. -
        • + Value is convertible + to ForwardRange's + value type. +
        - + Complexity

        @@ -95,7 +95,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/fill_n.html b/doc/html/range/reference/algorithms/mutating/fill_n.html index 5d09a06..a37bd29 100644 --- a/doc/html/range/reference/algorithms/mutating/fill_n.html +++ b/doc/html/range/reference/algorithms/mutating/fill_n.html @@ -2,8 +2,8 @@ fill_n - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -39,7 +39,7 @@

        - + Description

        @@ -47,37 +47,37 @@ val to n elements in the range rng begining with boost::begin(rng).

        - + Definition

        Defined in the header file boost/range/algorithm/fill_n.hpp

        - + Requirements
        • -ForwardRange is a model - of the Forward Range - Concept. -
        • + ForwardRange is a + model of the Forward + Range Concept. +
        • -ForwardRange is mutable. -
        • + ForwardRange is mutable. +
        • -Value is a model of - the AssignableConcept. -
        • + Value is a model + of the AssignableConcept. +
        • -Value is convertible - to ForwardRange's value - type. -
        • + Value is convertible + to ForwardRange's + value type. +
        - + Complexity

        @@ -95,7 +95,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/generate.html b/doc/html/range/reference/algorithms/mutating/generate.html index 7bdf2ff..a81fca5 100644 --- a/doc/html/range/reference/algorithms/mutating/generate.html +++ b/doc/html/range/reference/algorithms/mutating/generate.html @@ -2,8 +2,8 @@ generate - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -42,7 +42,7 @@

        - + Description

        @@ -52,52 +52,52 @@ Returns the resultant range.

        - + Definition

        Defined in the header file boost/range/algorithm/generate.hpp

        - + Requirements
        • -ForwardRange is a model - of the Forward Range - Concept. -
        • + ForwardRange is a + model of the Forward + Range Concept. +
        • -ForwardRange is mutable. -
        • + ForwardRange is mutable. +
        • -Generator is a model - of the GeneratorConcept. -
        • + Generator is a model + of the GeneratorConcept. +
        • - The value_type of - SinglePassRange is - convertible to a type in OutputIterator's - set of value types. -
        • + The value_type of + SinglePassRange is + convertible to a type in OutputIterator's + set of value types. +
        - + Precondition:
        • -out_it is not an iterator - within rng. -
        • + out_it is not an + iterator within rng. +
        • -[out_it, out_it - + distance(rng)) is a valid range. -
        • + [out_it, out_it + + distance(rng)) is a valid range. +
        - + Complexity

        @@ -114,7 +114,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/inplace_merge.html b/doc/html/range/reference/algorithms/mutating/inplace_merge.html index 8d4d6c5..b77680d 100644 --- a/doc/html/range/reference/algorithms/mutating/inplace_merge.html +++ b/doc/html/range/reference/algorithms/mutating/inplace_merge.html @@ -2,8 +2,8 @@ inplace_merge - - + + @@ -13,22 +13,22 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -59,7 +59,7 @@

        - + Description

        @@ -72,14 +72,14 @@ input range is preserved.

        - + Definition

        Defined in the header file boost/range/algorithm/inplace_merge.hpp

        - + Requirements

        @@ -87,23 +87,23 @@

        • -BidirectionalRange - is a model of the Bidirectional - Range Concept. -
        • + BidirectionalRange + is a model of the Bidirectional + Range Concept. +
        • -BidirectionalRange - is mutable. -
        • + BidirectionalRange + is mutable. +
        • -range_value<BidirectionalRange>::type is a model of LessThanComparableConcept -
        • + range_value<BidirectionalRange>::type is a model of LessThanComparableConcept +
        • - The ordering on objects of range_type<BidirectionalRange>::type - is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
        • + The ordering on objects of range_type<BidirectionalRange>::type + is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

        For the predicate version: * BidirectionalRange is a model of the @@ -116,55 +116,55 @@ argument types.

        - + Precondition:
        - + For the non-predicate version:
        • -middle is in the range - rng. -
        • + middle is in the + range rng. +
        • -[begin(rng), middle) is in ascending order. That is for - each pair of adjacent elements [x,y], - y < - x is false. -
        • + [begin(rng), middle) is in ascending order. That is for + each pair of adjacent elements [x,y], + y < + x is false. +
        • -[middle, end(rng)) is in ascending order. That is for - each pair of adjacent elements [x,y], - y < - x is false. -
        • + [middle, end(rng)) is in ascending order. That is + for each pair of adjacent elements [x,y], + y < + x is false. +
        - + For the predicate version:
        • -middle is in the range - rng. -
        • + middle is in the + range rng. +
        • -[begin(rng), middle) is in ascending order. That is for - each pair of adjacent elements [x,y], - pred(y,x) == false. -
        • + [begin(rng), middle) is in ascending order. That is for + each pair of adjacent elements [x,y], + pred(y,x) == false. +
        • -[middle, end(rng)) is in ascending order. That is for - each pair of adjacent elements [x,y], - pred(y,x) == false. -
        • + [middle, end(rng)) is in ascending order. That is + for each pair of adjacent elements [x,y], + pred(y,x) == false. +
        - + Complexity

        @@ -181,7 +181,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/merge.html b/doc/html/range/reference/algorithms/mutating/merge.html index d66fc41..7fc40e8 100644 --- a/doc/html/range/reference/algorithms/mutating/merge.html +++ b/doc/html/range/reference/algorithms/mutating/merge.html @@ -2,8 +2,8 @@ merge - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -56,7 +56,7 @@

        - + Description

        @@ -75,14 +75,14 @@ version uses the predicate instead of operator<().

        - + Definition

        Defined in the header file boost/range/algorithm/merge.hpp

        - + Requirements

        @@ -90,137 +90,147 @@

        • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
        • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
        • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
        • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
        • -range_value<SinglePassRange1>::type is the same as range_value<SinglePassRange2>::type. -
        • + range_value<SinglePassRange1>::type is the same as range_value<SinglePassRange2>::type. +
        • -range_value<SinglePassRange1>::type is a model of the LessThanComparableConcept. -
        • + range_value<SinglePassRange1>::type is a model of the LessThanComparableConcept. +
        • - The ordering on objects of range_value<SinglePassRange1>::type - is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
        • + The ordering on objects of range_value<SinglePassRange1>::type + is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
        • -range_value<SinglePassRange1>::type is convertible to a type in - OutputIterator's set - of value types. -
        • + range_value<SinglePassRange1>::type is convertible to a type in + OutputIterator's + set of value types. +

        For the predicate version:

        • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
        • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
        • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
        • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
        • -range_value<SinglePassRange1>::type is the same as range_value<SinglePassRange2>::type. -
        • + range_value<SinglePassRange1>::type is the same as range_value<SinglePassRange2>::type. +
        • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
        • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
        • -SinglePassRange1's - value type is convertible to both BinaryPredicate's - argument types. -
        • + SinglePassRange1's + value type is convertible to both BinaryPredicate's + argument types. +
        • -range_value<SinglePassRange1>::type is convertible to a type in - OutputIterator's set - of value types. -
        • + range_value<SinglePassRange1>::type is convertible to a type in + OutputIterator's + set of value types. +
        - + Precondition:
        - + For the non-predicate version:
        • - The elements of rng1 - are in ascending order. That is, for each adjacent element pair [x,y] of rng1, - y < - x == - false. -
        • + The elements of rng1 + are in ascending order. That is, for each adjacent element pair + [x,y] of rng1, + y < + x == + false. +
        • - The elements of rng2 - are in ascending order. That is, for each adjacent element pair [x,y] of rng2, - y < - x == - false. -
        • + The elements of rng2 + are in ascending order. That is, for each adjacent element pair + [x,y] of rng2, + y < + x == + false. +
        • - The ranges rng1 and - [out, out + distance(rng1) + distance(rng2)) - do not overlap. -
        • + The ranges rng1 and + [out, out + + distance(rng1) + distance(rng2)) + do not overlap. +
        • - The ranges rng2 and - [out, out + distance(rng1) + distance(rng2)) - do not overlap. -
        • + The ranges rng2 and + [out, out + + distance(rng1) + distance(rng2)) + do not overlap. +
        • -[out, out + distance(rng1) + distance(rng2)) - is a valid range. -
        • + [out, out + + distance(rng1) + distance(rng2)) + is a valid range. +
        - + For the predicate version:
        • - The elements of rng1 - are in ascending order. That is, for each adjacent element pair [x,y], of rng1, - pred(y, x) == false. -
        • + The elements of rng1 + are in ascending order. That is, for each adjacent element pair + [x,y], of rng1, + pred(y, x) == false. +
        • - The elements of rng2 - are in ascending order. That is, for each adjacent element pair [x,y], of rng2, - pred(y, x) == false. -
        • + The elements of rng2 + are in ascending order. That is, for each adjacent element pair + [x,y], of rng2, + pred(y, x) == false. +
        • - The ranges rng1 and - [out, out + distance(rng1) + distance(rng2)) - do not overlap. -
        • + The ranges rng1 and + [out, out + + distance(rng1) + distance(rng2)) + do not overlap. +
        • - The ranges rng2 and - [out, out + distance(rng1) + distance(rng2)) - do not overlap. -
        • + The ranges rng2 and + [out, out + + distance(rng1) + distance(rng2)) + do not overlap. +
        • -[out, out + distance(rng1) + distance(rng2)) - is a valid range. -
        • + [out, out + + distance(rng1) + distance(rng2)) + is a valid range. +
        - + Complexity

        @@ -240,7 +250,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/nth_element.html b/doc/html/range/reference/algorithms/mutating/nth_element.html index cd13253..1f3b2ef 100644 --- a/doc/html/range/reference/algorithms/mutating/nth_element.html +++ b/doc/html/range/reference/algorithms/mutating/nth_element.html @@ -2,8 +2,8 @@ nth_element - - + + @@ -13,22 +13,22 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -59,7 +59,7 @@

        - + Description

        @@ -70,14 +70,14 @@ is the same as the element that would be in that position if rng has been sorted.

        - + Definition

        Defined in the header file boost/range/algorithm/nth_element.hpp

        - + Requirements

        @@ -85,50 +85,50 @@

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -RandomAccessRange's - value type is a model of the LessThanComparableConcept. -
        • + RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
        • - The ordering relation on RandomAccessRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
        • + The ordering relation on RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

        For the predicate version:

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
        • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
        • -RandomAccessRange's - value type is convertible to both of BinaryPredicate's - argument types. -
        • + RandomAccessRange's + value type is convertible to both of BinaryPredicate's + argument types. +
        - + Complexity

        @@ -145,7 +145,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/partial_sort.html b/doc/html/range/reference/algorithms/mutating/partial_sort.html index 7938cd3..57faa7d 100644 --- a/doc/html/range/reference/algorithms/mutating/partial_sort.html +++ b/doc/html/range/reference/algorithms/mutating/partial_sort.html @@ -2,8 +2,8 @@ partial_sort - - + + @@ -13,22 +13,22 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -59,7 +59,7 @@

        - + Description

        @@ -75,14 +75,14 @@ predicate instead.

        - + Definition

        Defined in the header file boost/range/algorithm/partial_sort.hpp

        - + Requirements

        @@ -90,50 +90,50 @@

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -RandomAccessRange's - value type is a model of the LessThanComparableConcept. -
        • + RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
        • - The ordering relation on RandomAccessRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
        • + The ordering relation on RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

        For the predicate version:

        • -RandomAccessRange is - a model of the Random - Access Range Concept. -
        • + RandomAccessRange + is a model of the Random + Access Range Concept. +
        • -RandomAccessRange is - mutable. -
        • + RandomAccessRange + is mutable. +
        • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
        • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
        • -RandomAccessRange's - value type is convertible to both of BinaryPredicate's - argument types. -
        • + RandomAccessRange's + value type is convertible to both of BinaryPredicate's + argument types. +
        - + Complexity

        @@ -150,7 +150,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/partition.html b/doc/html/range/reference/algorithms/mutating/partition.html index 79bd88c..597612c 100644 --- a/doc/html/range/reference/algorithms/mutating/partition.html +++ b/doc/html/range/reference/algorithms/mutating/partition.html @@ -2,8 +2,8 @@ partition - - + + @@ -13,21 +13,21 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -66,7 +66,7 @@

        - + Description

        @@ -80,34 +80,34 @@ corresponds to the middle iterator.

        - + Definition

        Defined in the header file boost/range/algorithm/partition.hpp

        - + Requirements
        • -ForwardRange is a model - of the Forward Range - Concept. -
        • + ForwardRange is a + model of the Forward + Range Concept. +
        • -UnaryPredicate is a - model of the PredicateConcept. -
        • + UnaryPredicate is + a model of the PredicateConcept. +
        • -ForwardRange's value - type is convertible to UnaryPredicate's - argument type. -
        • + ForwardRange's value + type is convertible to UnaryPredicate's + argument type. +
        - + Complexity

        @@ -126,7 +126,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/reference/algorithms/mutating/random_shuffle.html b/doc/html/range/reference/algorithms/mutating/random_shuffle.html index d94fc5a..ece4438 100644 --- a/doc/html/range/reference/algorithms/mutating/random_shuffle.html +++ b/doc/html/range/reference/algorithms/mutating/random_shuffle.html @@ -2,8 +2,8 @@ random_shuffle - - + + @@ -13,22 +13,22 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        - + Prototype

        @@ -49,7 +49,7 @@

        - + Description

        @@ -61,54 +61,54 @@ the shuffles range.

        - + Definition

        Defined in the header file boost/range/algorithm/random_shuffle.hpp

        - + Requirements

        For the version without a Generator:

        + RandomAccessRange + is a model of the Random + Access Range Concept. +

      For the version with a Generator:

      • -RandomAccessRange is - a model of the Random - Access Range Concept. -
      • + RandomAccessRange + is a model of the Random + Access Range Concept. +
      • -Generator is a model - of the RandomNumberGeneratorConcept. -
      • + Generator is a model + of the RandomNumberGeneratorConcept. +
      • -RandomAccessRange's - distance type is convertible to Generator's - argument type. -
      • + RandomAccessRange's + distance type is convertible to Generator's + argument type. +
      - + Precondition:
      • -distance(rng) - is less than gen's - maximum value. -
      + distance(rng) + is less than gen's + maximum value. +
    - + Complexity

    @@ -126,7 +126,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/remove.html b/doc/html/range/reference/algorithms/mutating/remove.html index de178ea..58f2b6b 100644 --- a/doc/html/range/reference/algorithms/mutating/remove.html +++ b/doc/html/range/reference/algorithms/mutating/remove.html @@ -2,8 +2,8 @@ remove - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -83,37 +83,37 @@ are dereferenceable, but the elements are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -Value is a model of - the EqualityComparableConcept. -
    • + Value is a model + of the EqualityComparableConcept. +
    • - Objects of type Value - can be compared for equality with objects of ForwardRange's - value type. -
    • + Objects of type Value + can be compared for equality with objects of ForwardRange's + value type. +
    - + Complexity

    @@ -132,7 +132,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/remove_copy.html b/doc/html/range/reference/algorithms/mutating/remove_copy.html index b775716..c948593 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_copy.html +++ b/doc/html/range/reference/algorithms/mutating/remove_copy.html @@ -2,8 +2,8 @@ remove_copy - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -54,37 +54,37 @@ rng for which x == val is false.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_copy.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -Value is a model of - the EqualityComparableConcept. -
    • + Value is a model + of the EqualityComparableConcept. +
    • - Objects of type Value - can be compared for equality with objects of ForwardRange's - value type. -
    • + Objects of type Value + can be compared for equality with objects of ForwardRange's + value type. +
    - + Complexity

    @@ -103,7 +103,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/remove_copy_if.html b/doc/html/range/reference/algorithms/mutating/remove_copy_if.html index 3f25b68..d631aab 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_copy_if.html +++ b/doc/html/range/reference/algorithms/mutating/remove_copy_if.html @@ -2,8 +2,8 @@ remove_copy_if - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -55,32 +55,32 @@ is false.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_copy_if.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -UnaryPred is a model - of the UnaryPredicateConcept. -
    • + UnaryPred is a model + of the UnaryPredicateConcept. +
    - + Complexity

    @@ -98,7 +98,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/remove_if.html b/doc/html/range/reference/algorithms/mutating/remove_if.html index 95a933c..460b087 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_if.html +++ b/doc/html/range/reference/algorithms/mutating/remove_if.html @@ -2,8 +2,8 @@ remove_if - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -82,37 +82,37 @@ are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_if.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -UnaryPredicate is a - model of the PredicateConcept. -
    • + UnaryPredicate is + a model of the PredicateConcept. +
    • -ForwardRange's value - type is convertible to UnaryPredicate's - argument type. -
    • + ForwardRange's value + type is convertible to UnaryPredicate's + argument type. +
    - + Complexity

    @@ -131,7 +131,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/replace.html b/doc/html/range/reference/algorithms/mutating/replace.html index abbffc3..efd4c78 100644 --- a/doc/html/range/reference/algorithms/mutating/replace.html +++ b/doc/html/range/reference/algorithms/mutating/replace.html @@ -2,8 +2,8 @@ replace - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -57,43 +57,43 @@ Return a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -Value is convertible - to ForwardRange's value - type. -
    • + Value is convertible + to ForwardRange's + value type. +
    • -Value is a model of - the AssignableConcept. -
    • + Value is a model + of the AssignableConcept. +
    • -Value is a model of - the EqualityComparableConcept, - and may be compared for equality with objects of ForwardRange's - value type. -
    • + Value is a model + of the EqualityComparableConcept, + and may be compared for equality with objects of ForwardRange's + value type. +
    - + Complexity

    @@ -112,7 +112,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/replace_copy.html b/doc/html/range/reference/algorithms/mutating/replace_copy.html index a5678bd..ccc4e22 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_copy.html +++ b/doc/html/range/reference/algorithms/mutating/replace_copy.html @@ -2,8 +2,8 @@ replace_copy - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -54,41 +54,41 @@ x.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_copy.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -Value is convertible - to ForwardRange's value - type. -
    • + Value is convertible + to ForwardRange's + value type. +
    • -Value is a model of - the AssignableConcept. -
    • + Value is a model + of the AssignableConcept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    - + Complexity

    @@ -106,7 +106,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/replace_copy_if.html b/doc/html/range/reference/algorithms/mutating/replace_copy_if.html index 17607de..60f4f9c 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_copy_if.html +++ b/doc/html/range/reference/algorithms/mutating/replace_copy_if.html @@ -2,8 +2,8 @@ replace_copy_if - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -52,45 +52,45 @@ : x.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_copy_if.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -Value is convertible - to ForwardRange's value - type. -
    • + Value is convertible + to ForwardRange's + value type. +
    • -Value is a model of - the AssignableConcept. -
    • + Value is a model + of the AssignableConcept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -UnaryPredicate is a - model of the UnaryPredicateConcept. -
    • + UnaryPredicate is + a model of the UnaryPredicateConcept. +
    - + Complexity

    @@ -108,7 +108,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/replace_if.html b/doc/html/range/reference/algorithms/mutating/replace_if.html index 110c753..293ae92 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_if.html +++ b/doc/html/range/reference/algorithms/mutating/replace_if.html @@ -2,8 +2,8 @@ replace_if - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,46 +52,46 @@ Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_if.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -UnaryPredicate is a - model of the PredicateConcept -
    • + UnaryPredicate is + a model of the PredicateConcept +
    • -ForwardRange's value - type is convertible to UnaryPredicate's - argument type. -
    • + ForwardRange's value + type is convertible to UnaryPredicate's + argument type. +
    • -Value is convertible - to ForwardRange's value - type. -
    • + Value is convertible + to ForwardRange's + value type. +
    • -Value is a model of - the AssignableConcept. -
    • + Value is a model + of the AssignableConcept. +
    - + Complexity

    @@ -111,7 +111,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/reverse.html b/doc/html/range/reference/algorithms/mutating/reverse.html index 0ae4ef5..253d901 100644 --- a/doc/html/range/reference/algorithms/mutating/reverse.html +++ b/doc/html/range/reference/algorithms/mutating/reverse.html @@ -2,8 +2,8 @@ reverse - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -50,29 +50,29 @@ Returns a reference to the reversed range.

    - + Definition

    Defined in the header file boost/range/algorithm/reverse.hpp

    - + Requirements
    • -BidirectionalRange - is a model of the Bidirectional - Range Concept. -
    • + BidirectionalRange + is a model of the Bidirectional + Range Concept. +
    • -BidirectionalRange - is mutable. -
    • + BidirectionalRange + is mutable. +
    - + Complexity

    @@ -90,7 +90,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/reverse_copy.html b/doc/html/range/reference/algorithms/mutating/reverse_copy.html index 34a4b9a..4795437 100644 --- a/doc/html/range/reference/algorithms/mutating/reverse_copy.html +++ b/doc/html/range/reference/algorithms/mutating/reverse_copy.html @@ -2,8 +2,8 @@ reverse_copy - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -50,33 +50,33 @@ Returns the output iterator one passed the last copied element.

    - + Definition

    Defined in the header file boost/range/algorithm/reverse_copy.hpp

    - + Requirements
    • -BidirectionalRange - is a model of the Bidirectional - Range Concept. -
    • + BidirectionalRange + is a model of the Bidirectional + Range Concept. +
    • -BidirectionalRange - is mutable. -
    • + BidirectionalRange + is mutable. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    - + Complexity

    @@ -95,7 +95,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/rotate.html b/doc/html/range/reference/algorithms/mutating/rotate.html index b0dc3e4..9e7cbb4 100644 --- a/doc/html/range/reference/algorithms/mutating/rotate.html +++ b/doc/html/range/reference/algorithms/mutating/rotate.html @@ -2,8 +2,8 @@ rotate - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,40 +53,40 @@ and [middle, end(rng)). Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/rotate.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    - + Precondition:
    • -[begin(rng), middle) is a valid range. -
    • + [begin(rng), middle) is a valid range. +
    • -[middle, end(rng)) is a valid range. -
    • + [middle, end(rng)) is a valid range. +
    - + Complexity

    @@ -103,7 +103,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/rotate_copy.html b/doc/html/range/reference/algorithms/mutating/rotate_copy.html index 293f540..53643bd 100644 --- a/doc/html/range/reference/algorithms/mutating/rotate_copy.html +++ b/doc/html/range/reference/algorithms/mutating/rotate_copy.html @@ -2,8 +2,8 @@ rotate_copy - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,44 +52,44 @@ and [middle, end(rng)) to out.

    - + Definition

    Defined in the header file boost/range/algorithm/rotate_copy.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    - + Precondition:
    • -[begin(rng), middle) is a valid range. -
    • + [begin(rng), middle) is a valid range. +
    • -[middle, end(rng)) is a valid range. -
    • + [middle, end(rng)) is a valid range. +
    - + Complexity

    @@ -106,7 +106,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/sort.html b/doc/html/range/reference/algorithms/mutating/sort.html index ffa09ad..fa727b8 100644 --- a/doc/html/range/reference/algorithms/mutating/sort.html +++ b/doc/html/range/reference/algorithms/mutating/sort.html @@ -2,8 +2,8 @@ sort - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -71,14 +71,14 @@ [x,y], pred(y, x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/sort.hpp

    - + Requirements

    @@ -86,50 +86,50 @@

    • -RandomAccessRange is - a model of the Random - Access Range Concept. -
    • + RandomAccessRange + is a model of the Random + Access Range Concept. +
    • -RandomAccessRange is - mutable. -
    • + RandomAccessRange + is mutable. +
    • -RandomAccessRange's - value type is a model of the LessThanComparableConcept. -
    • + RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
    • - The ordering relation on RandomAccessRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering relation on RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For versions of sort with a predicate

    • -RandomAccessRange is - a model of the Random - Access Range Concept. -
    • + RandomAccessRange + is a model of the Random + Access Range Concept. +
    • -RandomAccessRange is - mutable. -
    • + RandomAccessRange + is mutable. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -RandomAccessRange's - value type is convertible to both of BinaryPredicate's - argument types. -
    • + RandomAccessRange's + value type is convertible to both of BinaryPredicate's + argument types. +
    - + Complexity

    @@ -147,7 +147,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/stable_partition.html b/doc/html/range/reference/algorithms/mutating/stable_partition.html index c12efc0..59a763d 100644 --- a/doc/html/range/reference/algorithms/mutating/stable_partition.html +++ b/doc/html/range/reference/algorithms/mutating/stable_partition.html @@ -2,8 +2,8 @@ stable_partition - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -61,7 +61,7 @@

    - + Description

    @@ -83,32 +83,32 @@ the iterator to the first element that fails to satisfy pred.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_partition.hpp

    - + Requirements
    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -UnaryPredicate is a - model of the PredicateConcept. -
    • + UnaryPredicate is + a model of the PredicateConcept. +
    - + Complexity

    @@ -129,7 +129,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/stable_sort.html b/doc/html/range/reference/algorithms/mutating/stable_sort.html index 7f4e1a5..8d9a6c0 100644 --- a/doc/html/range/reference/algorithms/mutating/stable_sort.html +++ b/doc/html/range/reference/algorithms/mutating/stable_sort.html @@ -2,8 +2,8 @@ stable_sort - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ [x,y], pred(y,x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_sort.hpp

    - + Requirements

    @@ -87,50 +87,50 @@

    • -RandomAccessRange is - a model of the Random - Access Range Concept. -
    • + RandomAccessRange + is a model of the Random + Access Range Concept. +
    • -RandomAccessRange is - mutable. -
    • + RandomAccessRange + is mutable. +
    • -RandomAccessRange's - value type is a model of the LessThanComparableConcept. -
    • + RandomAccessRange's + value type is a model of the LessThanComparableConcept. +
    • - The ordering relation on RandomAccessRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering relation on RandomAccessRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For versions of stable_sort with a predicate:

    • -RandomAccessRange is - a model of the Random - Access Range Concept. -
    • + RandomAccessRange + is a model of the Random + Access Range Concept. +
    • -RandomAccessRange is - mutable. -
    • + RandomAccessRange + is mutable. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -RandomAccessRange's - value type is convertible to both of BinaryPredicate's - argument types. -
    • + RandomAccessRange's + value type is convertible to both of BinaryPredicate's + argument types. +
    - + Complexity

    @@ -151,7 +151,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/swap_ranges.html b/doc/html/range/reference/algorithms/mutating/swap_ranges.html index a9fc9fa..42e33ce 100644 --- a/doc/html/range/reference/algorithms/mutating/swap_ranges.html +++ b/doc/html/range/reference/algorithms/mutating/swap_ranges.html @@ -2,8 +2,8 @@ swap_ranges - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -50,38 +50,38 @@ Returns a reference to rng2.

    - + Definition

    Defined in the header file boost/range/algorithm/swap_ranges.hpp

    - + Requirements
    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange1 is - mutable. -
    • + SinglePassRange1 + is mutable. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - mutable. -
    • + SinglePassRange2 + is mutable. +
    - + Complexity

    @@ -98,7 +98,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/transform.html b/doc/html/range/reference/algorithms/mutating/transform.html index 9247576..ca1a530 100644 --- a/doc/html/range/reference/algorithms/mutating/transform.html +++ b/doc/html/range/reference/algorithms/mutating/transform.html @@ -2,8 +2,8 @@ transform - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -92,14 +92,14 @@ The return value is out + min(distance(rng1), distance(rng2)).

    - + Definition

    Defined in the header file boost/range/algorithm/transform.hpp

    - + Requirements

    @@ -107,69 +107,69 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -UnaryOperation is a - model of the UnaryFunctionConcept. -
    • + UnaryOperation is + a model of the UnaryFunctionConcept. +
    • -SinglePassRange1's - value type must be convertible to UnaryFunction's - argument type. -
    • + SinglePassRange1's + value type must be convertible to UnaryFunction's + argument type. +
    • -UnaryFunction's result - type must be convertible to a type in OutputIterator's - set of value types. -
    • + UnaryFunction's result + type must be convertible to a type in OutputIterator's + set of value types. +

    For the binary versions of transform:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -BinaryOperation is - a model of the BinaryFunctionConcept. -
    • + BinaryOperation is + a model of the BinaryFunctionConcept. +
    • -SinglePassRange1's - value type must be convertible to BinaryFunction's - first argument type. -
    • + SinglePassRange1's + value type must be convertible to BinaryFunction's + first argument type. +
    • -SinglePassRange2's - value type must be convertible to BinaryFunction's - second argument type. -
    • + SinglePassRange2's + value type must be convertible to BinaryFunction's + second argument type. +
    • -BinaryOperation's result - type must be convertible to a type in OutputIterator's - set of value types. -
    • + BinaryOperation's + result type must be convertible to a type in OutputIterator's + set of value types. +
    - + Precondition:

    @@ -177,31 +177,33 @@

    • -out is not an iterator - within the range [begin(rng1) + 1, end(rng1)). -
    • + out is not an iterator + within the range [begin(rng1) + 1, end(rng1)). +
    • -[out, out + distance(rng1)) is a valid range. -
    • + [out, out + + distance(rng1)) is a valid range. +

    For the binary version of transform:

    • -out is not an iterator - within the range [begin(rng1) + 1, end(rng1)). -
    • + out is not an iterator + within the range [begin(rng1) + 1, end(rng1)). +
    • -out is not an iterator - within the range [begin(rng2) + 1, end(rng2)). -
    • + out is not an iterator + within the range [begin(rng2) + 1, end(rng2)). +
    • -[out, out + min(distance(rng1), distance(rng2))) is a valid range. -
    • + [out, out + + min(distance(rng1), distance(rng2))) is a valid range. +
    - + Complexity

    @@ -219,7 +221,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/unique.html b/doc/html/range/reference/algorithms/mutating/unique.html index 961a44f..7c0c1b8 100644 --- a/doc/html/range/reference/algorithms/mutating/unique.html +++ b/doc/html/range/reference/algorithms/mutating/unique.html @@ -2,8 +2,8 @@ unique - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -68,7 +68,7 @@

    - + Description

    @@ -86,14 +86,14 @@ type.

    - + Definition

    Defined in the header file boost/range/algorithm/unique.hpp

    - + Requirements

    @@ -101,43 +101,43 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -ForwardRange's value - type is a model of the EqualityComparableConcept. -
    • + ForwardRange's value + type is a model of the EqualityComparableConcept. +

    For the predicate versions of unique:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange is mutable. -
    • + ForwardRange is mutable. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -ForwardRange's value - type is convertible to BinaryPredicate's - first argument type and to BinaryPredicate's - second argument type. -
    • + ForwardRange's value + type is convertible to BinaryPredicate's + first argument type and to BinaryPredicate's + second argument type. +
    - + Complexity

    @@ -157,7 +157,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/mutating/unique_copy.html b/doc/html/range/reference/algorithms/mutating/unique_copy.html index e0de9fc..b202b52 100644 --- a/doc/html/range/reference/algorithms/mutating/unique_copy.html +++ b/doc/html/range/reference/algorithms/mutating/unique_copy.html @@ -2,8 +2,8 @@ unique_copy - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -56,14 +56,14 @@ value type.

    - + Definition

    Defined in the header file boost/range/algorithm/unique_copy.hpp

    - + Requirements

    @@ -71,53 +71,53 @@

    • -SinglePassRange is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange is + a model of the Single + Pass Range Concept. +
    • -SinglePassRange is - mutable. -
    • + SinglePassRange is + mutable. +
    • -SinglePassRange's value - type is a model of the EqualityComparableConcept. -
    • + SinglePassRange's + value type is a model of the EqualityComparableConcept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +

    For the predicate versions of unique:

    • -SinglePassRange is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange is + a model of the Single + Pass Range Concept. +
    • -SinglePassRange is - mutable. -
    • + SinglePassRange is + mutable. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -SinglePassRange's value - type is convertible to BinaryPredicate's - first argument type and to BinaryPredicate's - second argument type. -
    • + SinglePassRange's + value type is convertible to BinaryPredicate's + first argument type and to BinaryPredicate's + second argument type. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    - + Complexity

    @@ -137,7 +137,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new.html b/doc/html/range/reference/algorithms/new.html index d07ac11..2fc36d9 100644 --- a/doc/html/range/reference/algorithms/new.html +++ b/doc/html/range/reference/algorithms/new.html @@ -2,8 +2,8 @@ New algorithms - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -51,7 +51,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/copy_n.html b/doc/html/range/reference/algorithms/new/copy_n.html index b84b29e..0a6c5cc 100644 --- a/doc/html/range/reference/algorithms/new/copy_n.html +++ b/doc/html/range/reference/algorithms/new/copy_n.html @@ -2,8 +2,8 @@ copy_n - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -53,33 +53,33 @@ from [boost::begin(rng), boost::begin(rng) + n) to the range [out, out + n)

    - + Definition

    Defined in the header file boost/range/algorithm_ext/copy_n.hpp

    - + Requirements
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -Size is a model of - the Integer Concept. -
    4. + Size is a model of + the Integer Concept. +
    5. -OutputIterator is a - model of the OutputIteratorConcept. -
    6. + OutputIterator is + a model of the OutputIteratorConcept. +
    - + Complexity

    @@ -97,7 +97,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/erase.html b/doc/html/range/reference/algorithms/new/erase.html index 47a5197..346a24e 100644 --- a/doc/html/range/reference/algorithms/new/erase.html +++ b/doc/html/range/reference/algorithms/new/erase.html @@ -2,8 +2,8 @@ erase - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -58,22 +58,22 @@ the frequently used combination equivalent to target.erase(std::remove_if(target.begin(), target.end(), pred), target.end());

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. -Container supports - erase of an iterator range. -
    + Container supports + erase of an iterator range. +
    - + Complexity

    @@ -90,7 +90,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/for_each.html b/doc/html/range/reference/algorithms/new/for_each.html index c9c5db1..8983318 100644 --- a/doc/html/range/reference/algorithms/new/for_each.html +++ b/doc/html/range/reference/algorithms/new/for_each.html @@ -2,8 +2,8 @@ for_each - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -72,7 +72,7 @@

    - + Description

    @@ -88,44 +88,44 @@ It is safe to call this function with unequal length ranges.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/for_each.hpp

    - + Requirements
    1. -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    3. -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    4. + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    5. -BinaryFunction is a - model of the BinaryFunctionConcept. -
    6. + BinaryFunction is + a model of the BinaryFunctionConcept. +
    7. -SinglePassRange1's - value type is convertible to BinaryFunction's - first argument type. -
    8. + SinglePassRange1's + value type is convertible to BinaryFunction's + first argument type. +
    9. -SinglepassRange2's - value type is convertible to BinaryFunction's - second argument type. -
    10. + SinglepassRange2's + value type is convertible to BinaryFunction's + second argument type. +
    - + Complexity

    @@ -143,7 +143,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/insert.html b/doc/html/range/reference/algorithms/new/insert.html index 013ca65..7da8357 100644 --- a/doc/html/range/reference/algorithms/new/insert.html +++ b/doc/html/range/reference/algorithms/new/insert.html @@ -2,8 +2,8 @@ insert - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -54,34 +54,34 @@ target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/insert.hpp

    - + Requirements
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -Container supports - insert at a specified position. -
    4. + Container supports + insert at a specified position. +
    5. -SinglePassRange's value - type is convertible to Container's - value type. -
    6. + SinglePassRange's + value type is convertible to Container's + value type. +
    - + Complexity

    @@ -99,7 +99,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/iota.html b/doc/html/range/reference/algorithms/new/iota.html index 00613b2..8693b0b 100644 --- a/doc/html/range/reference/algorithms/new/iota.html +++ b/doc/html/range/reference/algorithms/new/iota.html @@ -2,8 +2,8 @@ iota - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -50,29 +50,30 @@ + boost::distance(boost::begin(rng), it)

    - + Definition

    Defined in the header file boost/range/algorithm_ext/iota.hpp

    - + Requirements
    1. -ForwardRange is a model - of the Forward Range - Concept. -
    2. + ForwardRange is a + model of the Forward + Range Concept. +
    3. -Value is a model of - the Incrementable Concept. -
    4. + Value is a model + of the Incrementable + Concept. +
    - + Complexity

    @@ -89,7 +90,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/is_sorted.html b/doc/html/range/reference/algorithms/new/is_sorted.html index 167665d..f5a2462 100644 --- a/doc/html/range/reference/algorithms/new/is_sorted.html +++ b/doc/html/range/reference/algorithms/new/is_sorted.html @@ -2,8 +2,8 @@ is_sorted - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -58,34 +58,34 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/is_sorted.hpp

    - + Requirements
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -BinaryPredicate is - a model of the BinaryPredicate - Concept. -
    4. + BinaryPredicate is + a model of the BinaryPredicate + Concept. +
    5. - The value type of SinglePassRange - is convertible to both argument types of BinaryPredicate. -
    6. + The value type of SinglePassRange + is convertible to both argument types of BinaryPredicate. +
    - + Complexity

    @@ -102,7 +102,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/overwrite.html b/doc/html/range/reference/algorithms/new/overwrite.html index 3ef0cfb..6072237 100644 --- a/doc/html/range/reference/algorithms/new/overwrite.html +++ b/doc/html/range/reference/algorithms/new/overwrite.html @@ -2,8 +2,8 @@ overwrite - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,41 +52,43 @@ into the range to.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/overwrite.hpp

    - + Requirements
    1. -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    3. -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    4. + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    5. -SinglePassRange2 is - mutable. -
    6. -
    7. distance(SinglePassRange1) - <= distance(SinglePassRange2)
    8. + SinglePassRange2 + is mutable. +
    9. -SinglePassRange1's - value type is convertible to SinglePassRange2's - value type. -
    10. + distance(SinglePassRange1) + <= distance(SinglePassRange2) + +
    11. + SinglePassRange1's + value type is convertible to SinglePassRange2's + value type. +
    - + Complexity

    @@ -104,7 +106,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/push_back.html b/doc/html/range/reference/algorithms/new/push_back.html index b5a0ff1..ecd5949 100644 --- a/doc/html/range/reference/algorithms/new/push_back.html +++ b/doc/html/range/reference/algorithms/new/push_back.html @@ -2,8 +2,8 @@ push_back - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,34 +52,34 @@ to the back of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_back.hpp

    - + Requirements
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -Container supports - insert at end(). -
    4. + Container supports + insert at end(). +
    5. -SinglePassRange's value - type is convertible to Container's - value type. -
    6. + SinglePassRange's + value type is convertible to Container's + value type. +
    - + Complexity

    @@ -97,7 +97,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/push_front.html b/doc/html/range/reference/algorithms/new/push_front.html index a8b3381..13e2fe4 100644 --- a/doc/html/range/reference/algorithms/new/push_front.html +++ b/doc/html/range/reference/algorithms/new/push_front.html @@ -2,8 +2,8 @@ push_front - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,34 +52,34 @@ to the front of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_front.hpp

    - + Requirements
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -Container supports - insert at begin(). -
    4. + Container supports + insert at begin(). +
    5. -SinglePassRange's value - type is convertible to Container's - value type. -
    6. + SinglePassRange's + value type is convertible to Container's + value type. +
    - + Complexity

    @@ -97,7 +97,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/remove_erase.html b/doc/html/range/reference/algorithms/new/remove_erase.html index 6dd59be..0982bc7 100644 --- a/doc/html/range/reference/algorithms/new/remove_erase.html +++ b/doc/html/range/reference/algorithms/new/remove_erase.html @@ -2,8 +2,8 @@ remove_erase - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -50,22 +50,22 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. -Container supports - erase of an iterator range. -
    + Container supports + erase of an iterator range. +
    - + Complexity

    @@ -82,7 +82,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/new/remove_erase_if.html b/doc/html/range/reference/algorithms/new/remove_erase_if.html index ab20e8f..b9f2d9a 100644 --- a/doc/html/range/reference/algorithms/new/remove_erase_if.html +++ b/doc/html/range/reference/algorithms/new/remove_erase_if.html @@ -2,8 +2,8 @@ remove_erase_if - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -52,28 +52,28 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. -Container supports - erase of an iterator range. -
    2. + Container supports + erase of an iterator range. +
    3. -Pred is a model of - the Predicate Concept. -
    4. + Pred is a model of + the Predicate Concept. +
    - + Complexity

    @@ -90,7 +90,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating.html b/doc/html/range/reference/algorithms/non_mutating.html index f25a857..ef22f2d 100644 --- a/doc/html/range/reference/algorithms/non_mutating.html +++ b/doc/html/range/reference/algorithms/non_mutating.html @@ -2,8 +2,8 @@ Non-mutating algorithms - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    Non-mutating algorithms @@ -75,7 +75,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html b/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html index 4bece6d..c909827 100644 --- a/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html +++ b/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html @@ -2,8 +2,8 @@ adjacent_find - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -77,7 +77,7 @@

    - + Description

    @@ -98,14 +98,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/adjacent_find.hpp

    - + Requirements

    @@ -113,37 +113,37 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange's value - type is a model of the EqualityComparableConcept. -
    • + ForwardRange's value + type is a model of the EqualityComparableConcept. +

    For the predicate versions of adjacent_find:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -ForwardRange's value - type is convertible to BinaryPredicate's - first argument type and to BinaryPredicate's - second argument type. -
    • + ForwardRange's value + type is convertible to BinaryPredicate's + first argument type and to BinaryPredicate's + second argument type. +
    - + Complexity

    @@ -162,7 +162,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/binary_search.html b/doc/html/range/reference/algorithms/non_mutating/binary_search.html index fcbbbbb..96c6476 100644 --- a/doc/html/range/reference/algorithms/non_mutating/binary_search.html +++ b/doc/html/range/reference/algorithms/non_mutating/binary_search.html @@ -2,8 +2,8 @@ binary_search - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -53,14 +53,14 @@ range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/binary_search.hpp

    - + Requirements

    @@ -68,50 +68,50 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -Value is a model of - the LessThanComparableConcept. -
    • + Value is a model + of the LessThanComparableConcept. +
    • - The ordering of objects of type Value - is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type Value + is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • -ForwardRange's value - type is the same type as Value. -
    • + ForwardRange's value + type is the same type as Value. +

    For the predicate versions of binary_search:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -ForwardRange's value - type is the same type as Value. -
    • + ForwardRange's value + type is the same type as Value. +
    • -ForwardRange's value - type is convertible to BinaryPredicate's - argument type. -
    • + ForwardRange's value + type is convertible to BinaryPredicate's + argument type. +
    - + Precondition:

    @@ -129,7 +129,7 @@ order according to the function object pred.

    - + Complexity

    @@ -151,7 +151,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/count.html b/doc/html/range/reference/algorithms/non_mutating/count.html index e1b7195..1360a5c 100644 --- a/doc/html/range/reference/algorithms/non_mutating/count.html +++ b/doc/html/range/reference/algorithms/non_mutating/count.html @@ -2,8 +2,8 @@ count - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -54,37 +54,37 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/count.hpp

    - + Requirements
    • -SinglePassRange is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange is + a model of the Single + Pass Range Concept. +
    • -Value is a model of - the EqualityComparableConcept. -
    • + Value is a model + of the EqualityComparableConcept. +
    • -SinglePassRange's value - type is a model of the EqualityComparableConcept. -
    • + SinglePassRange's + value type is a model of the EqualityComparableConcept. +
    • - An object of SinglePassRange's - value type can be compared for equality with an object of type Value. -
    • + An object of SinglePassRange's + value type can be compared for equality with an object of type Value. +
    - + Complexity

    @@ -101,7 +101,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/count_if.html b/doc/html/range/reference/algorithms/non_mutating/count_if.html index 53b05ad..5e6e850 100644 --- a/doc/html/range/reference/algorithms/non_mutating/count_if.html +++ b/doc/html/range/reference/algorithms/non_mutating/count_if.html @@ -2,8 +2,8 @@ count_if - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -51,37 +51,37 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/count_if.hpp

    - + Requirements
    • -SinglePassRange is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange is + a model of the Single + Pass Range Concept. +
    • -UnaryPredicate is a - model of the UnaryPredicateConcept. -
    • + UnaryPredicate is + a model of the UnaryPredicateConcept. +
    • -SinglePassRange's value - type is a model of the EqualityComparableConcept. -
    • + SinglePassRange's + value type is a model of the EqualityComparableConcept. +
    • - The value type of SinglePassRange - is convertible to the argument type of UnaryPredicate. -
    • + The value type of SinglePassRange + is convertible to the argument type of UnaryPredicate. +
    - + Complexity

    @@ -98,7 +98,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/equal.html b/doc/html/range/reference/algorithms/non_mutating/equal.html index 6f0e022..0556a2a 100644 --- a/doc/html/range/reference/algorithms/non_mutating/equal.html +++ b/doc/html/range/reference/algorithms/non_mutating/equal.html @@ -2,8 +2,8 @@ equal - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -52,7 +52,7 @@

    - + Description

    @@ -70,14 +70,14 @@ considered equal in the predicate version if pred(x,y) is true.

    - + Definition

    Defined in the header file boost/range/algorithm/equal.hpp

    - + Requirements

    @@ -85,60 +85,60 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange1's - value type is a model of the EqualityComparableConcept. -
    • + SinglePassRange1's + value type is a model of the EqualityComparableConcept. +
    • -SinglePassRange2's - value type is a model of the EqualityComparableConcept. -
    • + SinglePassRange2's + value type is a model of the EqualityComparableConcept. +
    • -SinglePassRange1's - value type can be compared for equality with SinglePassRange2's - value type. -
    • + SinglePassRange1's + value type can be compared for equality with SinglePassRange2's + value type. +

    For the predicate versions:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -SinglePassRange2's - value type is convertible to BinaryPredicate's - second argument type. -
    • + SinglePassRange2's + value type is convertible to BinaryPredicate's + second argument type. +
    - + Complexity

    @@ -156,7 +156,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/equal_range.html b/doc/html/range/reference/algorithms/non_mutating/equal_range.html index 7aa0fc1..766ee8a 100644 --- a/doc/html/range/reference/algorithms/non_mutating/equal_range.html +++ b/doc/html/range/reference/algorithms/non_mutating/equal_range.html @@ -2,8 +2,8 @@ equal_range - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -71,7 +71,7 @@

    - + Description

    @@ -85,14 +85,14 @@ is determined by pred.

    - + Definition

    Defined in the header file boost/range/algorithm/equal_range.hpp

    - + Requirements

    @@ -100,50 +100,50 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -Value is a model of - the LessThanComparableConcept. -
    • + Value is a model + of the LessThanComparableConcept. +
    • - The ordering of objects of type Value - is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type Value + is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • -ForwardRange's value - type is the same type as Value. -
    • + ForwardRange's value + type is the same type as Value. +

    For the predicate versions:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -SortPredicate is a - model of the StrictWeakOrderingConcept. -
    • + SortPredicate is + a model of the StrictWeakOrderingConcept. +
    • -ForwardRange's value - type is the same as Value. -
    • + ForwardRange's value + type is the same as Value. +
    • -ForwardRange's value - type is convertible to both of SortPredicate's - argument types. -
    • + ForwardRange's value + type is convertible to both of SortPredicate's + argument types. +
    - + Precondition:

    @@ -155,7 +155,7 @@ is ordered in ascending order according to pred.

    - + Complexity

    @@ -173,7 +173,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/find.html b/doc/html/range/reference/algorithms/non_mutating/find.html index 485e44a..80ac8a1 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find.html +++ b/doc/html/range/reference/algorithms/non_mutating/find.html @@ -2,8 +2,8 @@ find - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -59,35 +59,35 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find.hpp

    - + Requirements
    • -SinglePassRange is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange is + a model of the Single + Pass Range Concept. +
    • -Value is a model of - the EqualityComparableConcept. -
    • + Value is a model + of the EqualityComparableConcept. +
    • - The operator== - is defined for type Value - to be compared with the SinglePassRange's - value type. -
    • + The operator== + is defined for type Value + to be compared with the SinglePassRange's + value type. +
    - + Complexity

    @@ -104,7 +104,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_end.html b/doc/html/range/reference/algorithms/non_mutating/find_end.html index f11bb47..40847b3 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_end.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_end.html @@ -2,8 +2,8 @@ find_end - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -81,14 +81,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_end.hpp

    - + Requirements

    @@ -96,59 +96,59 @@

    • -ForwardRange1 is a - model of the Forward Range - Concept. -
    • + ForwardRange1 is + a model of the Forward + Range Concept. +
    • -ForwardRange2 is a - model of the Forward Range - Concept. -
    • + ForwardRange2 is + a model of the Forward + Range Concept. +
    • -ForwardRange1's value - type is a model of the EqualityComparableConcept. -
    • + ForwardRange1's value + type is a model of the EqualityComparableConcept. +
    • -ForwardRange2's value - type is a model of the EqualityComparableConcept. -
    • + ForwardRange2's value + type is a model of the EqualityComparableConcept. +
    • - Objects of ForwardRange1's - value type can be compared for equality with objects of ForwardRange2's value type. -
    • + Objects of ForwardRange1's + value type can be compared for equality with objects of ForwardRange2's value type. +

    For the predicate versions:

    • -ForwardRange1 is a - model of the Forward Range - Concept. -
    • + ForwardRange1 is + a model of the Forward + Range Concept. +
    • -ForwardRange2 is a - model of the Forward Range - Concept. -
    • + ForwardRange2 is + a model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -ForwardRange1's value - type is convertible to BinaryPredicate's - first argument type. -
    • + ForwardRange1's value + type is convertible to BinaryPredicate's + first argument type. +
    • -ForwardRange2's value - type is convertible to BinaryPredicate's - second argument type. -
    • + ForwardRange2's value + type is convertible to BinaryPredicate's + second argument type. +
    - + Complexity

    @@ -168,7 +168,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_first_of.html b/doc/html/range/reference/algorithms/non_mutating/find_first_of.html index 972690f..ab764df 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_first_of.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_first_of.html @@ -2,8 +2,8 @@ find_first_of - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -86,14 +86,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_first_of.hpp

    - + Requirements

    @@ -101,53 +101,53 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -ForwardRange2 is a - model of the Forward Range - Concept. -
    • + ForwardRange2 is + a model of the Forward + Range Concept. +
    • -SinglePassRange1's - value type is a model of the EqualityComparableConcept, - and can be compared for equality with ForwardRange2's - value type. -
    • + SinglePassRange1's + value type is a model of the EqualityComparableConcept, + and can be compared for equality with ForwardRange2's + value type. +

    For the predicate versions:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -ForwardRange2 is a - model of the Forward Range - Concept. -
    • + ForwardRange2 is + a model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -ForwardRange2's value - type is convertible to BinaryPredicate's - second argument type. -
    • + ForwardRange2's value + type is convertible to BinaryPredicate's + second argument type. +
    - + Complexity

    @@ -164,7 +164,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_if.html b/doc/html/range/reference/algorithms/non_mutating/find_if.html index 59ab8d3..caa16d2 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_if.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_if.html @@ -2,8 +2,8 @@ find_if - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -64,33 +64,33 @@ defines found in the same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_if.hpp

    - + Requirements
    • -SinglePassRange is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange is + a model of the Single + Pass Range Concept. +
    • -UnaryPredicate is a - model of the PredicateConcept. -
    • + UnaryPredicate is + a model of the PredicateConcept. +
    • - The value type of SinglePassRange - is convertible to the argument type of UnaryPredicate. -
    • + The value type of SinglePassRange + is convertible to the argument type of UnaryPredicate. +
    - + Precondition:

    @@ -98,7 +98,7 @@ rng, *i is in the domain of UnaryPredicate.

    - + Complexity

    @@ -115,7 +115,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/for_each.html b/doc/html/range/reference/algorithms/non_mutating/for_each.html index 7d8792f..c8584f7 100644 --- a/doc/html/range/reference/algorithms/non_mutating/for_each.html +++ b/doc/html/range/reference/algorithms/non_mutating/for_each.html @@ -2,8 +2,8 @@ for_each - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -59,38 +59,38 @@ fun(x).

    - + Definition

    Defined in the header file boost/range/algorithm/for_each.hpp

    - + Requirements
    • -SinglePassRange is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange is + a model of the Single + Pass Range Concept. +
    • -UnaryFunction is a - model of the UnaryFunctionConcept. -
    • + UnaryFunction is + a model of the UnaryFunctionConcept. +
    • -UnaryFunction does - not apply any non-constant operation through its argument. -
    • + UnaryFunction does + not apply any non-constant operation through its argument. +
    • -SinglePassRange's value - type is convertible to UnaryFunction's - argument type. -
    • + SinglePassRange's + value type is convertible to UnaryFunction's + argument type. +
    - + Complexity

    @@ -107,7 +107,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html b/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html index e3e37ef..257ab7b 100644 --- a/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html +++ b/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html @@ -2,8 +2,8 @@ lexicographical_compare - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -73,14 +73,14 @@ predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/lexicographical_compare.hpp

    - + Requirements

    @@ -88,64 +88,64 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange1's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange1's + value type is a model of the LessThanComparableConcept. +
    • -SinglePassRange2's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange2's + value type is a model of the LessThanComparableConcept. +
    • - Let x be an object - of SinglePassRange1's - value type. Let y be - an obect of SinglePassRange2's - value type. x < - y must be valid. y < - x must be valid. -
    • + Let x be an object + of SinglePassRange1's + value type. Let y + be an obect of SinglePassRange2's + value type. x < + y must be valid. y < + x must be valid. +

    For the predicate versions of lexicographical_compare:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -SinglePassRange2's - value type is convertible to BinaryPredicate's - second argument type. -
    • + SinglePassRange2's + value type is convertible to BinaryPredicate's + second argument type. +
    - + Complexity

    @@ -164,7 +164,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/lower_bound.html b/doc/html/range/reference/algorithms/non_mutating/lower_bound.html index f18a5bc..0f92df5 100644 --- a/doc/html/range/reference/algorithms/non_mutating/lower_bound.html +++ b/doc/html/range/reference/algorithms/non_mutating/lower_bound.html @@ -2,8 +2,8 @@ lower_bound - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/lower_bound.hpp

    - + Requirements

    @@ -87,50 +87,50 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -Value is a model of - the LessThanComparableConcept. -
    • + Value is a model + of the LessThanComparableConcept. +
    • - The ordering of objects of type Value - is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type Value + is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • -ForwardRange's value - type is the same type as Value. -
    • + ForwardRange's value + type is the same type as Value. +

    For the predicate versions:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -ForwardRange's value - type is the same type as Value. -
    • + ForwardRange's value + type is the same type as Value. +
    • -ForwardRange's value - type is convertible to both of BinaryPredicate's - argument types. -
    • + ForwardRange's value + type is convertible to both of BinaryPredicate's + argument types. +
    - + Precondition:

    @@ -148,7 +148,7 @@ order according to pred.

    - + Complexity

    @@ -170,7 +170,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/max_element.html b/doc/html/range/reference/algorithms/non_mutating/max_element.html index 9216f88..173b281 100644 --- a/doc/html/range/reference/algorithms/non_mutating/max_element.html +++ b/doc/html/range/reference/algorithms/non_mutating/max_element.html @@ -2,8 +2,8 @@ max_element - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -84,7 +84,7 @@

    - + Description

    @@ -98,14 +98,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/max_element.hpp

    - + Requirements

    @@ -113,36 +113,36 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange's value - type is a model of the LessThanComparableConcept. -
    • + ForwardRange's value + type is a model of the LessThanComparableConcept. +

    For the predicate versions:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -ForwardRange's value - type is convertible to both of BinaryPredicate's - argument types. -
    • + ForwardRange's value + type is convertible to both of BinaryPredicate's + argument types. +
    - + Complexity

    @@ -160,7 +160,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/min_element.html b/doc/html/range/reference/algorithms/non_mutating/min_element.html index 4abd6a8..14f7973 100644 --- a/doc/html/range/reference/algorithms/non_mutating/min_element.html +++ b/doc/html/range/reference/algorithms/non_mutating/min_element.html @@ -2,8 +2,8 @@ min_element - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -84,7 +84,7 @@

    - + Description

    @@ -98,14 +98,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/min_element.hpp

    - + Requirements

    @@ -113,36 +113,36 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange's value - type is a model of the LessThanComparableConcept. -
    • + ForwardRange's value + type is a model of the LessThanComparableConcept. +

    For the predicate versions:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -ForwardRange's value - type is convertible to both of BinaryPredicate's - argument types. -
    • + ForwardRange's value + type is convertible to both of BinaryPredicate's + argument types. +
    - + Complexity

    @@ -160,7 +160,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/mismatch.html b/doc/html/range/reference/algorithms/non_mutating/mismatch.html index d740dce..0ae3639 100644 --- a/doc/html/range/reference/algorithms/non_mutating/mismatch.html +++ b/doc/html/range/reference/algorithms/non_mutating/mismatch.html @@ -2,8 +2,8 @@ mismatch - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -106,7 +106,7 @@

    - + Description

    @@ -118,14 +118,14 @@ Equality is determined by operator== for non-predicate versions of mismatch, and by satisfying pred in the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/mismatch.hpp

    - + Requirements

    @@ -133,67 +133,67 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange1's - value type is a model of the EqualityComparableConcept. -
    • + SinglePassRange1's + value type is a model of the EqualityComparableConcept. +
    • -SinglePassRange2's - value type is a model of the EqualityComparableConcept. -
    • + SinglePassRange2's + value type is a model of the EqualityComparableConcept. +
    • -SinglePassRange1s value - type can be compared for equality with SinglePassRange2's - value type. -
    • + SinglePassRange1s + value type can be compared for equality with SinglePassRange2's + value type. +

    For the predicate versions:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -SinglePassRange2's - value type is convertible to BinaryPredicate's - second argument type. -
    • + SinglePassRange2's + value type is convertible to BinaryPredicate's + second argument type. +
    - + Precondition:

    distance(rng2) >= distance(rng1)

    - + Complexity

    @@ -210,7 +210,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/search.html b/doc/html/range/reference/algorithms/non_mutating/search.html index 9746802..9c4f86a 100644 --- a/doc/html/range/reference/algorithms/non_mutating/search.html +++ b/doc/html/range/reference/algorithms/non_mutating/search.html @@ -2,8 +2,8 @@ search - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -96,7 +96,7 @@

    - + Description

    @@ -115,14 +115,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/search.hpp

    - + Requirements

    @@ -130,60 +130,60 @@

    • -ForwardRange1 is a - model of the Forward Range - Concept. -
    • + ForwardRange1 is + a model of the Forward + Range Concept. +
    • -ForwardRange2 is a - model of the Forward Range - Concept. -
    • + ForwardRange2 is + a model of the Forward + Range Concept. +
    • -ForwardRange1's value - type is a model of the EqualityComparableConcept. -
    • + ForwardRange1's value + type is a model of the EqualityComparableConcept. +
    • -ForwardRange2's value - type is a model of the EqualityComparableConcept. -
    • + ForwardRange2's value + type is a model of the EqualityComparableConcept. +
    • -ForwardRange1s value - type can be compared for equality with ForwardRange2's - value type. -
    • + ForwardRange1s value + type can be compared for equality with ForwardRange2's + value type. +

    For the predicate versions:

    • -ForwardRange1 is a - model of the Forward Range - Concept. -
    • + ForwardRange1 is + a model of the Forward + Range Concept. +
    • -ForwardRange2 is a - model of the Forward Range - Concept. -
    • + ForwardRange2 is + a model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -ForwardRange1's value - type is convertible to BinaryPredicate's - first argument type. -
    • + ForwardRange1's value + type is convertible to BinaryPredicate's + first argument type. +
    • -ForwardRange2's value - type is convertible to BinaryPredicate's - second argument type. -
    • + ForwardRange2's value + type is convertible to BinaryPredicate's + second argument type. +
    - + Complexity

    @@ -200,7 +200,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/search_n.html b/doc/html/range/reference/algorithms/non_mutating/search_n.html index 2b94b7f..1961ecf 100644 --- a/doc/html/range/reference/algorithms/non_mutating/search_n.html +++ b/doc/html/range/reference/algorithms/non_mutating/search_n.html @@ -2,8 +2,8 @@ search_n - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -55,7 +55,7 @@

    - + Description

    @@ -64,14 +64,14 @@ and by a predicate when one is supplied.

    - + Definition

    Defined in the header file boost/range/algorithm/search_n.hpp

    - + Requirements

    @@ -79,53 +79,53 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -ForwardRange's value - type is a model of the EqualityComparableConcept. -
    • + ForwardRange's value + type is a model of the EqualityComparableConcept. +
    • -ForwardRanges value - type can be compared for equality with Value. -
    • + ForwardRanges value + type can be compared for equality with Value. +
    • -Integer is a model - of the IntegerConcept. -
    • + Integer is a model + of the IntegerConcept. +

    For the predicate versions:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the BinaryPredicateConcept. -
    • + BinaryPredicate is + a model of the BinaryPredicateConcept. +
    • -ForwardRange's value - type is convertible to BinaryPredicate's - first argument type. -
    • + ForwardRange's value + type is convertible to BinaryPredicate's + first argument type. +
    • -Value is convertible - to BinaryPredicate's - second argument type. -
    • + Value is convertible + to BinaryPredicate's + second argument type. +
    • -Integer is a model - of the IntegerConcept. -
    • + Integer is a model + of the IntegerConcept. +
    - + Complexity

    @@ -142,7 +142,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/non_mutating/upper_bound.html b/doc/html/range/reference/algorithms/non_mutating/upper_bound.html index 1bf73d6..0ef9e03 100644 --- a/doc/html/range/reference/algorithms/non_mutating/upper_bound.html +++ b/doc/html/range/reference/algorithms/non_mutating/upper_bound.html @@ -2,8 +2,8 @@ upper_bound - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -71,14 +71,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/upper_bound.hpp

    - + Requirements

    @@ -86,50 +86,50 @@

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -Value is a model of - the LessThanComparableConcept. -
    • + Value is a model + of the LessThanComparableConcept. +
    • - The ordering of objects of type Value - is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type Value + is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • -ForwardRange's value - type is the same type as Value. -
    • + ForwardRange's value + type is the same type as Value. +

    For the predicate versions:

    • -ForwardRange is a model - of the Forward Range - Concept. -
    • + ForwardRange is a + model of the Forward + Range Concept. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -ForwardRange's value - type is the same type as Value. -
    • + ForwardRange's value + type is the same type as Value. +
    • -ForwardRange's value - type is convertible to both of BinaryPredicate's - argument types. -
    • + ForwardRange's value + type is convertible to both of BinaryPredicate's + argument types. +
    - + Precondition:

    @@ -147,7 +147,7 @@ order according to pred.

    - + Complexity

    @@ -167,7 +167,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/numeric.html b/doc/html/range/reference/algorithms/numeric.html index 90818fa..99b3631 100644 --- a/doc/html/range/reference/algorithms/numeric.html +++ b/doc/html/range/reference/algorithms/numeric.html @@ -2,8 +2,8 @@ Numeric algorithms - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -46,7 +46,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/numeric/accumulate.html b/doc/html/range/reference/algorithms/numeric/accumulate.html index 4ba0962..6ea2097 100644 --- a/doc/html/range/reference/algorithms/numeric/accumulate.html +++ b/doc/html/range/reference/algorithms/numeric/accumulate.html @@ -2,8 +2,8 @@ accumulate - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -52,7 +52,7 @@

    - + Description

    @@ -63,77 +63,77 @@ The return value is the resultant value of the above algorithm.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -Value is a model of - the AssignableConcept. -
    4. + Value is a model + of the AssignableConcept. +
    5. - An operator+ - is defined for a left-hand operand of type Value - and a right-hand operance of the SinglePassRange - value type. -
    6. + An operator+ + is defined for a left-hand operand of type Value + and a right-hand operance of the SinglePassRange + value type. +
    7. - The return type of the above operator is convertible to Value. -
    8. + The return type of the above operator is convertible to Value. +
    - + For the second version
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -Value is a model of - the AssignableConcept. -
    4. + Value is a model + of the AssignableConcept. +
    5. -BinaryOperation is - a model of the BinaryFunctionConcept. -
    6. + BinaryOperation is + a model of the BinaryFunctionConcept. +
    7. -Value is convertible - to BinaryOperation's - first argument type. -
    8. + Value is convertible + to BinaryOperation's + first argument type. +
    9. -SinglePassRange's value - type is convertible to BinaryOperation's - second argument type. -
    10. + SinglePassRange's + value type is convertible to BinaryOperation's + second argument type. +
    11. - The return type of BinaryOperation - is convertible to Value. -
    12. + The return type of BinaryOperation + is convertible to Value. +
    - + Complexity

    @@ -150,7 +150,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/numeric/adjacent_difference.html b/doc/html/range/reference/algorithms/numeric/adjacent_difference.html index 5dff5f8..57d2bf8 100644 --- a/doc/html/range/reference/algorithms/numeric/adjacent_difference.html +++ b/doc/html/range/reference/algorithms/numeric/adjacent_difference.html @@ -2,8 +2,8 @@ adjacent_difference - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -55,7 +55,7 @@

    - + Description

    @@ -69,84 +69,84 @@ instead of operator-().

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -OutputIterator is a - model of the OutputIteratorConcept. -
    4. + OutputIterator is + a model of the OutputIteratorConcept. +
    5. - If x and y are objects of SinglePassRange's - value type, then x - y - is defined. -
    6. + If x and y are objects of SinglePassRange's value type, then + x - + y is defined. +
    7. - The value type of SinglePassRange - is convertible to a type in OutputIterator's - set of value types. -
    8. + The value type of SinglePassRange + is convertible to a type in OutputIterator's + set of value types. +
    9. - The return type of x - y - is convertible to a type in OutputIterator's - set of value types. -
    10. + The return type of x - y + is convertible to a type in OutputIterator's + set of value types. +
    - + For the second version
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -OutputIterator is a - model of the OutputIteratorConcept. -
    4. + OutputIterator is + a model of the OutputIteratorConcept. +
    5. -BinaryOperation is - a model of the BinaryFunctionConcept. -
    6. + BinaryOperation is + a model of the BinaryFunctionConcept. +
    7. - The value type of SinglePassRange - is convertible to BinaryOperation's - first and second argument types. -
    8. + The value type of SinglePassRange + is convertible to BinaryOperation's + first and second argument types. +
    9. - The value type of SinglePassRange - is convertible to a type in OutputIterator's - set of value types. -
    10. + The value type of SinglePassRange + is convertible to a type in OutputIterator's + set of value types. +
    11. - The result type of BinaryOperation - is convertible to a type in OutputIterator's - set of value types. -
    12. + The result type of BinaryOperation + is convertible to a type in OutputIterator's + set of value types. +
    - + Precondition:

    @@ -154,7 +154,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    @@ -173,7 +173,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/numeric/inner_product.html b/doc/html/range/reference/algorithms/numeric/inner_product.html index 7872880..76a07fc 100644 --- a/doc/html/range/reference/algorithms/numeric/inner_product.html +++ b/doc/html/range/reference/algorithms/numeric/inner_product.html @@ -2,8 +2,8 @@ inner_product - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -54,7 +54,7 @@

    - + Description

    @@ -67,109 +67,109 @@ algorithm please see inner_product.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    1. -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    3. -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    4. + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    5. -Value is a model of - the AssignableConcept. -
    6. + Value is a model + of the AssignableConcept. +
    7. - If x is an object of - type Value, y is an object of SinglePassRange1's - value type, and z is - an object of SinglePassRange2's - value type, then x + y * z - is defined. -
    8. + If x is an object + of type Value, y is an object of SinglePassRange1's value type, + and z is an object + of SinglePassRange2's + value type, then x + y * z + is defined. +
    9. - The result type of the expression x - + y - * z - is convertible to Value. -
    10. + The result type of the expression x + + y + * z + is convertible to Value. +
    - + For the second version
    1. -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    3. -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    4. + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    5. -Value is a model of - the AssignableConcept. -
    6. + Value is a model + of the AssignableConcept. +
    7. -BinaryOperation1 is - a model of the BinaryFunctionConcept. -
    8. + BinaryOperation1 + is a model of the BinaryFunctionConcept. +
    9. -BinaryOperation2 is - a model of the BinaryFunctionConcept. -
    10. + BinaryOperation2 + is a model of the BinaryFunctionConcept. +
    11. - The value type of SinglePassRange1 - is convertible to the first argument type of BinaryOperation2. -
    12. + The value type of SinglePassRange1 + is convertible to the first argument type of BinaryOperation2. +
    13. - The value type of SinglePassRange2 - is convertible to the second argument type of BinaryOperation2. -
    14. + The value type of SinglePassRange2 + is convertible to the second argument type of BinaryOperation2. +
    15. -Value is convertible - to the value type of BinaryOperation1. -
    16. + Value is convertible + to the value type of BinaryOperation1. +
    17. - The return type of BinaryOperation2 - is convertible to the second argument type of BinaryOperation1. -
    18. + The return type of BinaryOperation2 + is convertible to the second argument type of BinaryOperation1. +
    19. - The return type of BinaryOperation1 - is convertible to Value. -
    20. + The return type of BinaryOperation1 + is convertible to Value. +
    - + Precondition:

    distance(rng2) >= distance(rng1) is a valid range.

    - + Complexity

    @@ -186,7 +186,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/numeric/partial_sum.html b/doc/html/range/reference/algorithms/numeric/partial_sum.html index cddd838..0967f12 100644 --- a/doc/html/range/reference/algorithms/numeric/partial_sum.html +++ b/doc/html/range/reference/algorithms/numeric/partial_sum.html @@ -2,8 +2,8 @@ partial_sum - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -58,77 +58,77 @@ in the same manner as std::partial_sum(boost::begin(rng), boost::end(rng), out_it). See partial_sum.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -OutputIterator is a - model of the OutputIteratorConcept. -
    4. + OutputIterator is + a model of the OutputIteratorConcept. +
    5. - If x and y are objects of SinglePassRange's - value type, then x + y - is defined. -
    6. + If x and y are objects of SinglePassRange's value type, then + x + + y is defined. +
    7. - The return type of x + y - is convertible to the value type of SinglePassRange. -
    8. + The return type of x + y + is convertible to the value type of SinglePassRange. +
    9. - The value type of SinglePassRange - is convertible to a type in OutputIterator's - set of value types. -
    10. + The value type of SinglePassRange + is convertible to a type in OutputIterator's + set of value types. +
    - + For the second version
    1. -SinglePassRange is - a model of the Single - Pass Range Concept. -
    2. + SinglePassRange is + a model of the Single + Pass Range Concept. +
    3. -OutputIterator is a - model of the OutputIteratorConcept. -
    4. + OutputIterator is + a model of the OutputIteratorConcept. +
    5. -BinaryOperation is - a model of the BinaryFunctionConcept. -
    6. + BinaryOperation is + a model of the BinaryFunctionConcept. +
    7. - The result type of BinaryOperation - is convertible to the value type of SinglePassRange. -
    8. + The result type of BinaryOperation + is convertible to the value type of SinglePassRange. +
    9. - The value type of SinglePassRange - is convertible to a type in OutputIterator's - set of value types. -
    10. + The value type of SinglePassRange + is convertible to a type in OutputIterator's + set of value types. +
    - + Precondition:

    @@ -136,7 +136,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    @@ -155,7 +155,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/permutation.html b/doc/html/range/reference/algorithms/permutation.html index c859468..cf2da0e 100644 --- a/doc/html/range/reference/algorithms/permutation.html +++ b/doc/html/range/reference/algorithms/permutation.html @@ -2,8 +2,8 @@ Permutation algorithms - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    Permutation algorithms @@ -44,7 +44,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/permutation/next_permutation.html b/doc/html/range/reference/algorithms/permutation/next_permutation.html index 3f23383..c7533d7 100644 --- a/doc/html/range/reference/algorithms/permutation/next_permutation.html +++ b/doc/html/range/reference/algorithms/permutation/next_permutation.html @@ -2,8 +2,8 @@ next_permutation - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -67,14 +67,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -82,50 +82,50 @@

    • -BidirectionalRange - is a model of the Bidirectional - Range Concept. -
    • + BidirectionalRange + is a model of the Bidirectional + Range Concept. +
    • -BidirectionalRange - is mutable. -
    • + BidirectionalRange + is mutable. +
    • -BidirectionalRange's - value type is a model of the LessThanComparableConcept. -
    • + BidirectionalRange's + value type is a model of the LessThanComparableConcept. +
    • - The ordering of objects of type BidirectionalRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type BidirectionalRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For the predicate versions:

    • -BidirectionalRange - is a model of the Bidirectional - Range Concept. -
    • + BidirectionalRange + is a model of the Bidirectional + Range Concept. +
    • -BidirectionalRange - is mutable. -
    • + BidirectionalRange + is mutable. +
    • -Compare is a model - of the StrictWeakOrderingConcept. -
    • + Compare is a model + of the StrictWeakOrderingConcept. +
    • -BidirectionalRange's - value type is convertible to both of Compare's - argument types. -
    • + BidirectionalRange's + value type is convertible to both of Compare's + argument types. +
    - + Complexity

    @@ -143,7 +143,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/permutation/prev_permutation.html b/doc/html/range/reference/algorithms/permutation/prev_permutation.html index 3cb4d46..090c6c0 100644 --- a/doc/html/range/reference/algorithms/permutation/prev_permutation.html +++ b/doc/html/range/reference/algorithms/permutation/prev_permutation.html @@ -2,8 +2,8 @@ prev_permutation - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -67,14 +67,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -82,50 +82,50 @@

    • -BidirectionalRange - is a model of the Bidirectional - Range Concept. -
    • + BidirectionalRange + is a model of the Bidirectional + Range Concept. +
    • -BidirectionalRange - is mutable. -
    • + BidirectionalRange + is mutable. +
    • -BidirectionalRange's - value type is a model of the LessThanComparableConcept. -
    • + BidirectionalRange's + value type is a model of the LessThanComparableConcept. +
    • - The ordering of objects of type BidirectionalRange's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type BidirectionalRange's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For the predicate versions:

    • -BidirectionalRange - is a model of the Bidirectional - Range Concept. -
    • + BidirectionalRange + is a model of the Bidirectional + Range Concept. +
    • -BidirectionalRange - is mutable. -
    • + BidirectionalRange + is mutable. +
    • -Compare is a model - of the StrictWeakOrderingConcept. -
    • + Compare is a model + of the StrictWeakOrderingConcept. +
    • -BidirectionalRange's - value type is convertible to both of Compare's - argument types. -
    • + BidirectionalRange's + value type is convertible to both of Compare's + argument types. +
    - + Complexity

    @@ -143,7 +143,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/range_algorithm_introduction.html b/doc/html/range/reference/algorithms/range_algorithm_introduction.html new file mode 100644 index 0000000..36667b3 --- /dev/null +++ b/doc/html/range/reference/algorithms/range_algorithm_introduction.html @@ -0,0 +1,257 @@ + + + +Introduction and motivation + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +

    + In its most simple form a Range Algorithm + (or range-based algorithm) is simply an iterator-based algorithm where + the two iterator arguments have been replaced by + one range argument. For example, we may write +

    +

    + +

    +
    #include <boost/range/algorithm.hpp>
    +#include <vector>
    +
    +std::vector<int> vec = ...;
    +boost::sort(vec);
    +
    +

    +

    +

    + instead of +

    +

    + +

    +
    std::sort(vec.begin(), vec.end());
    +
    +

    +

    +

    + However, the return type of range algorithms is almost always different + from that of existing iterator-based algorithms. +

    +

    + One group of algorithms, like boost::sort(), will simply return the same range so + that we can continue to pass the range around and/or further modify it. + Because of this we may write +

    +
    boost:unique(boost::sort(vec));
    +
    +

    + to first sort the range and then run unique() on the sorted range. +

    +

    + Algorithms like boost::unique() + fall into another group of algorithms that return (potentially) narrowed + views of the original range. By default boost::unique(rng) returns the range [boost::begin(rng), found) + where found denotes the + iterator returned by std::unique(boost::begin(rng), boost::end(rng)) +

    +

    + Therefore exactly the unique values can be copied by writing +

    +
    boost::copy(boost::unique(boost::sort(vec)),
    +            std::ostream_iterator<int>(std::cout));
    +
    +

    +

    +

    + Algorithms like boost::unique usually return the same range: + [boost::begin(rng), found). However, this behaviour may be changed + by supplying the algorithms with a template argument: +

    +
    ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    + Expression +

    +
    +

    + Return +

    +
    +

    + boost::unique<boost::return_found>(rng) +

    +
    +

    + returns a single iterator like std::unique +

    +
    +

    + boost::unique<boost::return_begin_found>(rng) +

    +
    +

    + returns the range [boost::begin(rng), + found) + (this is the default) +

    +
    +

    + boost::unique<boost::return_begin_next>(rng) +

    +
    +

    + returns the range [boost::begin(rng), + boost::next(found)) +

    +
    +

    + boost::unique<boost::return_found_end>(rng) +

    +
    +

    + returns the range [found, + boost::end(rng)) +

    +
    +

    + boost::unique<boost::return_next_end>(rng) +

    +
    +

    + returns the range [boost::next(found),boost::end(rng)) +

    +
    +

    + boost::unique<boost::return_begin_end>(rng) +

    +
    +

    + returns the entire original range. +

    +
    +

    + This functionality has the following advantages: +

    +
      +
    1. + it allows for seamless functional-style + programming where you do not need to use named + local variables to store intermediate results +
    2. +
    3. + it is very safe + because the algorithm can verify out-of-bounds conditions and handle + tricky conditions that lead to empty ranges +
    4. +
    +

    + For example, consider how easy we may erase the duplicates in a sorted + container: +

    +

    + +

    +
    std::vector<int> vec = ...;
    +boost::erase(vec, boost::unique<boost::return_found_end>(boost::sort(vec)));
    +
    +

    +

    +

    + Notice the use of boost::return_found_end. + What if we wanted to erase all the duplicates except one of them? In old-fashined + STL-programming we might write +

    +

    + +

    +
    // assume 'vec' is already sorted
    +std::vector<int>::iterator i = std::unique(vec.begin(), vec.end());
    +
    +// remember this check or you get into problems
    +if (i != vec.end())
    +    ++i;
    +
    +vec.erase(i, vec.end());
    +
    +

    +

    +

    + The same task may be accomplished simply with +

    +
    boost::erase(vec, boost::unique<boost::return_next_end>(vec));
    +
    +

    + and there is no need to worry about generating an invalid range. Furthermore, + if the container is complex, calling vec.end() several times will be more expensive + than using a range algorithm. +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/range/reference/algorithms/set.html b/doc/html/range/reference/algorithms/set.html index 7de08c4..2e0ae8b 100644 --- a/doc/html/range/reference/algorithms/set.html +++ b/doc/html/range/reference/algorithms/set.html @@ -2,8 +2,8 @@ Set algorithms - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -46,7 +46,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/set/includes.html b/doc/html/range/reference/algorithms/set/includes.html index d03a126..0e7e4b6 100644 --- a/doc/html/range/reference/algorithms/set/includes.html +++ b/doc/html/range/reference/algorithms/set/includes.html @@ -2,8 +2,8 @@ includes - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -47,7 +47,7 @@

    - + Description

    @@ -59,14 +59,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -74,77 +74,77 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -SinglePassRange1's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange1's + value type is a model of the LessThanComparableConcept. +
    • -SinglePassRange2's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange2's + value type is a model of the LessThanComparableConcept. +
    • - The ordering of objects of type SinglePassRange1's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange1's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • - The ordering of objects of type SinglePassRange2's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange2's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For the predicate versions:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -SinglePassRange2's - value type is convertible to BinaryPredicate's - second argument types. -
    • + SinglePassRange2's + value type is convertible to BinaryPredicate's + second argument types. +
    - + Precondition:

    @@ -162,7 +162,7 @@ according to pred.

    - + Complexity

    @@ -180,7 +180,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/set/set_difference.html b/doc/html/range/reference/algorithms/set/set_difference.html index 3084d87..c53281e 100644 --- a/doc/html/range/reference/algorithms/set/set_difference.html +++ b/doc/html/range/reference/algorithms/set/set_difference.html @@ -2,8 +2,8 @@ set_difference - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -70,14 +70,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -85,85 +85,85 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -SinglePassRange1's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange1's + value type is a model of the LessThanComparableConcept. +
    • -SinglePassRange2's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange2's + value type is a model of the LessThanComparableConcept. +
    • - The ordering of objects of type SinglePassRange1's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange1's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • - The ordering of objects of type SinglePassRange2's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange2's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For the predicate versions:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -SinglePassRange2's - value type is convertible to BinaryPredicate's - second argument types. -
    • + SinglePassRange2's + value type is convertible to BinaryPredicate's + second argument types. +
    - + Precondition:

    @@ -181,7 +181,7 @@ according to pred.

    - + Complexity

    @@ -199,7 +199,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/set/set_intersection.html b/doc/html/range/reference/algorithms/set/set_intersection.html index a817f35..b77838f 100644 --- a/doc/html/range/reference/algorithms/set/set_intersection.html +++ b/doc/html/range/reference/algorithms/set/set_intersection.html @@ -2,8 +2,8 @@ set_intersection - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -71,14 +71,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -86,85 +86,85 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -SinglePassRange1's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange1's + value type is a model of the LessThanComparableConcept. +
    • -SinglePassRange2's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange2's + value type is a model of the LessThanComparableConcept. +
    • - The ordering of objects of type SinglePassRange1's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange1's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • - The ordering of objects of type SinglePassRange2's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange2's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For the predicate versions:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -SinglePassRange2's - value type is convertible to BinaryPredicate's - second argument types. -
    • + SinglePassRange2's + value type is convertible to BinaryPredicate's + second argument types. +
    - + Precondition:

    @@ -182,7 +182,7 @@ according to pred.

    - + Complexity

    @@ -200,7 +200,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/set/set_symmetric_difference.html b/doc/html/range/reference/algorithms/set/set_symmetric_difference.html index 659877c..bef721c 100644 --- a/doc/html/range/reference/algorithms/set/set_symmetric_difference.html +++ b/doc/html/range/reference/algorithms/set/set_symmetric_difference.html @@ -2,8 +2,8 @@ set_symmetric_difference - - + + @@ -13,22 +13,22 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -75,14 +75,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -90,85 +90,85 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -SinglePassRange1's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange1's + value type is a model of the LessThanComparableConcept. +
    • -SinglePassRange2's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange2's + value type is a model of the LessThanComparableConcept. +
    • - The ordering of objects of type SinglePassRange1's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange1's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • - The ordering of objects of type SinglePassRange2's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange2's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For the predicate versions:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -SinglePassRange2's - value type is convertible to BinaryPredicate's - second argument types. -
    • + SinglePassRange2's + value type is convertible to BinaryPredicate's + second argument types. +
    - + Precondition:

    @@ -186,7 +186,7 @@ according to pred.

    - + Complexity

    @@ -204,7 +204,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/algorithms/set/set_union.html b/doc/html/range/reference/algorithms/set/set_union.html index ccc1783..026159c 100644 --- a/doc/html/range/reference/algorithms/set/set_union.html +++ b/doc/html/range/reference/algorithms/set/set_union.html @@ -2,8 +2,8 @@ set_union - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -69,14 +69,14 @@ in the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -84,85 +84,85 @@

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -SinglePassRange1's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange1's + value type is a model of the LessThanComparableConcept. +
    • -SinglePassRange2's - value type is a model of the LessThanComparableConcept. -
    • + SinglePassRange2's + value type is a model of the LessThanComparableConcept. +
    • - The ordering of objects of type SinglePassRange1's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange1's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +
    • - The ordering of objects of type SinglePassRange2's - value type is a strict weak ordering, - as defined in the LessThanComparableConcept - requirements. -
    • + The ordering of objects of type SinglePassRange2's + value type is a strict weak ordering, + as defined in the LessThanComparableConcept + requirements. +

    For the predicate versions:

    • -SinglePassRange1 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange1 + is a model of the Single + Pass Range Concept. +
    • -SinglePassRange2 is - a model of the Single - Pass Range Concept. -
    • + SinglePassRange2 + is a model of the Single + Pass Range Concept. +
    • -OutputIterator is a - model of the OutputIteratorConcept. -
    • + OutputIterator is + a model of the OutputIteratorConcept. +
    • -SinglePassRange1 and - SinglePassRange2 have - the same value type. -
    • + SinglePassRange1 + and SinglePassRange2 + have the same value type. +
    • -BinaryPredicate is - a model of the StrictWeakOrderingConcept. -
    • + BinaryPredicate is + a model of the StrictWeakOrderingConcept. +
    • -SinglePassRange1's - value type is convertible to BinaryPredicate's - first argument type. -
    • + SinglePassRange1's + value type is convertible to BinaryPredicate's + first argument type. +
    • -SinglePassRange2's - value type is convertible to BinaryPredicate's - second argument types. -
    • + SinglePassRange2's + value type is convertible to BinaryPredicate's + second argument types. +
    - + Precondition:

    @@ -180,7 +180,7 @@ according to pred.

    - + Complexity

    @@ -198,7 +198,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/concept_implementation.html b/doc/html/range/reference/concept_implementation.html index 0d150f3..f2c4792 100644 --- a/doc/html/range/reference/concept_implementation.html +++ b/doc/html/range/reference/concept_implementation.html @@ -2,8 +2,8 @@ Range concept implementation - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    Range concept implementation @@ -42,7 +42,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/concept_implementation/semantics.html b/doc/html/range/reference/concept_implementation/semantics.html index 1493f51..59fc394 100644 --- a/doc/html/range/reference/concept_implementation/semantics.html +++ b/doc/html/range/reference/concept_implementation/semantics.html @@ -2,8 +2,8 @@ Semantics - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -31,7 +31,7 @@
    Functions
    - + notation
    @@ -157,7 +157,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/concept_implementation/semantics/functions.html b/doc/html/range/reference/concept_implementation/semantics/functions.html index 0c0ef81..895d32d 100644 --- a/doc/html/range/reference/concept_implementation/semantics/functions.html +++ b/doc/html/range/reference/concept_implementation/semantics/functions.html @@ -2,8 +2,8 @@ Functions - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -402,7 +402,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/concept_implementation/semantics/metafunctions.html b/doc/html/range/reference/concept_implementation/semantics/metafunctions.html index 779a3b7..1a03534 100644 --- a/doc/html/range/reference/concept_implementation/semantics/metafunctions.html +++ b/doc/html/range/reference/concept_implementation/semantics/metafunctions.html @@ -2,8 +2,8 @@ Metafunctions - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -230,7 +230,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/concept_implementation/synopsis.html b/doc/html/range/reference/concept_implementation/synopsis.html index 9dffad1..9fdbc91 100644 --- a/doc/html/range/reference/concept_implementation/synopsis.html +++ b/doc/html/range/reference/concept_implementation/synopsis.html @@ -2,8 +2,8 @@ Synopsis - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -179,7 +179,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/extending.html b/doc/html/range/reference/extending.html index a9d7524..8ca7be8 100644 --- a/doc/html/range/reference/extending.html +++ b/doc/html/range/reference/extending.html @@ -2,8 +2,8 @@ Extending the library - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -45,7 +45,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/extending/method_1.html b/doc/html/range/reference/extending/method_1.html index 632687b..910d2de 100644 --- a/doc/html/range/reference/extending/method_1.html +++ b/doc/html/range/reference/extending/method_1.html @@ -2,8 +2,8 @@ Method 1: provide member functions and nested types - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    Method 1: provide member functions and nested types @@ -155,7 +155,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/extending/method_2.html b/doc/html/range/reference/extending/method_2.html index f4f3524..3828c8b 100644 --- a/doc/html/range/reference/extending/method_2.html +++ b/doc/html/range/reference/extending/method_2.html @@ -2,8 +2,8 @@ Method 2: provide free-standing functions and specialize metafunctions - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    Method 2: provide free-standing functions and specialize metafunctions @@ -261,7 +261,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/extending/method_3.html b/doc/html/range/reference/extending/method_3.html index f841237..2ec9d4d 100644 --- a/doc/html/range/reference/extending/method_3.html +++ b/doc/html/range/reference/extending/method_3.html @@ -2,8 +2,8 @@ Method 3: provide range adaptor implementations - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +

    Method 3: provide range adaptor implementations @@ -44,7 +44,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/extending/method_3/method_3_1.html b/doc/html/range/reference/extending/method_3/method_3_1.html index e995bee..3c038e6 100644 --- a/doc/html/range/reference/extending/method_3/method_3_1.html +++ b/doc/html/range/reference/extending/method_3/method_3_1.html @@ -2,8 +2,8 @@ Method 3.1: Implement a Range Adaptor without arguments - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    Method 3.1: Implement a Range Adaptor without arguments @@ -33,7 +33,7 @@

    1. - Provide a range for your return type, for example: + Provide a range for your return type, for example:
      #include <boost/range/iterator_range.hpp>
       #include <boost/iterator/reverse_iterator.hpp>
       
      @@ -57,17 +57,19 @@
           { }
       };
       
      -
    2. +
    3. - Provide a tag to uniquely identify your adaptor in the operator| - function overload set + Provide a tag to uniquely identify your adaptor in the operator| + function overload set
      namespace detail {
           struct reverse_forwarder {};
       }
       
      -
    4. +
    5. - Implement operator|
      template< class BidirectionalRng >
      +                Implement operator|
      +                
      +
      template< class BidirectionalRng >
       inline reverse_range<BidirectionalRng>
       operator|( BidirectionalRng& r, detail::reverse_forwarder )
       {
      @@ -81,7 +83,7 @@
       	return reverse_range<const BidirectionalRng>( r );
       }
       
      -
    6. +
    @@ -94,7 +96,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/extending/method_3/method_3_2.html b/doc/html/range/reference/extending/method_3/method_3_2.html index 2a0be9d..1f2102d 100644 --- a/doc/html/range/reference/extending/method_3/method_3_2.html +++ b/doc/html/range/reference/extending/method_3/method_3_2.html @@ -2,8 +2,8 @@ Method 3.2: Implement a Range Adaptor with arguments - - + + @@ -13,23 +13,23 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    1. - Provide a range for your return type, for example: + Provide a range for your return type, for example:
      #include <boost/range/adaptor/argument_fwd.hpp>
       #include <boost/range/iterator_range.hpp>
       #include <boost/iterator/transform_iterator.hpp>
      @@ -77,11 +77,11 @@
            }
        };
       
      -
    2. +
    3. - Implement a holder class to hold the arguments required to construct - the RangeAdaptor. -
    4. + Implement a holder class to hold the arguments required to construct + the RangeAdaptor. +

    The holder combines multiple parameters into one that can be passed as @@ -104,8 +104,8 @@

    1. - Define an instance of the holder with the name of the adaptor -
    + Define an instance of the holder with the name of the adaptor +

    @@ -115,8 +115,8 @@

    1. - Define operator| -
    + Define operator| +

    @@ -149,7 +149,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/overview.html b/doc/html/range/reference/overview.html new file mode 100644 index 0000000..0005ece --- /dev/null +++ b/doc/html/range/reference/overview.html @@ -0,0 +1,70 @@ + + + +Overview + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +

    + Three types of objects are currently supported by the library: +

    +
      +
    • + standard-like containers +
    • +
    • + std::pair<iterator,iterator> +
    • +
    • + built-in arrays +
    • +
    +

    + Even though the behavior of the primary templates are exactly such that standard + containers will be supported by default, the requirements are much lower + than the standard container requirements. For example, the utility class + iterator_range + implements the minimal interface + required to make the class a Forward + Range. +

    +

    + Please also see Range concepts for + more details. +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/range/reference/ranges.html b/doc/html/range/reference/ranges.html index d1d6017..6f8c5af 100644 --- a/doc/html/range/reference/ranges.html +++ b/doc/html/range/reference/ranges.html @@ -2,8 +2,8 @@ Provided Ranges - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -42,7 +42,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/ranges/counting_range.html b/doc/html/range/reference/ranges/counting_range.html index 566a7f2..b1d7294 100644 --- a/doc/html/range/reference/ranges/counting_range.html +++ b/doc/html/range/reference/ranges/counting_range.html @@ -2,8 +2,8 @@ counting_range - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -58,21 +58,21 @@ (from Boost.Iterator).

    - + Definition

    Defined in header file boost/range/counting_range.hpp

    - + Requirements
    1. -Incrementable is a model - of the Incrementable - Concept. -
    + Incrementable is a + model of the Incrementable + Concept. +
    @@ -84,7 +84,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/ranges/irange.html b/doc/html/range/reference/ranges/irange.html index 358791b..da9b33a 100644 --- a/doc/html/range/reference/ranges/irange.html +++ b/doc/html/range/reference/ranges/irange.html @@ -2,8 +2,8 @@ irange - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -58,28 +58,29 @@ parameters denoted a half-open range.

    - + Definition

    Defined in the header file boost/range/irange.hpp

    - + Requirements
    1. -Integer is a model of - the Integer Concept. -
    2. + Integer is a model + of the Integer Concept. +
    3. -StepSize is a model of - the SignedInteger Concept. -
    4. + StepSize is a model + of the SignedInteger + Concept. +
    - + Complexity

    @@ -97,7 +98,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/ranges/istream_range.html b/doc/html/range/reference/ranges/istream_range.html index eda91a4..52bb89c 100644 --- a/doc/html/range/reference/ranges/istream_range.html +++ b/doc/html/range/reference/ranges/istream_range.html @@ -2,8 +2,8 @@ istream_range - - + + @@ -13,21 +13,21 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -49,7 +49,7 @@ wrapping a std::istream_iterator.

    - + Definition

    @@ -66,7 +66,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/utilities.html b/doc/html/range/reference/utilities.html index f2f39b2..45e60d3 100644 --- a/doc/html/range/reference/utilities.html +++ b/doc/html/range/reference/utilities.html @@ -2,8 +2,8 @@ Utilities - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -41,14 +41,14 @@

    • - Class iterator_range -
    • + Class iterator_range +
    • - Class sub_range -
    • + Class sub_range +
    • - Function join -
    • + Function join +

    The iterator_range class @@ -77,7 +77,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/utilities/iterator_range.html b/doc/html/range/reference/utilities/iterator_range.html index a0fc0c0..27df4a0 100644 --- a/doc/html/range/reference/utilities/iterator_range.html +++ b/doc/html/range/reference/utilities/iterator_range.html @@ -2,8 +2,8 @@ Class iterator_range - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -48,7 +48,7 @@ type.

    - + Synopsis

    @@ -188,39 +188,26 @@ iterators from the same container.

    - + Details member functions

    operator unspecified_bool_type() const;

    -
    -

    -

    -

    - Returns !empty(); -

    -

    -

    -
    +

    + Returns !empty(); +

    bool equal( iterator_range& r ) const;

    -
    -

    -

    -

    - Returns begin() - == r.begin() && - end() - == r.end(); -

    -

    -

    -
    +

    + Returns begin() == r.begin() && + end() + == r.end(); +

    - + Details functions
    @@ -229,45 +216,27 @@ l, const ForwardRange2& r );

    -
    -

    -

    -

    - Returns size(l) != size(r) ? false : std::equal( - begin(l), end(l), begin(r) ); -

    -

    -

    -
    +

    + Returns size(l) != size(r) ? false + : std::equal( begin(l), end(l), begin(r) ); +

    bool operator!=( const ForwardRange1& l, const ForwardRange2& r );

    -
    -

    -

    -

    - Returns !( l == r ); -

    -

    -

    -
    +

    + Returns !( l == r ); +

    bool operator<( const ForwardRange1& l, const ForwardRange2& r );

    -
    -

    -

    -

    - Returns std::lexicographical_compare( - begin(l), end(l), begin(r), end(r) ); -

    -

    -

    -
    +

    + Returns std::lexicographical_compare( + begin(l), end(l), begin(r), end(r) ); +

    @@ -277,15 +246,9 @@

    -
    -

    -

    -

    - Effects: -

    -

    -

    -
    +

    + Effects: +

    @@ -301,16 +264,10 @@ Sequence copy_range( const ForwardRange& r );

    -
    -

    -

    -

    - Returns Sequence( - begin(r), end(r) ); -

    -

    -

    -
    +

    + Returns Sequence( + begin(r), end(r) ); +

    @@ -322,7 +279,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/utilities/join.html b/doc/html/range/reference/utilities/join.html index 349f282..458ed2e 100644 --- a/doc/html/range/reference/utilities/join.html +++ b/doc/html/range/reference/utilities/join.html @@ -2,8 +2,8 @@ Function join - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -39,7 +39,7 @@ check if the end of a range has been reached internally during traversal.

    - + Synposis

    @@ -65,7 +65,7 @@

    - + Example

    @@ -83,7 +83,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/utilities/sub_range.html b/doc/html/range/reference/utilities/sub_range.html index 8c75a91..684c838 100644 --- a/doc/html/range/reference/utilities/sub_range.html +++ b/doc/html/range/reference/utilities/sub_range.html @@ -2,8 +2,8 @@ Class sub_range - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -35,7 +35,7 @@ is.

    - + Synopsis

    @@ -117,7 +117,7 @@


    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/style_guide.html b/doc/html/range/style_guide.html index c9f3e34..c5e6877 100644 --- a/doc/html/range/style_guide.html +++ b/doc/html/range/style_guide.html @@ -2,8 +2,8 @@ Terminology and style guidelines - - + + @@ -13,16 +13,16 @@ - +
    Boost C++ Libraries HomeLibrariesLibraries People FAQ More

    -PrevUpHomeNext +PrevUpHomeNext
    -
    +
    @@ -39,31 +39,41 @@

    • -Value access category: -
        + Value access category: +
        • - Readable Range -
        • + Readable Range +
        • - Writeable Range -
        • + Writeable Range +
        • - Swappable Range -
        • + Swappable Range +
        • - Lvalue Range -
        • + Lvalue Range +
        - +
      • -Traversal category: -

        Notice how we have used the categories from the new @@ -77,11 +87,11 @@

        • - Random Access Readable Writeable Range -
        • + Random Access Readable Writeable Range +
        • - Forward Lvalue Range -
        • + Forward Lvalue Range +

        By convention, we should always specify the traversal @@ -135,7 +145,7 @@


        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/upgrade.html b/doc/html/range/upgrade.html index ad53c37..2e6a068 100644 --- a/doc/html/range/upgrade.html +++ b/doc/html/range/upgrade.html @@ -2,8 +2,8 @@ Upgrade version of Boost.Range - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +
        @@ -43,7 +43,7 @@
        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/upgrade/upgrade_from_1_34.html b/doc/html/range/upgrade/upgrade_from_1_34.html index 1275e9c..bc22cb6 100644 --- a/doc/html/range/upgrade/upgrade_from_1_34.html +++ b/doc/html/range/upgrade/upgrade_from_1_34.html @@ -2,8 +2,8 @@ Upgrade from version 1.34 - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +

        Upgrade from version 1.34 @@ -32,32 +32,34 @@

        1. - Direct support for character arrays was abandoned in favor of uniform treatment - of all arrays. Instead string algorithms can use the new function as_literal(). -
        2. + Direct support for character arrays was abandoned in favor of uniform + treatment of all arrays. Instead string algorithms can use the new function + as_literal(). +
        3. -size now requires a Random - Access Range. The old behavior is provided as distance(). -
        4. + size now requires a Random + Access Range. The old behavior is provided as distance(). +
        5. -range_size<T>::type has been completely removed in favor - of range_difference<T>::type -
        6. + range_size<T>::type has been completely removed in + favor of range_difference<T>::type +
        7. -boost_range_begin() - and boost_range_end() - have been renamed range_begin() and range_end() respectively. -
        8. + boost_range_begin() + and boost_range_end() + have been renamed range_begin() and range_end() respectively. +
        9. -range_result_iterator<T>::type and range_reverse_result_iterator<T>::type - have been renamed range_iterator<T>::type - and range_reverse_iterator<T>::type. -
        10. + range_result_iterator<T>::type + and range_reverse_result_iterator<T>::type + have been renamed range_iterator<T>::type + and range_reverse_iterator<T>::type. +
        11. - The procedure that makes a custom type work with the library has been greatly - simplified. See Extending the - library for UDTs for details. -
        12. + The procedure that makes a custom type work with the library has been + greatly simplified. See Extending + the library for UDTs for details. +

        @@ -70,7 +72,7 @@

        -PrevUpHomeNext +PrevUpHomeNext
        diff --git a/doc/html/range/upgrade/upgrade_from_1_42.html b/doc/html/range/upgrade/upgrade_from_1_42.html index 3fbc2d2..3174dc1 100644 --- a/doc/html/range/upgrade/upgrade_from_1_42.html +++ b/doc/html/range/upgrade/upgrade_from_1_42.html @@ -2,8 +2,8 @@ Upgrade from version 1.42 - - + + @@ -13,16 +13,16 @@ - +
        Boost C++ Libraries HomeLibrariesLibraries People FAQ More

        -PrevUpHomeNext +PrevUpHomeNext
        -
        +

        Upgrade from version 1.42 @@ -31,22 +31,26 @@ New features:

        Removed:

        1. -iterator_range no longer - has a is_singular member - function. The singularity restrictions have been removed from the iterator_range class since this added - restrictions to ranges of iterators whose default constructors were not - singular. Previously the is_singular - member function always returned false - in release build configurations, hence it is not anticipated that this - interface change will produce difficulty in upgrading. -
        + iterator_range no longer + has a is_singular member + function. The singularity restrictions have been removed from the iterator_range class since this added + restrictions to ranges of iterators whose default constructors were not + singular. Previously the is_singular + member function always returned false + in release build configurations, hence it is not anticipated that this + interface change will produce difficulty in upgrading. +

    @@ -58,7 +62,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/introduction.qbk b/doc/introduction.qbk index c25eeae..7fc83df 100644 --- a/doc/introduction.qbk +++ b/doc/introduction.qbk @@ -12,62 +12,27 @@ The main advantages are * more flexible, compact and maintainable client code * safe use of built-in arrays (for legacy code; why else would you use built-in arrays?) -Below are given a small example (the complete example can be found [@http://www.boost.org/libs/range/test/algorithm_example.cpp here] ): - +[heading Example - Iterate over the values in a map] `` - // - // example: extracting bounds in a generic algorithm - // - template< class ForwardReadableRange, class T > - inline typename boost::range_iterator< ForwardReadableRange >::type - find( ForwardReadableRange& c, const T& value ) - { - return std::find( boost::begin( c ), boost::end( c ), value ); - } - - template< class ForwardReadableRange, class T > - inline typename boost::range_iterator< const ForwardReadableRange >::type - find( const ForwardReadableRange& c, const T& value ) - { - return std::find( boost::begin( c ), boost::end( c ), value ); - } - - // - // replace first value and return its index - // - template< class ForwardReadableWriteableRange, class T > - inline typename boost::range_size< ForwardReadableWriteableRange >::type - my_generic_replace( ForwardReadableWriteableRange& c, const T& value, const T& replacement ) - { - typename boost::range_iterator< ForwardReadableWriteableRange >::type found = find( c, value ); - - if( found != boost::end( c ) ) - *found = replacement; - return std::distance( boost::begin( c ), found ); - } - - // - // usage - // - const int N = 5; - std::vector my_vector; - int values[] = { 1,2,3,4,5,6,7,8,9 }; - - my_vector.assign( values, boost::end( values ) ); - typedef std::vector::iterator iterator; - std::pair my_view( boost::begin( my_vector ), - boost::begin( my_vector ) + N ); - char str_val[] = "a string"; - char* str = str_val; - - std::cout << my_generic_replace( my_vector, 4, 2 ); - std::cout << my_generic_replace( my_view, 4, 2 ); - std::cout << my_generic_replace( str, 'a', 'b' ); - - // prints '3', '5' and '0' +using namespace boost; +using namespace boost::adaptors; +for_each( my_map | map_values, fn ); `` -By using the free-standing functions and __metafunctions__, the code automatically works for all the types supported by this library; now and in the future. Notice that we have to provide two versions of `find()` since we cannot forward a non-const rvalue with reference arguments (see this article about __the_forwarding_problem__ ). +[heading Example - Iterate over the keys in a map] +`` +using namespace boost; +using namespace boost::adaptors; +for_each( my_map | map_keys, fn ); +`` + +[heading Example - Push the even values from a map in reverse order into the container `target`] +`` +using namespace boost; +using namespace boost::adaptors; +// Assume that is_even is a predicate that has been implemented elsewhere... +push_back(target, my_map | map_values | filtered(is_even()) | reversed); +`` [endsect] diff --git a/doc/reference/adaptors/adjacent_filtered.html b/doc/reference/adaptors/adjacent_filtered.html deleted file mode 100755 index a5da75a..0000000 --- a/doc/reference/adaptors/adjacent_filtered.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    adjacent_filtered

    -
    -
                rng | boost::adaptors::adjacent_filtered( bi_pred )
    -        
    -
                boost::make_adjacent_filtered_range( rng, bi_pred )
    -        
    -
    -
      -
    • - Precondition: - The value-type of the range is convertible to both argument types - of bi_pred. -
    • -
    • - Postcondition: - For all adjacent elements [x,y] in the returned range, - bi_pred(x,y) is true. -
    • -
    • - Throws: - Whatever the copy-constructor of bi_pred might throw. -
    • -
    • - Range Category: - SinglePassRange -
    • -
    - -
    -

    Example

    -
    -        #include <boost/range/adaptor/adjacent_filtered.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <functional>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::assign;
    -            using namespace boost::adaptors;
    -            
    -            std::vector<int> input;
    -            input += 1,1,2,2,2,3,4,5,6;
    -            
    -            boost::copy(
    -                input | adjacent_filtered(std::not_equal_to<int>()),
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This would produce the output:
    - 1,2,3,4,5,6
    -

    -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/copied.html b/doc/reference/adaptors/copied.html deleted file mode 100755 index 12b3351..0000000 --- a/doc/reference/adaptors/copied.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    copied

    -
    -
    rng | boost::adaptors::copied( n, m )
    -
    boost::make_copied_range( rng, n, m )
    -
    -
      -
    • - Precondition: - 0 <= n && n <= m && m < distance(rng) -
    • -
    • - Returns: - A new iterator_range that holds the sliced range - [n,m) of the original range. -
    • -
    • - Range Category: - RandomAccessRange -
    • -
    - -
    -

    Example

    -
    -    #include <boost/range/adaptor/copied.hpp>
    -    #include <boost/range/algorithm/copy.hpp>
    -    #include <boost/assign.hpp>
    -    #include <algorithm>
    -    #include <iostream>
    -    #include <vector>
    -
    -    int main(int argc, const char* argv[])
    -    {
    -        using namespace boost::assign;
    -        using namespace boost::adaptors;
    -
    -        std::vector<int> input;
    -        input += 1,2,3,4,5,6,7,8,9,10;
    -
    -        boost::copy(
    -            input | copied(1, 5),
    -            std::ostream_iterator<int>(std::cout, ","));
    -
    -        return 0;
    -    }
    -    
    -

    - This would produce the output: - 2,3,4,5 -

    -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/filtered.html b/doc/reference/adaptors/filtered.html deleted file mode 100755 index 055c826..0000000 --- a/doc/reference/adaptors/filtered.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    filtered

    -
    -
    rng | boost::adaptors::filtered( pred )
    -
    boost::make_filtered_range( rng, pred )
    -
    -
      -
    • - Precondition: - The value-type of the range is convertible to the argument type of - pred. -
    • -
    • - Postcondition: - For all elements x in the returned range, - pred(x) is true -
    • -
    • - Throws: - Whatever the copy-constructor of pred might throw. -
    • -
    • - Range Category: - ForwardRange -
    • -
    • - Returned Range Category: - ForwardRange -
    • -
    - -
    -

    Example

    -
    -        #include <boost/range/adaptor/filtered.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -
    -        struct is_even
    -        {
    -            bool operator()(int x) const { return x % 2 == 0; }
    -        };
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::assign;
    -            using namespace boost::adaptors;
    -            
    -            std::vector<int> input;
    -            input += 1,2,3,4,5,6,7,8,9;
    -
    -            boost::copy(
    -                input | filtered(is_even()),
    -                std::ostream_iterator<int>(std::cout, ","));
    -
    -            return 0;
    -        }
    -    
    -

    - This would produce the output:
    - 2,4,6,8 -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/indexed.html b/doc/reference/adaptors/indexed.html deleted file mode 100755 index 74e0d04..0000000 --- a/doc/reference/adaptors/indexed.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    indexed

    -
    -
    rng | boost::adaptors::indexed
    -
    boost::make_indexed_range( rng )
    -
    -
      -
    • - Returns: - A range adapted to return both the element and the associated - index. - The returned range consists of iterators that have in addition - to the usual iterator member functions an - index() member function that returns the appropriate - index for the element in the sequence corresponding with the - iterator. -
    • -
    • - Range Category: - SinglePassRange -
    • -
    -
    -

    Example

    -
    -        #include <boost/range/adaptor/indexed.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        template<class Iterator>
    -        void display_element_and_index(Iterator first, Iterator last)
    -        {
    -            for (Iterator it = first; it != last; ++it)
    -            {
    -                std::cout << "Element = " << *it
    -                          << " Index = " << it.index() << std::endl;
    -            }
    -        }
    -        
    -        template<class SinglePassRange>
    -        void display_element_and_index(const SinglePassRange& rng)
    -        {
    -            display_element_and_index(boost::begin(rng), boost::end(rng));
    -        }
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::assign;
    -            using namespace boost::adaptors;
    -            
    -            std::vector<int> input;
    -            input += 10,20,30,40,50,60,70,80,90;
    -            
    -            display_element_and_index( input | indexed(0) );
    -            
    -            return 0;
    -        }
    -    
    -

    - This produces the output:
    - - Element = 10 Index = 0
    - Element = 20 Index = 1
    - Element = 30 Index = 2
    - Element = 40 Index = 3
    - Element = 50 Index = 4
    - Element = 60 Index = 5
    - Element = 70 Index = 6
    - Element = 80 Index = 7
    - Element = 90 Index = 8
    -
    -

    -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/indirected.html b/doc/reference/adaptors/indirected.html deleted file mode 100755 index 0a56e32..0000000 --- a/doc/reference/adaptors/indirected.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    indirected

    -
    -
    rng | boost::adaptors::indirected
    -
    boost::make_indirected_range( rng )
    -
    -
      -
    • - Precondition: - The value-type of the range defines unary operator*() -
    • -
    • - Postcondition: - For all elements x in the returned range, - x is the result of *y where - y is the corresponding element in the original range. -
    • -
    • - Range Category: - SinglePassRange -
    • -
    - -
    -

    Example

    -
    -        #include <boost/range/adaptor/indirected.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/shared_ptr.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::adaptors;
    -            
    -            std::vector<boost::shared_ptr<int> > input;
    -            
    -            for (int i = 0; i < 10; ++i)
    -                input.push_back(boost::shared_ptr<int>(new int(i)));
    -                
    -            boost::copy(
    -                input | indirected,
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This produces the output:
    - 0,1,2,3,4,5,6,7,8,9 -

    -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/map_keys.html b/doc/reference/adaptors/map_keys.html deleted file mode 100755 index a1eec17..0000000 --- a/doc/reference/adaptors/map_keys.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    map_keys

    -
    -
    rng | boost::adaptors::map_keys
    -
    boost::make_map_key_range( rng )
    -
    -
      -
    • - Precondition: - The value-type of the range is an instantiation of std::pair. -
    • -
    • - Postcondition: - For all elements x in the returned range, - x is the result of y.first where - y is the corresponding element in the original range. -
    • -
    • - Range Category: - SinglePassRange -
    • -
    - -
    -

    Example

    -
    -        #include <boost/range/adaptor/map.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <map>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::assign;
    -            using namespace boost::adaptors;
    -            
    -            std::map<int,int> input;
    -            for (int i = 0; i < 10; ++i)
    -                input.insert(std::make_pair(i, i * 10));
    -                
    -            boost::copy(
    -                input | map_keys,
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This produces the output:
    - - 0,1,2,3,4,5,6,7,8,9 - -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/map_values.html b/doc/reference/adaptors/map_values.html deleted file mode 100755 index bc3c165..0000000 --- a/doc/reference/adaptors/map_values.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    map_values

    -
    -
    rng | boost::adaptors::map_values
    -
    boost::make_map_value_range( rng )
    -
    -
      -
    • - Precondition: - The value-type of the range is an instantiation of std::pair. -
    • -
    • - Postcondition: - For all elements x in the returned range, - x is the result of y.second where - y is the corresponding element in the original range. -
    • -
    • - Range Category: - SinglePassRange -
    • -
    -
    -

    Example

    -
    -        #include <boost/range/adaptor/map.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <map>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::assign;
    -            using namespace boost::adaptors;
    -            
    -            std::map<int,int> input;
    -            for (int i = 0; i < 10; ++i)
    -                input.insert(std::make_pair(i, i * 10));
    -                
    -            boost::copy(
    -                input | map_values,
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This produces the output:
    - - 0,10,20,30,40,50,60,70,80,90 - -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/replaced.html b/doc/reference/adaptors/replaced.html deleted file mode 100755 index 861277f..0000000 --- a/doc/reference/adaptors/replaced.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    replaced

    -
    -
    rng | boost::adaptors::replaced( new_value, old_value )
    -
    boost::make_replaced_range( rng, new_value, old_value )
    -
    -
      -
    • - Precondition: -
        -
      • - new_value is convertible to the value-type of - the range. -
      • -
      • - old_value is convertible to the value-type of - the range. -
      • -
      -
    • -
    • - Postcondition: - For all elements x in the returned range, the value - x is equal to the value of - (y == old_value) ? new_value : y - where y is the corresponding element in the original - range. -
    • -
    • - Range Category: - ForwardRange -
    • -
    -
    -

    Example

    -
    -        #include <boost/range/adaptor/replaced.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::adaptors;
    -            using namespace boost::assign;
    -            
    -            std::vector<int> input;
    -            input += 1,2,3,2,5,2,7,2,9;
    -            
    -            boost::copy(
    -                input | replaced(2, 10),
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This produces the output:
    - - 1,10,3,10,5,10,7,10,9 - -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/replaced_if.html b/doc/reference/adaptors/replaced_if.html deleted file mode 100755 index cde3678..0000000 --- a/doc/reference/adaptors/replaced_if.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    replaced_if

    -
    -
    rng | boost::adaptors::replaced_if( pred, new_value )
    -
    boost::make_replaced_if_range( rng, pred, new_value )
    -
    -
      -
    • - Precondition: -
        -
      • - The range value-type is convertible to the argument type - of pred. -
      • -
      • - new_value is convertible to the value-type - of the range. -
      • -
      -
    • -
    • - Postconditions: - For all elements [x] in the returned range, the value - x is equal to the value of - pred(y) ? new_value : y - where y is the corresponding element in the original - range. -
    • -
    • - Range Category: - ForwardRange -
    • -
    - -
    -

    Example

    -
    -        #include <boost/range/adaptor/replaced_if.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        struct is_even
    -        {
    -            bool operator()(int x) const { return x % 2 == 0; }
    -        };
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::adaptors;
    -            using namespace boost::assign;
    -            
    -            std::vector<int> input;
    -            input += 1,2,3,4,5,6,7,8,9;
    -            
    -            boost::copy(
    -                input | replaced_if(is_even(), 10),
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -        
    -    
    -

    - This produces the output:
    - - 1,10,3,10,5,10,7,10,9 - -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/reversed.html b/doc/reference/adaptors/reversed.html deleted file mode 100755 index 0aea1ee..0000000 --- a/doc/reference/adaptors/reversed.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    reversed

    -
    -
    rng | boost::adaptors::reversed
    -
    boost::make_reversed_range( rng )
    -
    -
      -
    • - Returns: - A range whose iterators behave as if they were the original - iterators wrapped in reverse_iterator. -
    • -
    • - Range Category: - BidirectionalRange -
    • -
    -
    -

    Example

    -
    -        #include <boost/range/adaptor/reversed.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::adaptors;
    -            using namespace boost::assign;
    -            
    -            std::vector<int> input;
    -            input += 1,2,3,4,5,6,7,8,9;
    -            
    -            boost::copy(
    -                input | reversed,
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This produces the output:
    - - 9,8,7,6,5,4,3,2,1 - -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/sliced.html b/doc/reference/adaptors/sliced.html deleted file mode 100755 index d979392..0000000 --- a/doc/reference/adaptors/sliced.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    sliced

    -
    -
    rng | boost::adaptors::sliced( n, m )
    -
    boost::make_sliced_range( rng, n, m )
    -
    -
      -
    • - Precondition: - 0 <= n && n <= m && m < distance(rng) -
    • -
    • - Returns: - make_range(rng, n, m) -
    • -
    • - Range Category: - RandomAccessRange -
    • -
    -
    -

    Example

    -
    -        #include <boost/range/adaptor/sliced.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::adaptors;
    -            using namespace boost::assign;
    -            
    -            std::vector<int> input;
    -            input += 1,2,3,4,5,6,7,8,9;
    -            
    -            boost::copy(
    -                input | sliced(2, 5),
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This produces the output:
    - - 3,4,5 - -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/strided.html b/doc/reference/adaptors/strided.html deleted file mode 100755 index 3e23af5..0000000 --- a/doc/reference/adaptors/strided.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    strided

    -
    -
    rng | boost::adaptors::strided( n )
    -
    boost::make_strided_range( rng, n )
    -
    -
      -
    • - Precondition: - 0 <= n && n <= distance(rng) -
    • -
    • - Returns: - A new range based on rng where traversal is performed in steps of n. -
    • -
    • - Range Category: - RandomAccessRange -
    • -
    -
    -

    Example

    -
    -        #include <boost/range/adaptor/strided.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::adaptors;
    -            using namespace boost::assign;
    -            
    -            std::vector<int> input;
    -            input += 1,2,3,4,5,6,7,8,9,10;
    -            
    -            boost::copy(
    -                input | strided(2),
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This produces the output: - - 1,3,5,7,9 - -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/tokenized.html b/doc/reference/adaptors/tokenized.html deleted file mode 100755 index 304e91d..0000000 --- a/doc/reference/adaptors/tokenized.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    tokenized

    -
    -
    rng | boost::adaptors::tokenized( regex )
    -
    rng | boost::adaptors::tokenized( regex, i )
    -
    rng | boost::adaptors::tokenized( regex, rndRng )
    -
    rng | boost::adaptors::tokenized( regex, i, flags )
    -
    rng | boost::adaptors::tokenized( regex, rndRng, flags )
    -
    boost::make_tokenized_range( rng, regex, i, flags )
    -
    boost::make_tokenized_range( rng, regex, rngRng, flags )
    -
    -
      -
    • - Precondition: -
        -
      • - Let T denote - typename range_value< decltype(rng) >::type, - then regex has the type - basic_regex<T> or is - implicitly convertible to one of these types. -
      • -
      • - i has the type int. -
      • -
      • - the value-type of rndRng is int. -
      • -
      • - flags has the type - regex_constants::syntax_option_type. -
      • -
      -
    • -
    • - Returns: - A range whose iterators behave as if they were the - original iterators wrapped in regex_token_iterator. - The first iterator in the range would be constructed by - forwarding all the arguments of tokenized() to the - regex_token_iterator constructor. -
    • -
    • - Throws: - Whatever constructing and copying equivalent - regex_token_iterators might throw. -
    • -
    • - Range Category: - RandomAccessRange -
    • -
    -
    -

    Example

    -
    -        #include <boost/range/adaptor/tokenized.hpp>
    -        #include <boost/range/algorithm_ext/push_back.hpp>
    -        #include <boost/assert.hpp>
    -        #include <algorithm>
    -        #include <string>
    -        #include <vector>
    -        
    -        int main(int argc, const char* argv)
    -        {
    -            using namespace boost::adaptors;
    -            
    -            std::string input = "a b c d e f g hijklmnopqrstuvwxyz";
    -            std::vector< boost::sub_match< std::string::iterator > > result;
    -            boost::push_back(result, input | tokenized(boost::regex("\\b")));
    -            
    -            BOOST_ASSERT( boost::size(result) == 16u );
    -            
    -            return 0;
    -        }
    -    
    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/transformed.html b/doc/reference/adaptors/transformed.html deleted file mode 100755 index 4069f9a..0000000 --- a/doc/reference/adaptors/transformed.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    transformed

    -
    -
    rng | boost::adaptors::transformed( fun )
    -
    boost::make_transformed_range( rng, fun )
    -
    -
      -
    • - Precondition: - The value-type of the range is convertible to the argument type - of fun. -
    • -
    • - Postcondition: - For all elements x in the returned range, - x is the result of fun(y) where - y is the corresponding element in the original range. -
    • -
    • - Throws: - Whatever the copy-constructor of fun might throw. -
    • -
    • - Range Category: - SinglePassRange -
    • -
    -
    -

    Example

    -
    -        #include <boost/range/adaptor/transformed.hpp>
    -        #include <boost/range/algorithm/copy.hpp>
    -        #include <boost/range/assign.hpp>
    -        #include <algorithm>
    -        #include <iostream>
    -        #include <vector>
    -        
    -        struct double_int
    -        {
    -            typedef int result_type;
    -            int operator()(int x) const { return x * 2; }
    -        };
    -        
    -        int main(int argc, const char* argv[])
    -        {
    -            using namespace boost::adaptors;
    -            using namespace boost::assign;
    -            
    -            std::vector<int> input;
    -            input += 1,2,3,4,5,6,7,8,9,10;
    -            
    -            boost::copy(
    -                input | transformed(double_int()),
    -                std::ostream_iterator<int>(std::cout, ","));
    -                
    -            return 0;
    -        }
    -    
    -

    - This produces the output:
    - - 2,4,6,8,10,12,14,16,18,20 - -

    - -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/doc/reference/adaptors/uniqued.html b/doc/reference/adaptors/uniqued.html deleted file mode 100755 index 43ca130..0000000 --- a/doc/reference/adaptors/uniqued.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - Boost.Range Range Adaptors - - - - - - - - - - -

    Boost.Range

    - -

    Range Adaptors

    - -
    - -

    uniqued

    -
    -
    rng | boost::adaptors::uniqued
    -
    boost::make_uniqued_range( rng )
    -
    -
      -
    • - Precondition: - The value-type of the range is comparable with - operator==(). -
    • -
    • - Postcondition: - For all adjacent elements [x,y] in the returned range, - x==y is false. -
    • -
    • - Range Category: - ForwardRange -
    • -
    - -
    -

    Example

    - -
    -    #include <boost/range/adaptor/uniqued.hpp>
    -    #include <boost/range/algorithm/copy.hpp>
    -    #include <boost/assign.hpp>
    -    #include <algorithm>
    -    #include <iostream>
    -    #include <vector>
    -    
    -    int main(int argc, const char* argv)
    -    {
    -        using namespace boost::assign;
    -        using namespace boost::adaptors;
    -        
    -        std::vector<int> input;
    -	input += 1,1,2,2,2,3,4,5,6;
    -        
    -	boost::copy(
    -	    input | uniqued,
    -            std::ostream_iterator<int>(std::cout, ",") );
    -         
    -        return 0;
    -    }
    -   
    -

    - This would produce the output:
    - 1,2,3,4,5,6
    -

    -
    -

    - (C) Copyright Neil Groves 2009 - (C) Copyright Thorsten Ottosen 2003-2004 -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/include/boost/range/adaptor/adjacent_filtered.hpp b/include/boost/range/adaptor/adjacent_filtered.hpp index c01f1c1..f63a599 100644 --- a/include/boost/range/adaptor/adjacent_filtered.hpp +++ b/include/boost/range/adaptor/adjacent_filtered.hpp @@ -27,7 +27,6 @@ namespace boost { - namespace range_detail { template< class Iter, class Pred, bool default_pass > @@ -140,10 +139,14 @@ namespace boost public: adjacent_filter_range( const P& p, R& r ) - : base_range( skip_iter( boost::begin(r), boost::end(r), p), - skip_iter( boost::end(r), boost::end(r), p) ) + : base_range(skip_iter(boost::begin(r), boost::end(r), p), + skip_iter(boost::end(r), boost::end(r), p)) { } + + private: + P m_pred; + R* m_range; }; template< class T > diff --git a/include/boost/range/adaptor/map.hpp b/include/boost/range/adaptor/map.hpp index a8a2c20..6d08ea7 100755 --- a/include/boost/range/adaptor/map.hpp +++ b/include/boost/range/adaptor/map.hpp @@ -25,9 +25,9 @@ namespace boost template< class Map > struct select_first { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type& - result_type; + typedef BOOST_DEDUCED_TYPENAME range_value::type pair_t; + typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type& + result_type; result_type operator()( const pair_t& r ) const { @@ -38,8 +38,8 @@ namespace boost template< class Map > struct select_second_mutable { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type; + typedef BOOST_DEDUCED_TYPENAME range_value::type pair_t; + typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type; result_type operator()( pair_t& r ) const { @@ -50,16 +50,16 @@ namespace boost template< class Map > struct select_second_const { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type& - result_type; - + typedef BOOST_DEDUCED_TYPENAME range_value::type pair_t; + typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type& + result_type; + result_type operator()( const pair_t& r ) const { return r.second; } }; - + template class select_first_range : public transform_range< @@ -78,7 +78,7 @@ namespace boost select_first_range(const base& other) : base(other) {} }; - + template class select_second_mutable_range : public transform_range< @@ -97,7 +97,7 @@ namespace boost select_second_mutable_range(const base& other) : base(other) {} }; - + template class select_second_const_range : public transform_range< @@ -116,20 +116,20 @@ namespace boost select_second_const_range(const base& other) : base(other) {} }; - + template< class StdPairRng > - inline select_first_range + inline select_first_range operator|( const StdPairRng& r, map_keys_forwarder ) { - return operator|( r, + return operator|( r, boost::adaptors::transformed( select_first() ) ); } template< class StdPairRng > - inline select_second_mutable_range + inline select_second_mutable_range operator|( StdPairRng& r, map_values_forwarder ) { - return operator|( r, + return operator|( r, boost::adaptors::transformed( select_second_mutable() ) ); } @@ -137,27 +137,27 @@ namespace boost inline select_second_const_range operator|( const StdPairRng& r, map_values_forwarder ) { - return operator|( r, - boost::adaptors::transformed( select_second_const() ) ); + return operator|( r, + boost::adaptors::transformed( select_second_const() ) ); } - + } // 'range_detail' - + using range_detail::select_first_range; using range_detail::select_second_mutable_range; using range_detail::select_second_const_range; namespace adaptors - { + { namespace { - const range_detail::map_keys_forwarder map_keys = + const range_detail::map_keys_forwarder map_keys = range_detail::map_keys_forwarder(); - const range_detail::map_values_forwarder map_values = + const range_detail::map_values_forwarder map_values = range_detail::map_values_forwarder(); } - + template inline select_first_range keys(const StdPairRange& rng) @@ -165,7 +165,7 @@ namespace boost return select_first_range( range_detail::select_first(), rng ); } - + template inline select_second_const_range values(const StdPairRange& rng) @@ -173,7 +173,7 @@ namespace boost return select_second_const_range( range_detail::select_second_const(), rng ); } - + template inline select_second_mutable_range values(StdPairRange& rng) @@ -182,7 +182,7 @@ namespace boost range_detail::select_second_mutable(), rng ); } } // 'adaptors' - + } #endif diff --git a/include/boost/range/adaptor/replaced.hpp b/include/boost/range/adaptor/replaced.hpp index 3c40918..deeb8da 100644 --- a/include/boost/range/adaptor/replaced.hpp +++ b/include/boost/range/adaptor/replaced.hpp @@ -47,7 +47,7 @@ namespace boost }; template< class R > - class replace_range : + class replaced_range : public boost::iterator_range< boost::transform_iterator< replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, @@ -64,7 +64,7 @@ namespace boost public: typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; - replace_range( R& r, value_type from, value_type to ) + replaced_range( R& r, value_type from, value_type to ) : base_t( make_transform_iterator( boost::begin(r), Fn(from, to) ), make_transform_iterator( boost::end(r), Fn(from, to) ) ) { } @@ -83,23 +83,23 @@ namespace boost }; template< class InputRng > - inline replace_range + inline replaced_range operator|( InputRng& r, const replace_holder::type>& f ) { - return replace_range(r, f.val1, f.val2); + return replaced_range(r, f.val1, f.val2); } template< class InputRng > - inline replace_range + inline replaced_range operator|( const InputRng& r, const replace_holder::type>& f ) { - return replace_range(r, f.val1, f.val2); + return replaced_range(r, f.val1, f.val2); } } // 'range_detail' - using range_detail::replace_range; + using range_detail::replaced_range; namespace adaptors { @@ -111,21 +111,21 @@ namespace boost } template - inline replace_range + inline replaced_range replace(InputRange& rng, BOOST_DEDUCED_TYPENAME range_value::type from, BOOST_DEDUCED_TYPENAME range_value::type to) { - return replace_range(rng, from, to); + return replaced_range(rng, from, to); } template - inline replace_range + inline replaced_range replace(const InputRange& rng, BOOST_DEDUCED_TYPENAME range_value::type from, BOOST_DEDUCED_TYPENAME range_value::type to) { - return replace_range(rng, from ,to); + return replaced_range(rng, from ,to); } } // 'adaptors' diff --git a/include/boost/range/adaptor/sliced.hpp b/include/boost/range/adaptor/sliced.hpp index eb506e0..03c6894 100755 --- a/include/boost/range/adaptor/sliced.hpp +++ b/include/boost/range/adaptor/sliced.hpp @@ -28,14 +28,26 @@ namespace boost }; template< class RandomAccessRange > - inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > + class sliced_range : public boost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > + { + typedef boost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > base_t; + public: + template + sliced_range(Rng& rng, T t, U u) + : base_t(boost::make_iterator_range(rng, t, u - boost::size(rng))) + { + } + }; + + template< class RandomAccessRange > + inline sliced_range slice( RandomAccessRange& rng, std::size_t t, std::size_t u ) { BOOST_ASSERT( t <= u && "error in slice indices" ); BOOST_ASSERT( static_cast(boost::size(rng)) >= u && "second slice index out of bounds" ); - return boost::make_iterator_range( rng, t, u - boost::size(rng) ); + return sliced_range(rng, t, u); } template< class RandomAccessRange > @@ -46,23 +58,21 @@ namespace boost BOOST_ASSERT( static_cast(boost::size(rng)) >= u && "second slice index out of bounds" ); - return boost::make_iterator_range( rng, t, u - boost::size(rng) ); + return sliced_range(rng, t, u); } template< class RandomAccessRange > - inline iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type > + inline sliced_range operator|( RandomAccessRange& r, const sliced& f ) { - return adaptors::slice( r, f.t, f.u ); + return sliced_range( r, f.t, f.u ); } template< class RandomAccessRange > - inline iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type > + inline sliced_range operator|( const RandomAccessRange& r, const sliced& f ) { - return adaptors::slice( r, f.t, f.u ); + return sliced_range( r, f.t, f.u ); } } // namespace adaptors diff --git a/include/boost/range/algorithm/copy.hpp b/include/boost/range/algorithm/copy.hpp index dc5a0c3..f15b31f 100644 --- a/include/boost/range/algorithm/copy.hpp +++ b/include/boost/range/algorithm/copy.hpp @@ -30,7 +30,7 @@ namespace boost template< class SinglePassRange, class OutputIterator > inline OutputIterator copy(const SinglePassRange& rng, OutputIterator out) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::copy(boost::begin(rng),boost::end(rng),out); } diff --git a/include/boost/range/algorithm/copy_backward.hpp b/include/boost/range/algorithm/copy_backward.hpp index 52dc922..c95c6f1 100755 --- a/include/boost/range/algorithm/copy_backward.hpp +++ b/include/boost/range/algorithm/copy_backward.hpp @@ -32,7 +32,7 @@ inline BidirectionalTraversalWriteableIterator copy_backward(const BidirectionalRange& rng, BidirectionalTraversalWriteableIterator out) { - BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); return std::copy_backward(boost::begin(rng), boost::end(rng), out); } diff --git a/include/boost/range/algorithm/equal.hpp b/include/boost/range/algorithm/equal.hpp index 7226440..a3ebc29 100755 --- a/include/boost/range/algorithm/equal.hpp +++ b/include/boost/range/algorithm/equal.hpp @@ -159,8 +159,8 @@ namespace boost template< class SinglePassRange1, class SinglePassRange2 > inline bool equal( const SinglePassRange1& rng1, const SinglePassRange2& rng2 ) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return ::boost::range_detail::equal( ::boost::begin(rng1), ::boost::end(rng1), @@ -172,8 +172,8 @@ namespace boost inline bool equal( const SinglePassRange1& rng1, const SinglePassRange2& rng2, BinaryPredicate pred ) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return ::boost::range_detail::equal( ::boost::begin(rng1), ::boost::end(rng1), diff --git a/include/boost/range/algorithm/fill.hpp b/include/boost/range/algorithm/fill.hpp index 72c5d58..95231a8 100755 --- a/include/boost/range/algorithm/fill.hpp +++ b/include/boost/range/algorithm/fill.hpp @@ -33,6 +33,15 @@ inline ForwardRange& fill(ForwardRange& rng, const Value& val) return rng; } +/// \overload +template< class ForwardRange, class Value > +inline const ForwardRange& fill(const ForwardRange& rng, const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::fill(boost::begin(rng), boost::end(rng), val); + return rng; +} + } // namespace range using range::fill; } diff --git a/include/boost/range/algorithm/fill_n.hpp b/include/boost/range/algorithm/fill_n.hpp index 29d7d6f..02a0c2a 100755 --- a/include/boost/range/algorithm/fill_n.hpp +++ b/include/boost/range/algorithm/fill_n.hpp @@ -36,6 +36,16 @@ inline ForwardRange& fill_n(ForwardRange& rng, Size n, const Value& val) return rng; } +/// \overload +template< class ForwardRange, class Size, class Value > +inline const ForwardRange& fill_n(const ForwardRange& rng, Size n, const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_ASSERT( static_cast(std::distance(boost::begin(rng), boost::end(rng))) >= n ); + std::fill_n(boost::begin(rng), n, val); + return rng; +} + } // namespace range using range::fill_n; } // namespace boost diff --git a/include/boost/range/algorithm/find.hpp b/include/boost/range/algorithm/find.hpp index b4bf6d9..72c5cf1 100755 --- a/include/boost/range/algorithm/find.hpp +++ b/include/boost/range/algorithm/find.hpp @@ -27,18 +27,33 @@ namespace boost /// /// \pre SinglePassRange is a model of the SinglePassRangeConcept template< class SinglePassRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find( SinglePassRange& rng, const Value& val ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::find(boost::begin(rng), boost::end(rng), val); } +/// \overload +template< class SinglePassRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find( const SinglePassRange& rng, const Value& val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::find(boost::begin(rng), boost::end(rng), val); +} + // range_return overloads /// \overload template< range_return_value re, class SinglePassRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find( SinglePassRange& rng, const Value& val ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -47,6 +62,17 @@ find( SinglePassRange& rng, const Value& val ) rng); } +/// \overload +template< range_return_value re, class SinglePassRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type +find( const SinglePassRange& rng, const Value& val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return range_return:: + pack(std::find(boost::begin(rng), boost::end(rng), val), + rng); +} + } // namespace range using range::find; } diff --git a/include/boost/range/algorithm/find_end.hpp b/include/boost/range/algorithm/find_end.hpp index 864d4b0..757e999 100755 --- a/include/boost/range/algorithm/find_end.hpp +++ b/include/boost/range/algorithm/find_end.hpp @@ -29,7 +29,10 @@ namespace boost /// \pre ForwardRange2 is a model of the ForwardRangeConcept /// \pre BinaryPredicate is a model of the BinaryPredicateConcept template< class ForwardRange1, class ForwardRange2 > -inline BOOST_DEDUCED_TYPENAME range_iterator< ForwardRange1 >::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator< ForwardRange1 >::type +>::type find_end(ForwardRange1 & rng1, const ForwardRange2& rng2) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -39,9 +42,24 @@ find_end(ForwardRange1 & rng1, const ForwardRange2& rng2) boost::begin(rng2),boost::end(rng2)); } +/// \overload +template< class ForwardRange1, class ForwardRange2 > +inline BOOST_DEDUCED_TYPENAME range_iterator< const ForwardRange1 >::type +find_end(const ForwardRange1 & rng1, const ForwardRange2& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return std::find_end(boost::begin(rng1),boost::end(rng1), + boost::begin(rng2),boost::end(rng2)); +} + /// \overload template< class ForwardRange1, class ForwardRange2, class BinaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find_end(ForwardRange1 & rng1, const ForwardRange2& rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -51,9 +69,24 @@ find_end(ForwardRange1 & rng1, const ForwardRange2& rng2, BinaryPredicate pred) boost::begin(rng2),boost::end(rng2),pred); } +/// \overload +template< class ForwardRange1, class ForwardRange2, class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find_end(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return std::find_end(boost::begin(rng1),boost::end(rng1), + boost::begin(rng2),boost::end(rng2),pred); +} + /// \overload template< range_return_value re, class ForwardRange1, class ForwardRange2 > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_end(ForwardRange1& rng1, const ForwardRange2& rng2) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -65,10 +98,27 @@ find_end(ForwardRange1& rng1, const ForwardRange2& rng2) rng1); } +/// \overload +template< range_return_value re, class ForwardRange1, class ForwardRange2 > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_end(const ForwardRange1& rng1, const ForwardRange2& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return range_return:: + pack(std::find_end(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2)), + rng1); +} + /// \overload template< range_return_value re, class ForwardRange1, class ForwardRange2, class BinaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -80,6 +130,21 @@ find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) rng1); } +/// \overload +template< range_return_value re, class ForwardRange1, class ForwardRange2, + class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_end(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return range_return:: + pack(std::find_end(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2), pred), + rng1); +} + } // namespace range using range::find_end; } // namespace boost diff --git a/include/boost/range/algorithm/find_first_of.hpp b/include/boost/range/algorithm/find_first_of.hpp index f7543b7..4cb5989 100755 --- a/include/boost/range/algorithm/find_first_of.hpp +++ b/include/boost/range/algorithm/find_first_of.hpp @@ -29,7 +29,10 @@ namespace boost /// \pre ForwardRange2 is a model of the ForwardRangeConcept /// \pre BinaryPredicate is a model of the BinaryPredicateConcept template< class SinglePassRange1, class ForwardRange2 > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -39,9 +42,24 @@ find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2) boost::begin(rng2),boost::end(rng2)); } +/// \overload +template< class SinglePassRange1, class ForwardRange2 > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return std::find_first_of(boost::begin(rng1),boost::end(rng1), + boost::begin(rng2),boost::end(rng2)); +} + /// \overload template< class SinglePassRange1, class ForwardRange2, class BinaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -51,10 +69,25 @@ find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2, BinaryPredica boost::begin(rng2),boost::end(rng2),pred); } +/// \overload +template< class SinglePassRange1, class ForwardRange2, class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return std::find_first_of(boost::begin(rng1),boost::end(rng1), + boost::begin(rng2),boost::end(rng2),pred); +} + // range return overloads /// \overload template< range_return_value re, class SinglePassRange1, class ForwardRange2 > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -66,10 +99,27 @@ find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2) rng1); } +/// \overload +template< range_return_value re, class SinglePassRange1, class ForwardRange2 > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return range_return:: + pack(std::find_first_of(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2)), + rng1); +} + /// \overload template< range_return_value re, class SinglePassRange1, class ForwardRange2, class BinaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_first_of(SinglePassRange1 & rng1, const ForwardRange2& rng2, BinaryPredicate pred) { @@ -82,6 +132,22 @@ find_first_of(SinglePassRange1 & rng1, const ForwardRange2& rng2, rng1); } +/// \overload +template< range_return_value re, class SinglePassRange1, class ForwardRange2, + class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_first_of(const SinglePassRange1 & rng1, const ForwardRange2& rng2, + BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return range_return:: + pack(std::find_first_of(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2), pred), + rng1); +} + } // namespace range using range::find_first_of; } // namespace boost diff --git a/include/boost/range/algorithm/find_if.hpp b/include/boost/range/algorithm/find_if.hpp index 3254d8c..2d1926d 100755 --- a/include/boost/range/algorithm/find_if.hpp +++ b/include/boost/range/algorithm/find_if.hpp @@ -28,18 +28,33 @@ namespace boost /// \pre SinglePassRange is a model of the SinglePassRangeConcept /// \pre UnaryPredicate is a model of the UnaryPredicateConcept template< class SinglePassRange, class UnaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find_if( SinglePassRange& rng, UnaryPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::find_if(boost::begin(rng), boost::end(rng), pred); } +/// \overload +template< class SinglePassRange, class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find_if( const SinglePassRange& rng, UnaryPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::find_if(boost::begin(rng), boost::end(rng), pred); +} + // range_return overloads /// \overload template< range_return_value re, class SinglePassRange, class UnaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_if( SinglePassRange& rng, UnaryPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -48,6 +63,17 @@ find_if( SinglePassRange& rng, UnaryPredicate pred ) rng); } +/// \overload +template< range_return_value re, class SinglePassRange, class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_if( const SinglePassRange& rng, UnaryPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return range_return:: + pack(std::find_if(boost::begin(rng), boost::end(rng), pred), + rng); +} + } // namespace range using range::find_if; } // namespace boost diff --git a/include/boost/range/algorithm/generate.hpp b/include/boost/range/algorithm/generate.hpp index bd63a48..324412c 100755 --- a/include/boost/range/algorithm/generate.hpp +++ b/include/boost/range/algorithm/generate.hpp @@ -33,6 +33,15 @@ inline ForwardRange& generate( ForwardRange& rng, Generator gen ) return rng; } +/// \overload +template< class ForwardRange, class Generator > +inline const ForwardRange& generate( const ForwardRange& rng, Generator gen ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::generate(boost::begin(rng), boost::end(rng), gen); + return rng; +} + } // namespace range using range::generate; } // namespace boost diff --git a/include/boost/range/algorithm/heap_algorithm.hpp b/include/boost/range/algorithm/heap_algorithm.hpp index 64df3e9..584920d 100755 --- a/include/boost/range/algorithm/heap_algorithm.hpp +++ b/include/boost/range/algorithm/heap_algorithm.hpp @@ -34,6 +34,15 @@ inline RandomAccessRange& push_heap(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& push_heap(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::push_heap(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& push_heap(RandomAccessRange& rng, Compare comp_pred) @@ -43,6 +52,15 @@ inline RandomAccessRange& push_heap(RandomAccessRange& rng, Compare comp_pred) return rng; } +/// \overload +template +inline const RandomAccessRange& push_heap(const RandomAccessRange& rng, Compare comp_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::push_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; +} + /// \brief template function pop_heap /// /// range-based version of the pop_heap std algorithm @@ -57,6 +75,15 @@ inline RandomAccessRange& pop_heap(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& pop_heap(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::pop_heap(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare comp_pred) @@ -66,6 +93,15 @@ inline RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare comp_pred) return rng; } +/// \overload +template +inline const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare comp_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::pop_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; +} + /// \brief template function make_heap /// /// range-based version of the make_heap std algorithm @@ -80,6 +116,15 @@ inline RandomAccessRange& make_heap(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& make_heap(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::make_heap(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& make_heap(RandomAccessRange& rng, Compare comp_pred) @@ -89,6 +134,15 @@ inline RandomAccessRange& make_heap(RandomAccessRange& rng, Compare comp_pred) return rng; } +/// \overload +template +inline const RandomAccessRange& make_heap(const RandomAccessRange& rng, Compare comp_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::make_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; +} + /// \brief template function sort_heap /// /// range-based version of the sort_heap std algorithm @@ -103,6 +157,15 @@ inline RandomAccessRange& sort_heap(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& sort_heap(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::sort_heap(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare comp_pred) @@ -112,6 +175,15 @@ inline RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare comp_pred) return rng; } +/// \overload +template +inline const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare comp_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::sort_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; +} + } // namespace range using range::push_heap; using range::pop_heap; diff --git a/include/boost/range/algorithm/lower_bound.hpp b/include/boost/range/algorithm/lower_bound.hpp index 5d3945e..cb5e639 100755 --- a/include/boost/range/algorithm/lower_bound.hpp +++ b/include/boost/range/algorithm/lower_bound.hpp @@ -27,23 +27,52 @@ namespace boost /// /// \pre ForwardRange is a model of the ForwardRangeConcept template< class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type lower_bound( ForwardRange& rng, Value val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::lower_bound(boost::begin(rng), boost::end(rng), val); } + +/// \overload +template< class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +lower_bound( const ForwardRange& rng, Value val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::lower_bound(boost::begin(rng), boost::end(rng), val); +} + /// \overload template< class ForwardRange, class Value, class SortPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type lower_bound( ForwardRange& rng, Value val, SortPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::lower_bound(boost::begin(rng), boost::end(rng), val, pred); } + +/// \overload +template< class ForwardRange, class Value, class SortPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +lower_bound( const ForwardRange& rng, Value val, SortPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::lower_bound(boost::begin(rng), boost::end(rng), val, pred); +} + /// \overload template< range_return_value re, class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type lower_bound( ForwardRange& rng, Value val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -51,9 +80,24 @@ lower_bound( ForwardRange& rng, Value val ) pack(std::lower_bound(boost::begin(rng), boost::end(rng), val), rng); } + +/// \overload +template< range_return_value re, class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type +lower_bound( const ForwardRange& rng, Value val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return:: + pack(std::lower_bound(boost::begin(rng), boost::end(rng), val), + rng); +} + /// \overload template< range_return_value re, class ForwardRange, class Value, class SortPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type lower_bound( ForwardRange& rng, Value val, SortPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -62,6 +106,17 @@ lower_bound( ForwardRange& rng, Value val, SortPredicate pred ) rng); } +/// \overload +template< range_return_value re, class ForwardRange, class Value, class SortPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +lower_bound( const ForwardRange& rng, Value val, SortPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return:: + pack(std::lower_bound(boost::begin(rng), boost::end(rng), val, pred), + rng); +} + } // namespace range using range::lower_bound; } // namespace boost diff --git a/include/boost/range/algorithm/partial_sort.hpp b/include/boost/range/algorithm/partial_sort.hpp index 1797c55..d7044cd 100755 --- a/include/boost/range/algorithm/partial_sort.hpp +++ b/include/boost/range/algorithm/partial_sort.hpp @@ -35,6 +35,16 @@ inline RandomAccessRange& partial_sort(RandomAccessRange& rng, return rng; } +/// \overload +template +inline const RandomAccessRange& partial_sort(const RandomAccessRange& rng, + BOOST_DEDUCED_TYPENAME range_iterator::type middle) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::partial_sort(boost::begin(rng), middle, boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& partial_sort(RandomAccessRange& rng, @@ -47,6 +57,18 @@ inline RandomAccessRange& partial_sort(RandomAccessRange& rng, return rng; } +/// \overload +template +inline const RandomAccessRange& partial_sort(const RandomAccessRange& rng, + BOOST_DEDUCED_TYPENAME range_iterator::type middle, + BinaryPredicate sort_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::partial_sort(boost::begin(rng), middle, boost::end(rng), + sort_pred); + return rng; +} + } // namespace range using range::partial_sort; } // namespace boost diff --git a/include/boost/range/algorithm/partial_sort_copy.hpp b/include/boost/range/algorithm/partial_sort_copy.hpp index a2fe761..9129389 100755 --- a/include/boost/range/algorithm/partial_sort_copy.hpp +++ b/include/boost/range/algorithm/partial_sort_copy.hpp @@ -32,7 +32,18 @@ template inline BOOST_DEDUCED_TYPENAME range_iterator::type partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2) { - BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2)); +} + +/// \overload +template +inline BOOST_DEDUCED_TYPENAME range_iterator::type +partial_sort_copy(const SinglePassRange& rng1, const RandomAccessRange& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), boost::begin(rng2), boost::end(rng2)); @@ -45,7 +56,20 @@ inline BOOST_DEDUCED_TYPENAME range_iterator::type partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2, BinaryPredicate pred) { - BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2), pred); +} + +/// \overload +template +inline BOOST_DEDUCED_TYPENAME range_iterator::type +partial_sort_copy(const SinglePassRange& rng1, const RandomAccessRange& rng2, + BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), boost::begin(rng2), boost::end(rng2), pred); diff --git a/include/boost/range/algorithm/partition.hpp b/include/boost/range/algorithm/partition.hpp index 6404918..b814a24 100755 --- a/include/boost/range/algorithm/partition.hpp +++ b/include/boost/range/algorithm/partition.hpp @@ -34,6 +34,15 @@ partition(ForwardRange& rng, UnaryPredicate pred) return std::partition(boost::begin(rng),boost::end(rng),pred); } +/// \overload +template +inline BOOST_DEDUCED_TYPENAME range_iterator::type +partition(const ForwardRange& rng, UnaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::partition(boost::begin(rng),boost::end(rng),pred); +} + // range_return overloads /// \overload @@ -47,6 +56,17 @@ partition(ForwardRange& rng, UnaryPredicate pred) pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng); } +/// \overload +template< range_return_value re, class ForwardRange, + class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +partition(const ForwardRange& rng, UnaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return boost::range_return:: + pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng); +} + } // namespace range using range::partition; } // namespace boost diff --git a/include/boost/range/algorithm/random_shuffle.hpp b/include/boost/range/algorithm/random_shuffle.hpp index 0b17333..95bbd97 100755 --- a/include/boost/range/algorithm/random_shuffle.hpp +++ b/include/boost/range/algorithm/random_shuffle.hpp @@ -34,6 +34,15 @@ inline RandomAccessRange& random_shuffle(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::random_shuffle(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen) @@ -43,6 +52,15 @@ inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen) return rng; } +/// \overload +template +inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng, Generator& gen) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::random_shuffle(boost::begin(rng), boost::end(rng), gen); + return rng; +} + } // namespace range using range::random_shuffle; } // namespace boost diff --git a/include/boost/range/algorithm/remove.hpp b/include/boost/range/algorithm/remove.hpp index 638dff2..699a7cd 100755 --- a/include/boost/range/algorithm/remove.hpp +++ b/include/boost/range/algorithm/remove.hpp @@ -34,6 +34,15 @@ remove(ForwardRange& rng, const Value& val) return std::remove(boost::begin(rng),boost::end(rng),val); } +/// \overload +template< class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +remove(const ForwardRange& rng, const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::remove(boost::begin(rng),boost::end(rng),val); +} + // range_return overloads /// \overload @@ -47,6 +56,17 @@ remove(ForwardRange& rng, const Value& val) rng); } +/// \overload +template< range_return_value re, class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type +remove(const ForwardRange& rng, const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return::pack( + std::remove(boost::begin(rng), boost::end(rng), val), + rng); +} + } // namespace range using range::remove; } // namespace boost diff --git a/include/boost/range/algorithm/remove_copy.hpp b/include/boost/range/algorithm/remove_copy.hpp index 0d3d83d..b65747e 100755 --- a/include/boost/range/algorithm/remove_copy.hpp +++ b/include/boost/range/algorithm/remove_copy.hpp @@ -31,9 +31,9 @@ namespace boost /// InputIterator's value type. template< class SinglePassRange, class OutputIterator, class Value > inline OutputIterator -remove_copy(SinglePassRange& rng, OutputIterator out_it, const Value& val) +remove_copy(const SinglePassRange& rng, OutputIterator out_it, const Value& val) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::remove_copy(boost::begin(rng), boost::end(rng), out_it, val); } diff --git a/include/boost/range/algorithm/remove_copy_if.hpp b/include/boost/range/algorithm/remove_copy_if.hpp index 791a38f..8d9c37b 100755 --- a/include/boost/range/algorithm/remove_copy_if.hpp +++ b/include/boost/range/algorithm/remove_copy_if.hpp @@ -28,10 +28,10 @@ namespace boost /// \pre out_it is not an iterator in the range rng template< class SinglePassRange, class OutputIterator, class Predicate > inline OutputIterator - remove_copy_if(SinglePassRange& rng, OutputIterator out_it, Predicate pred) + remove_copy_if(const SinglePassRange& rng, OutputIterator out_it, Predicate pred) { - boost::function_requires< SinglePassRangeConcept >(); - return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred); } } diff --git a/include/boost/range/algorithm/remove_if.hpp b/include/boost/range/algorithm/remove_if.hpp index 349e7a4..a965df0 100755 --- a/include/boost/range/algorithm/remove_if.hpp +++ b/include/boost/range/algorithm/remove_if.hpp @@ -35,6 +35,15 @@ remove_if(ForwardRange& rng, UnaryPredicate pred) return std::remove_if(boost::begin(rng), boost::end(rng), pred); } +/// \overload +template< class ForwardRange, class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type +remove_if(const ForwardRange& rng, UnaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::remove_if(boost::begin(rng), boost::end(rng), pred); +} + // range_return overloads /// \overload @@ -48,6 +57,17 @@ remove_if(ForwardRange& rng, UnaryPredicate pred) rng); } +/// \overload +template< range_return_value re, class ForwardRange, class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +remove_if(const ForwardRange& rng, UnaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return::pack( + std::remove_if(boost::begin(rng), boost::end(rng), pred), + rng); +} + } // namespace range using range::remove_if; } // namespace boost diff --git a/include/boost/range/algorithm/replace.hpp b/include/boost/range/algorithm/replace.hpp index 3f2d72c..44d3e4c 100755 --- a/include/boost/range/algorithm/replace.hpp +++ b/include/boost/range/algorithm/replace.hpp @@ -35,6 +35,17 @@ replace(ForwardRange& rng, const Value& what, return rng; } +/// \overload +template< class ForwardRange, class Value > +inline const ForwardRange& +replace(const ForwardRange& rng, const Value& what, + const Value& with_what) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::replace(boost::begin(rng), boost::end(rng), what, with_what); + return rng; +} + } // namespace range using range::replace; } // namespace boost; diff --git a/include/boost/range/algorithm/replace_copy.hpp b/include/boost/range/algorithm/replace_copy.hpp index 36c91ce..0c02005 100755 --- a/include/boost/range/algorithm/replace_copy.hpp +++ b/include/boost/range/algorithm/replace_copy.hpp @@ -27,10 +27,10 @@ namespace boost /// \pre ForwardRange is a model of the ForwardRangeConcept template< class ForwardRange, class OutputIterator, class Value > inline OutputIterator -replace_copy(ForwardRange& rng, OutputIterator out_it, const Value& what, +replace_copy(const ForwardRange& rng, OutputIterator out_it, const Value& what, const Value& with_what) { - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::replace_copy(boost::begin(rng), boost::end(rng), out_it, what, with_what); } diff --git a/include/boost/range/algorithm/replace_copy_if.hpp b/include/boost/range/algorithm/replace_copy_if.hpp index 5d4bfb6..d313151 100755 --- a/include/boost/range/algorithm/replace_copy_if.hpp +++ b/include/boost/range/algorithm/replace_copy_if.hpp @@ -31,10 +31,10 @@ namespace boost /// \pre Value is convertible to a type in OutputIterator's set of value types. template< class ForwardRange, class OutputIterator, class Predicate, class Value > inline OutputIterator -replace_copy_if(ForwardRange& rng, OutputIterator out_it, Predicate pred, +replace_copy_if(const ForwardRange& rng, OutputIterator out_it, Predicate pred, const Value& with_what) { - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::replace_copy_if(boost::begin(rng), boost::end(rng), out_it, pred, with_what); } diff --git a/include/boost/range/algorithm/replace_if.hpp b/include/boost/range/algorithm/replace_if.hpp index 393a4ca..93d5a1f 100755 --- a/include/boost/range/algorithm/replace_if.hpp +++ b/include/boost/range/algorithm/replace_if.hpp @@ -36,6 +36,17 @@ inline ForwardRange& return rng; } +/// \overload +template< class ForwardRange, class UnaryPredicate, class Value > +inline const ForwardRange& + replace_if(const ForwardRange& rng, UnaryPredicate pred, + const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::replace_if(boost::begin(rng), boost::end(rng), pred, val); + return rng; +} + } // namespace range using range::replace_if; } // namespace boost diff --git a/include/boost/range/algorithm/reverse.hpp b/include/boost/range/algorithm/reverse.hpp index 8741d66..20a7eb1 100755 --- a/include/boost/range/algorithm/reverse.hpp +++ b/include/boost/range/algorithm/reverse.hpp @@ -34,6 +34,15 @@ inline BidirectionalRange& reverse(BidirectionalRange& rng) return rng; } +/// \overload +template +inline const BidirectionalRange& reverse(const BidirectionalRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); + std::reverse(boost::begin(rng), boost::end(rng)); + return rng; +} + } // namespace range using range::reverse; } // namespace boost diff --git a/include/boost/range/algorithm/reverse_copy.hpp b/include/boost/range/algorithm/reverse_copy.hpp index d86145d..f1990ad 100755 --- a/include/boost/range/algorithm/reverse_copy.hpp +++ b/include/boost/range/algorithm/reverse_copy.hpp @@ -29,7 +29,7 @@ namespace boost template inline OutputIterator reverse_copy(const BidirectionalRange& rng, OutputIterator out) { - BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); return std::reverse_copy(boost::begin(rng), boost::end(rng), out); } diff --git a/include/boost/range/algorithm/rotate.hpp b/include/boost/range/algorithm/rotate.hpp index aef6062..ca4b223 100755 --- a/include/boost/range/algorithm/rotate.hpp +++ b/include/boost/range/algorithm/rotate.hpp @@ -34,6 +34,16 @@ inline ForwardRange& rotate(ForwardRange& rng, return rng; } +/// \overload +template +inline const ForwardRange& rotate(const ForwardRange& rng, + BOOST_DEDUCED_TYPENAME range_iterator::type middle) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::rotate(boost::begin(rng), middle, boost::end(rng)); + return rng; +} + } // namespace range using range::rotate; } // namespace boost diff --git a/include/boost/range/algorithm/search_n.hpp b/include/boost/range/algorithm/search_n.hpp index 2ced140..b69bc6d 100755 --- a/include/boost/range/algorithm/search_n.hpp +++ b/include/boost/range/algorithm/search_n.hpp @@ -44,7 +44,7 @@ template< class ForwardRange, class Integer, class Value > inline BOOST_DEDUCED_TYPENAME range_iterator::type search_n(const ForwardRange& rng, Integer count, const Value& value) { - BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); return std::search_n(boost::begin(rng), boost::end(rng), count, value); } @@ -69,7 +69,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator::type search_n(const ForwardRange& rng, Integer count, const Value& value, BinaryPredicate binary_pred) { - BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, const Value&>)); return std::search_n(boost::begin(rng), boost::end(rng), @@ -97,7 +97,7 @@ template< range_return_value re, class ForwardRange, class Integer, inline BOOST_DEDUCED_TYPENAME range_return::type search_n(const ForwardRange& rng, Integer count, const Value& value) { - BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); return range_return:: pack(std::search_n(boost::begin(rng), boost::end(rng), count, value), @@ -128,7 +128,7 @@ inline BOOST_DEDUCED_TYPENAME range_return::type search_n(const ForwardRange& rng, Integer count, const Value& value, BinaryPredicate pred) { - BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, const Value&>)); diff --git a/include/boost/range/algorithm/sort.hpp b/include/boost/range/algorithm/sort.hpp index 0c6e3b2..45eecde 100755 --- a/include/boost/range/algorithm/sort.hpp +++ b/include/boost/range/algorithm/sort.hpp @@ -34,6 +34,15 @@ inline RandomAccessRange& sort(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& sort(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::sort(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred) @@ -43,6 +52,15 @@ inline RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred) return rng; } +/// \overload +template +inline const RandomAccessRange& sort(const RandomAccessRange& rng, BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::sort(boost::begin(rng), boost::end(rng), pred); + return rng; +} + } // namespace range using range::sort; } // namespace boost diff --git a/include/boost/range/algorithm/stable_sort.hpp b/include/boost/range/algorithm/stable_sort.hpp index 6a27aa4..d18da4d 100755 --- a/include/boost/range/algorithm/stable_sort.hpp +++ b/include/boost/range/algorithm/stable_sort.hpp @@ -34,6 +34,15 @@ inline RandomAccessRange& stable_sort(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::stable_sort(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate sort_pred) @@ -43,6 +52,15 @@ inline RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate so return rng; } +/// \overload +template +inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng, BinaryPredicate sort_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::stable_sort(boost::begin(rng), boost::end(rng), sort_pred); + return rng; +} + } // namespace range using range::stable_sort; } // namespace boost diff --git a/include/boost/range/algorithm/swap_ranges.hpp b/include/boost/range/algorithm/swap_ranges.hpp index 5b8967a..52b0162 100755 --- a/include/boost/range/algorithm/swap_ranges.hpp +++ b/include/boost/range/algorithm/swap_ranges.hpp @@ -80,6 +80,51 @@ swap_ranges(SinglePassRange1& range1, SinglePassRange2& range2) return range2; } +/// \overload +template< class SinglePassRange1, class SinglePassRange2 > +inline SinglePassRange2& +swap_ranges(const SinglePassRange1& range1, SinglePassRange2& range2) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + boost::range_detail::swap_ranges_impl( + boost::begin(range1), boost::end(range1), + boost::begin(range2), boost::end(range2)); + + return range2; +} + +/// \overload +template< class SinglePassRange1, class SinglePassRange2 > +inline const SinglePassRange2& +swap_ranges(SinglePassRange1& range1, const SinglePassRange2& range2) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + boost::range_detail::swap_ranges_impl( + boost::begin(range1), boost::end(range1), + boost::begin(range2), boost::end(range2)); + + return range2; +} + +/// \overload +template< class SinglePassRange1, class SinglePassRange2 > +inline const SinglePassRange2& +swap_ranges(const SinglePassRange1& range1, const SinglePassRange2& range2) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + boost::range_detail::swap_ranges_impl( + boost::begin(range1), boost::end(range1), + boost::begin(range2), boost::end(range2)); + + return range2; +} + } // namespace range using range::swap_ranges; } // namespace boost diff --git a/include/boost/range/algorithm/upper_bound.hpp b/include/boost/range/algorithm/upper_bound.hpp index 8aa26bd..c8acbc6 100755 --- a/include/boost/range/algorithm/upper_bound.hpp +++ b/include/boost/range/algorithm/upper_bound.hpp @@ -27,24 +27,53 @@ namespace boost /// /// \pre ForwardRange is a model of the ForwardRangeConcept template< class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline +BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type upper_bound( ForwardRange& rng, Value val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::upper_bound(boost::begin(rng), boost::end(rng), val); } + /// \overload +template< class ForwardRange, class Value > +BOOST_DEDUCED_TYPENAME range_iterator::type +upper_bound( const ForwardRange& rng, Value val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::upper_bound(boost::begin(rng), boost::end(rng), val); +} + /// \overload template< class ForwardRange, class Value, class SortPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type upper_bound( ForwardRange& rng, Value val, SortPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::upper_bound(boost::begin(rng), boost::end(rng), val, pred); } + +/// \overload +template< class ForwardRange, class Value, class SortPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +upper_bound( const ForwardRange& rng, Value val, SortPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::upper_bound(boost::begin(rng), boost::end(rng), val, pred); +} + /// \overload template< range_return_value re, class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type upper_bound( ForwardRange& rng, Value val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -52,10 +81,25 @@ upper_bound( ForwardRange& rng, Value val ) pack(std::upper_bound(boost::begin(rng), boost::end(rng), val), rng); } + +/// \overload +template< range_return_value re, class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type +upper_bound( const ForwardRange& rng, Value val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return:: + pack(std::upper_bound(boost::begin(rng), boost::end(rng), val), + rng); +} + /// \overload template< range_return_value re, class ForwardRange, class Value, class SortPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type upper_bound( ForwardRange& rng, Value val, SortPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -64,6 +108,18 @@ upper_bound( ForwardRange& rng, Value val, SortPredicate pred ) rng); } +/// \overload +template< range_return_value re, class ForwardRange, class Value, + class SortPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +upper_bound( const ForwardRange& rng, Value val, SortPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return:: + pack(std::upper_bound(boost::begin(rng), boost::end(rng), val, pred), + rng); +} + } // namespace range using range::upper_bound; } // namespace boost diff --git a/include/boost/range/algorithm_ext/iota.hpp b/include/boost/range/algorithm_ext/iota.hpp index 65cbc89..f7af446 100644 --- a/include/boost/range/algorithm_ext/iota.hpp +++ b/include/boost/range/algorithm_ext/iota.hpp @@ -34,6 +34,19 @@ inline ForwardRange& iota( ForwardRange& rng, Value x ) return rng; } +template< class ForwardRange, class Value > +inline const ForwardRange& iota( const ForwardRange& rng, Value x ) +{ + BOOST_CONCEPT_ASSERT(( ForwardRangeConcept )); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; + + iterator_t last_target = ::boost::end(rng); + for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x) + *target = x; + + return rng; +} + } // namespace range using range::iota; } // namespace boost diff --git a/include/boost/range/algorithm_ext/is_sorted.hpp b/include/boost/range/algorithm_ext/is_sorted.hpp index 69ead10..54fc038 100755 --- a/include/boost/range/algorithm_ext/is_sorted.hpp +++ b/include/boost/range/algorithm_ext/is_sorted.hpp @@ -51,7 +51,7 @@ template inline bool is_sorted(const SinglePassRange& rng) { BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); - BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept::type>)); + BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept::type>)); return range_detail::is_sorted(boost::begin(rng), boost::end(rng)); } @@ -59,8 +59,8 @@ inline bool is_sorted(const SinglePassRange& rng) template inline bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred) { - BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); - BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, BOOST_DEDUCED_TYPENAME range_value::type>)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, BOOST_DEDUCED_TYPENAME range_value::type>)); return range_detail::is_sorted(boost::begin(rng), boost::end(rng), pred); } diff --git a/include/boost/range/algorithm_ext/overwrite.hpp b/include/boost/range/algorithm_ext/overwrite.hpp index d2cf4ed..f84f6ea 100755 --- a/include/boost/range/algorithm_ext/overwrite.hpp +++ b/include/boost/range/algorithm_ext/overwrite.hpp @@ -50,6 +50,33 @@ inline void overwrite( const SinglePassRange1& from, SinglePassRange2& to ) } } +template< class SinglePassRange1, class SinglePassRange2 > +inline void overwrite( const SinglePassRange1& from, const SinglePassRange2& to ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + + BOOST_DEDUCED_TYPENAME range_iterator::type + i = boost::begin(from), e = boost::end(from); + + BOOST_DEDUCED_TYPENAME range_iterator::type + out = boost::begin(to); + +#ifndef NDEBUG + BOOST_DEDUCED_TYPENAME range_iterator::type + last_out = boost::end(to); +#endif + + for( ; i != e; ++out, ++i ) + { +#ifndef NDEBUG + BOOST_ASSERT( out != last_out + && "out of bounds in boost::overwrite()" ); +#endif + *out = *i; + } +} + } // namespace range using range::overwrite; } // namespace boost diff --git a/include/boost/range/detail/join_iterator.hpp b/include/boost/range/detail/join_iterator.hpp index 76ebbfe..d22292b 100644 --- a/include/boost/range/detail/join_iterator.hpp +++ b/include/boost/range/detail/join_iterator.hpp @@ -12,9 +12,9 @@ #define BOOST_RANGE_DETAIL_JOIN_ITERATOR_HPP_INCLUDED #include +#include #include #include -#include #include #include #include @@ -30,21 +30,6 @@ namespace boost template struct join_iterator_link { -private: - class reference_count_t - { - public: - reference_count_t() : m_count(0u) {} - reference_count_t(const reference_count_t&) : m_count(0u) {} - reference_count_t& operator=(const reference_count_t&) { return *this; } - - void increment() { ++m_count; } - bool decrement() { return --m_count ? false : true; } - - private: - unsigned int m_count; - }; - public: join_iterator_link(Iterator1 last1, Iterator2 first2) : last1(last1) @@ -52,38 +37,13 @@ public: { } - void add_reference() const - { - count.increment(); - } - - bool release_reference() const - { - return count.decrement(); - } - Iterator1 last1; Iterator2 first2; private: join_iterator_link() /* = delete */ ; - - mutable reference_count_t count; }; -template -inline void intrusive_ptr_add_ref(const join_iterator_link* p) -{ - p->add_reference(); -} - -template -inline void intrusive_ptr_release(const join_iterator_link* p) -{ - if (p->release_reference()) - delete p; -} - class join_iterator_begin_tag {}; class join_iterator_end_tag {}; @@ -174,12 +134,16 @@ public: typedef Iterator1 iterator1_t; typedef Iterator2 iterator2_t; - join_iterator() : m_section(0u) {} + join_iterator() + : m_section(0u) + , m_it(0u, iterator1_t(), iterator2_t()) + , m_link(link_t(iterator1_t(), iterator2_t())) + {} join_iterator(unsigned int section, Iterator1 current1, Iterator1 last1, Iterator2 first2, Iterator2 current2) : m_section(section) , m_it(section, current1, current2) - , m_link(new link_t(last1, first2)) + , m_link(link_t(last1, first2)) { } @@ -187,7 +151,7 @@ public: join_iterator(Range1& r1, Range2& r2, join_iterator_begin_tag) : m_section(boost::empty(r1) ? 1u : 0u) , m_it(boost::empty(r1) ? 1u : 0u, boost::begin(r1), boost::begin(r2)) - , m_link(new link_t(boost::end(r1), boost::begin(r2))) + , m_link(link_t(boost::end(r1), boost::begin(r2))) { } @@ -195,7 +159,7 @@ public: join_iterator(const Range1& r1, const Range2& r2, join_iterator_begin_tag) : m_section(boost::empty(r1) ? 1u : 0u) , m_it(boost::empty(r1) ? 1u : 0u, boost::const_begin(r1), boost::const_begin(r2)) - , m_link(new link_t(boost::const_end(r1), boost::const_begin(r2))) + , m_link(link_t(boost::const_end(r1), boost::const_begin(r2))) { } @@ -203,7 +167,7 @@ public: join_iterator(Range1& r1, Range2& r2, join_iterator_end_tag) : m_section(1u) , m_it(1u, boost::end(r1), boost::end(r2)) - , m_link(new link_t(boost::end(r1), boost::begin(r2))) + , m_link(link_t(boost::end(r1), boost::begin(r2))) { } @@ -211,7 +175,7 @@ public: join_iterator(const Range1& r1, const Range2& r2, join_iterator_end_tag) : m_section(1u) , m_it(1u, boost::const_end(r1), boost::const_end(r2)) - , m_link(new link_t(boost::const_end(r1), boost::const_begin(r2))) + , m_link(link_t(boost::const_end(r1), boost::const_begin(r2))) { } @@ -223,9 +187,9 @@ private: else { ++m_it.it1(); - if (m_it.it1() == m_link->last1) + if (m_it.it1() == m_link.last1) { - m_it.it2() = m_link->first2; + m_it.it2() = m_link.first2; m_section = 1u; } } @@ -235,9 +199,9 @@ private: { if (m_section) { - if (m_it.it2() == m_link->first2) + if (m_it.it2() == m_link.first2) { - m_it.it1() = boost::prior(m_link->last1); + m_it.it1() = boost::prior(m_link.last1); m_section = 0u; } else @@ -275,8 +239,8 @@ private: result = other.m_it.it2() - m_it.it2(); else { - result = (m_link->first2 - m_it.it2()) - + (other.m_it.it1() - m_link->last1); + result = (m_link.first2 - m_it.it2()) + + (other.m_it.it1() - m_link.last1); BOOST_ASSERT( result <= 0 ); } @@ -285,8 +249,8 @@ private: { if (other.m_section) { - result = (m_link->last1 - m_it.it1()) - + (other.m_it.it2() - m_link->first2); + result = (m_link.last1 - m_it.it1()) + + (other.m_it.it2() - m_link.first2); } else result = other.m_it.it1() - m_it.it1(); @@ -300,7 +264,7 @@ private: BOOST_ASSERT( m_section == 1u ); if (offset < 0) { - difference_t r2_dist = m_link->first2 - m_it.it2(); + difference_t r2_dist = m_link.first2 - m_it.it2(); BOOST_ASSERT( r2_dist <= 0 ); if (offset >= r2_dist) std::advance(m_it.it2(), offset); @@ -308,7 +272,7 @@ private: { difference_t r1_dist = offset - r2_dist; BOOST_ASSERT( r1_dist <= 0 ); - m_it.it1() = m_link->last1 + r1_dist; + m_it.it1() = m_link.last1 + r1_dist; m_section = 0u; } } @@ -322,7 +286,7 @@ private: BOOST_ASSERT( m_section == 0u ); if (offset > 0) { - difference_t r1_dist = m_link->last1 - m_it.it1(); + difference_t r1_dist = m_link.last1 - m_it.it1(); BOOST_ASSERT( r1_dist >= 0 ); if (offset < r1_dist) std::advance(m_it.it1(), offset); @@ -330,7 +294,7 @@ private: { difference_t r2_dist = offset - r1_dist; BOOST_ASSERT( r2_dist >= 0 ); - m_it.it2() = m_link->first2 + r2_dist; + m_it.it2() = m_link.first2 + r2_dist; m_section = 1u; } } @@ -340,7 +304,7 @@ private: unsigned int m_section; iterator_union m_it; - intrusive_ptr m_link; + link_t m_link; friend class ::boost::iterator_core_access; }; diff --git a/include/boost/range/irange.hpp b/include/boost/range/irange.hpp index ee25d45..8045550 100644 --- a/include/boost/range/irange.hpp +++ b/include/boost/range/irange.hpp @@ -173,28 +173,54 @@ namespace boost } // namespace range_detail template - iterator_range< range_detail::integer_iterator > - irange(Integer first, Integer last) + class integer_range + : public iterator_range< range_detail::integer_iterator > + { + typedef range_detail::integer_iterator iterator_t; + typedef iterator_range base_t; + public: + integer_range(Integer first, Integer last) + : base_t(iterator_t(first), iterator_t(last)) + { + } + }; + + template + class strided_integer_range + : public iterator_range< range_detail::integer_iterator_with_step > + { + typedef range_detail::integer_iterator_with_step iterator_t; + typedef iterator_range base_t; + public: + template + strided_integer_range(Iterator first, Iterator last) + : base_t(first, last) + { + } + }; + + template + integer_range + irange(Integer first, Integer last) { BOOST_ASSERT( first <= last ); - return boost::iterator_range< range_detail::integer_iterator >( - range_detail::integer_iterator(first), - range_detail::integer_iterator(last)); + return integer_range(first, last); } template - iterator_range< range_detail::integer_iterator_with_step > + strided_integer_range irange(Integer first, Integer last, StepSize step_size) { BOOST_ASSERT( step_size != 0 ); BOOST_ASSERT( (step_size > 0) ? (last >= first) : (last <= first) ); + typedef typename range_detail::integer_iterator_with_step iterator_t; const std::ptrdiff_t last_step = (static_cast(last) - static_cast(first)) / (static_cast(step_size)); - return boost::iterator_range< iterator_t >( + return strided_integer_range( iterator_t(first, 0, step_size), iterator_t(first, last_step, step_size)); } diff --git a/include/boost/range/join.hpp b/include/boost/range/join.hpp index 518026c..ad0217e 100644 --- a/include/boost/range/join.hpp +++ b/include/boost/range/join.hpp @@ -18,49 +18,64 @@ namespace boost { + namespace range_detail + { template -iterator_range::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME add_const< - BOOST_DEDUCED_TYPENAME range_value::type>::type> -> +class joined_type +{ +public: + typedef iterator_range< + range_detail::join_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_value::type + > + > type; +}; + + } // namespace range_detail + +template +class joined_range + : public range_detail::joined_type::type +{ + typedef range_detail::join_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_value::type + > iterator_t; + + typedef BOOST_DEDUCED_TYPENAME range_detail::joined_type< + SinglePassRange1, SinglePassRange2>::type base_t; +public: + joined_range(SinglePassRange1& rng1, SinglePassRange2& rng2) + : base_t( + iterator_t(rng1, rng2, range_detail::join_iterator_begin_tag()), + iterator_t(rng1, rng2, range_detail::join_iterator_end_tag()) + ) + { + } +}; + +template +joined_range join(const SinglePassRange1& r1, const SinglePassRange2& r2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - typedef range_detail::join_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME add_const< - BOOST_DEDUCED_TYPENAME range_value::type>::type> iterator_t; - - return iterator_range( - iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), - iterator_t(r1, r2, range_detail::join_iterator_end_tag())); + return joined_range(r1, r2); } template -iterator_range::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_value::type> -> +joined_range join(SinglePassRange1& r1, SinglePassRange2& r2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - typedef range_detail::join_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_value::type> iterator_t; - - return iterator_range( - iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), - iterator_t(r1, r2, range_detail::join_iterator_end_tag())); + return joined_range(r1, r2); } } // namespace boost diff --git a/include/boost/range/numeric.hpp b/include/boost/range/numeric.hpp index 0a76151..b01b73a 100755 --- a/include/boost/range/numeric.hpp +++ b/include/boost/range/numeric.hpp @@ -7,13 +7,13 @@ // 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) -// +// // Copyright 2006 Thorsten Ottosen. // 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) -// +// // Copyright 2004 Eric Niebler. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -39,14 +40,14 @@ namespace boost template< class SinglePassRange, class Value > inline Value accumulate( const SinglePassRange& rng, Value init ) { - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::accumulate( boost::begin(rng), boost::end(rng), init ); } template< class SinglePassRange, class Value, class BinaryOperation > inline Value accumulate( const SinglePassRange& rng, Value init, BinaryOperation op ) { - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::accumulate( boost::begin(rng), boost::end(rng), init, op ); } @@ -54,42 +55,42 @@ namespace boost template< class SinglePassRange1, class SinglePassRange2, class Value > inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init ) { - boost::function_requires< SinglePassRangeConcept >(); - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) ); - return std::inner_product( boost::begin(rng1), boost::end(rng1), - boost::begin(rng2), init ); + return std::inner_product( boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), init ); } template< class SinglePassRange1, class SinglePassRange2, - class Value, + class Value, class BinaryOperation1, class BinaryOperation2 > inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, - Value init, + Value init, BinaryOperation1 op1, BinaryOperation2 op2 ) { - boost::function_requires< SinglePassRangeConcept >(); - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) ); - return std::inner_product( boost::begin(rng1), boost::end(rng1), - boost::begin(rng2), init, op1, op2 ); + return std::inner_product( boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), init, op1, op2 ); } template< class SinglePassRange, class OutputIterator > - inline OutputIterator partial_sum ( const SinglePassRange& rng, + inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result ) { - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::partial_sum( boost::begin(rng), boost::end(rng), result ); } template< class SinglePassRange, class OutputIterator, class BinaryOperation > - inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result, + inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result, BinaryOperation op ) { - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::partial_sum( boost::begin(rng), boost::end(rng), result, op ); } @@ -97,8 +98,8 @@ namespace boost inline OutputIterator adjacent_difference ( const SinglePassRange& rng, OutputIterator result ) { - boost::function_requires< SinglePassRangeConcept >(); - return std::adjacent_difference( boost::begin(rng), boost::end(rng), + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::adjacent_difference( boost::begin(rng), boost::end(rng), result ); } @@ -107,11 +108,11 @@ namespace boost OutputIterator result, BinaryOperation op ) { - boost::function_requires< SinglePassRangeConcept >(); - return std::adjacent_difference( boost::begin(rng), boost::end(rng), + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::adjacent_difference( boost::begin(rng), boost::end(rng), result, op ); } - + } #endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 2b2466f..645f5f9 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -91,12 +91,19 @@ test-suite range : [ range-test algorithm_test/prev_permutation ] [ range-test algorithm_test/random_shuffle ] [ range-test algorithm_test/remove ] + [ range-test algorithm_test/remove_copy ] + [ range-test algorithm_test/remove_copy_if ] [ range-test algorithm_test/remove_if ] [ range-test algorithm_test/replace ] + [ range-test algorithm_test/replace_copy ] + [ range-test algorithm_test/replace_copy_if ] [ range-test algorithm_test/replace_if ] [ range-test algorithm_test/reverse ] + [ range-test algorithm_test/reverse_copy ] [ range-test algorithm_test/rotate ] + [ range-test algorithm_test/rotate_copy ] [ range-test algorithm_test/search ] + [ range-test algorithm_test/search_n ] [ range-test algorithm_test/set_difference ] [ range-test algorithm_test/set_intersection ] [ range-test algorithm_test/set_symmetric_difference ] @@ -104,8 +111,10 @@ test-suite range : [ range-test algorithm_test/sort ] [ range-test algorithm_test/stable_partition ] [ range-test algorithm_test/stable_sort ] + [ range-test algorithm_test/swap_ranges ] [ range-test algorithm_test/transform ] [ range-test algorithm_test/unique ] + [ range-test algorithm_test/unique_copy ] [ range-test algorithm_test/upper_bound ] [ range-test algorithm_ext_test/copy_n ] [ range-test algorithm_ext_test/erase ] diff --git a/test/adaptor_test/map.cpp b/test/adaptor_test/map.cpp index 73859b4..615b467 100644 --- a/test/adaptor_test/map.cpp +++ b/test/adaptor_test/map.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -111,6 +112,48 @@ namespace boost { map_test_impl< std::map >(); } + + void test_trac_item_4388() + { + typedef std::pair pair_t; + const boost::array ar = {{ + pair_t(3, 'a'), + pair_t(1, 'b'), + pair_t(4, 'c') + }}; + + const boost::array expected_keys = {{ 3, 1, 4 }}; + const boost::array expected_values = {{ 'a', 'b', 'c' }}; + + { + std::vector test; + boost::push_back(test, ar | boost::adaptors::map_keys); + BOOST_CHECK_EQUAL_COLLECTIONS( + expected_keys.begin(), expected_keys.end(), + test.begin(), test.end() + ); + } + + { + std::vector test; + boost::push_back(test, ar | boost::adaptors::map_values); + BOOST_CHECK_EQUAL_COLLECTIONS( + expected_values.begin(), expected_values.end(), + test.begin(), test.end() + ); + } + + { + std::vector test; + boost::array, 3> src(ar); + boost::push_back(test, src | boost::adaptors::map_values); + BOOST_CHECK_EQUAL_COLLECTIONS( + expected_values.begin(), expected_values.end(), + test.begin(), test.end() + ); + } + } + } } @@ -122,6 +165,7 @@ init_unit_test_suite(int argc, char* argv[]) = BOOST_TEST_SUITE( "RangeTestSuite.adaptor.map" ); test->add( BOOST_TEST_CASE( &boost::map_test ) ); + test->add( BOOST_TEST_CASE( &boost::test_trac_item_4388 ) ); return test; } diff --git a/test/algorithm_test/adjacent_find.cpp b/test/algorithm_test/adjacent_find.cpp index 914736b..63b65e8 100644 --- a/test/algorithm_test/adjacent_find.cpp +++ b/test/algorithm_test/adjacent_find.cpp @@ -9,7 +9,7 @@ // For more information, see http://www.boost.org/libs/range/ // #include - +#include #include #include @@ -38,14 +38,18 @@ namespace boost BOOST_CHECK( boost::adjacent_find(cont) == cont.end() ); BOOST_CHECK( boost::adjacent_find(cref_cont) == cref_cont.end() ); + BOOST_CHECK( boost::adjacent_find(boost::make_iterator_range(cont)) == cont.end() ); BOOST_CHECK( boost::adjacent_find(cont, pred) == cont.end() ); BOOST_CHECK( boost::adjacent_find(cref_cont, pred) == cref_cont.end() ); + BOOST_CHECK( boost::adjacent_find(boost::make_iterator_range(cont), pred) == cont.end() ); cont += 1; BOOST_CHECK( boost::adjacent_find(cont) == cont.end() ); BOOST_CHECK( boost::adjacent_find(cref_cont) == cref_cont.end() ); + BOOST_CHECK( boost::adjacent_find(boost::make_iterator_range(cont)) == cont.end() ); BOOST_CHECK( boost::adjacent_find(cont, pred) == cont.end() ); BOOST_CHECK( boost::adjacent_find(cref_cont, pred) == cref_cont.end() ); + BOOST_CHECK( boost::adjacent_find(boost::make_iterator_range(cont), pred) == cont.end() ); cont += 2,3,4,5,5,5,6,7,8,9; iterator_t it = boost::adjacent_find(cont); @@ -57,6 +61,8 @@ namespace boost { BOOST_CHECK( *it == 5 ); } + BOOST_CHECK( it == boost::adjacent_find(boost::make_iterator_range(cont)) ); + BOOST_CHECK( it_pred == boost::adjacent_find(boost::make_iterator_range(cont), pred) ); const_iterator_t cit = boost::adjacent_find(cref_cont); const_iterator_t cit_pred = boost::adjacent_find(cref_cont, pred); BOOST_CHECK( cit == cit_pred ); diff --git a/test/algorithm_test/binary_search.cpp b/test/algorithm_test/binary_search.cpp index e0aca31..2646c2e 100644 --- a/test/algorithm_test/binary_search.cpp +++ b/test/algorithm_test/binary_search.cpp @@ -37,6 +37,8 @@ namespace boost BOOST_CHECK( reference_result == test_result ); + BOOST_CHECK( test_result == boost::binary_search(boost::make_iterator_range(test), 5) ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), test.begin(), test.end() @@ -68,6 +70,8 @@ namespace boost bool test_result = boost::binary_search(test, 5, pred); + BOOST_CHECK( test_result == boost::binary_search(boost::make_iterator_range(test), 5, pred) ); + BOOST_CHECK( reference_result == test_result ); BOOST_CHECK_EQUAL_COLLECTIONS( diff --git a/test/algorithm_test/copy.cpp b/test/algorithm_test/copy.cpp index 932d190..47f4172 100644 --- a/test/algorithm_test/copy.cpp +++ b/test/algorithm_test/copy.cpp @@ -42,6 +42,13 @@ namespace boost target.begin(), target.end(), source.begin(), source.end() ); + + it == boost::copy(boost::make_iterator_range(source), target.begin()); + + BOOST_CHECK( it == target.end() ); + + BOOST_CHECK_EQUAL_COLLECTIONS(target.begin(), target.end(), + source.begin(), source.end()); } void test_copy() diff --git a/test/algorithm_test/copy_backward.cpp b/test/algorithm_test/copy_backward.cpp index d66082a..3fd5679 100644 --- a/test/algorithm_test/copy_backward.cpp +++ b/test/algorithm_test/copy_backward.cpp @@ -39,6 +39,10 @@ namespace boost BOOST_CHECK( it == target.end() ); BOOST_CHECK_EQUAL_COLLECTIONS( target.begin(), target.end(), source.rbegin(), source.rend() ); + + BOOST_CHECK( it == boost::copy_backward(boost::make_iterator_range(source), target.begin()) ); + BOOST_CHECK_EQUAL_COLLECTIONS( target.begin(), target.end(), + source.rbegin(), source.rend() ); } void test_copy_backward() diff --git a/test/algorithm_test/copy_n.cpp b/test/algorithm_test/copy_n.cpp new file mode 100644 index 0000000..230eb03 --- /dev/null +++ b/test/algorithm_test/copy_n.cpp @@ -0,0 +1,70 @@ +// Boost.Range library +// +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace +{ + template< class Container > + void test_copy_n_impl() + { + Container source; + typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; + + std::vector target; + target.resize(source.size()); + + typedef BOOST_DEDUCED_TYPENAME range_iterator< std::vector >::type iterator_t; + iterator_t it = boost::copy(source, target.begin()); + + BOOST_CHECK( it == target.end() ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + target.begin(), target.end(), + source.begin(), source.end() + ); + + it = boost::copy(boost::make_iterator_range(source), target.begin()); + + BOOST_CHECK( it == target.end() ); + + BOOST_CHECK_EQUAL_COLLECTIONS(target.begin(), target.end(), + source.begin(), source.end()); + } + + void test_copy_n() + { + test_copy_n_impl< std::vector >(); + test_copy_n_impl< std::list >(); + test_copy_n_impl< std::set >(); + test_copy_n_impl< std::multiset >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.copy_n" ); + + test->add( BOOST_TEST_CASE( &::test_copy_n ) ); + + return test; +} diff --git a/test/algorithm_test/count.cpp b/test/algorithm_test/count.cpp index d364710..90b2090 100644 --- a/test/algorithm_test/count.cpp +++ b/test/algorithm_test/count.cpp @@ -31,28 +31,36 @@ namespace boost Container cont; const Container& cref_cont = cont; - BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0) ); - BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0) ); + BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0u) ); + BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0u) ); + BOOST_CHECK_EQUAL( 0u, boost::count(boost::make_iterator_range(cont), 0u) ); cont += 1; - BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0) ); - BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0) ); - BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1) ); - BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1) ); + BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0u) ); + BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0u) ); + BOOST_CHECK_EQUAL( 0u, boost::count(boost::make_iterator_range(cont), 0u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(boost::make_iterator_range(cont), 1u) ); cont += 2,3,4,5,6,7,8,9; - BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0) ); - BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0) ); - BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1) ); - BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1) ); + BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0u) ); + BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0u) ); + BOOST_CHECK_EQUAL( 0u, boost::count(boost::make_iterator_range(cont), 0u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(boost::make_iterator_range(cont), 1u) ); cont += 2; - BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0) ); - BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0) ); - BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1) ); - BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1) ); - BOOST_CHECK_EQUAL( 2u, boost::count(cont, 2) ); - BOOST_CHECK_EQUAL( 2u, boost::count(cref_cont, 2) ); + BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0u) ); + BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0u) ); + BOOST_CHECK_EQUAL( 0u, boost::count(boost::make_iterator_range(cont), 0u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1u) ); + BOOST_CHECK_EQUAL( 1u, boost::count(boost::make_iterator_range(cont), 1u) ); + BOOST_CHECK_EQUAL( 2u, boost::count(cont, 2u) ); + BOOST_CHECK_EQUAL( 2u, boost::count(cref_cont, 2u) ); + BOOST_CHECK_EQUAL( 2u, boost::count(boost::make_iterator_range(cont), 2u) ); } void test_count() diff --git a/test/algorithm_test/count_if.cpp b/test/algorithm_test/count_if.cpp index 11526b4..c3d1b8b 100644 --- a/test/algorithm_test/count_if.cpp +++ b/test/algorithm_test/count_if.cpp @@ -15,6 +15,7 @@ #include #include "../test_function/false_predicate.hpp" +#include "../test_function/true_predicate.hpp" #include "../test_function/equal_to_x.hpp" #include #include @@ -38,29 +39,42 @@ namespace boost BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) ); BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) ); + BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), pred_t(0)) ); cont += 1; BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) ); BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) ); + BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), pred_t(0)) ); BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) ); BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) ); + BOOST_CHECK_EQUAL( 1u, boost::count_if(boost::make_iterator_range(cont), pred_t(1)) ); cont += 2,3,4,5,6,7,8,9; BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) ); BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) ); + BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), pred_t(0)) ); BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) ); BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) ); + BOOST_CHECK_EQUAL( 1u, boost::count_if(boost::make_iterator_range(cont), pred_t(1)) ); cont += 2; BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) ); BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) ); + BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), pred_t(0)) ); BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) ); BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) ); + BOOST_CHECK_EQUAL( 1u, boost::count_if(boost::make_iterator_range(cont), pred_t(1)) ); BOOST_CHECK_EQUAL( 2u, boost::count_if(cont, pred_t(2)) ); BOOST_CHECK_EQUAL( 2u, boost::count_if(cref_cont, pred_t(2)) ); + BOOST_CHECK_EQUAL( 2u, boost::count_if(boost::make_iterator_range(cont), pred_t(2)) ); BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, false_predicate()) ); BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, false_predicate()) ); + BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), false_predicate()) ); + + BOOST_CHECK_EQUAL( cont.size(), boost::count_if(cont, true_predicate()) ); + BOOST_CHECK_EQUAL( cont.size(), boost::count_if(cref_cont, true_predicate()) ); + BOOST_CHECK_EQUAL( cont.size(), boost::count_if(boost::make_iterator_range(cont), true_predicate()) ); } void test_count_if() diff --git a/test/algorithm_test/equal.cpp b/test/algorithm_test/equal.cpp index d750706..243f064 100644 --- a/test/algorithm_test/equal.cpp +++ b/test/algorithm_test/equal.cpp @@ -38,30 +38,70 @@ namespace boost Container2& cont2 = mcont2; BOOST_CHECK( boost::equal(cont1, cont2) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2) ); + BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2)) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) ); BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to()) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to()) ); + BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2), std::equal_to()) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to()) ); BOOST_CHECK( boost::equal(cont1, cont2, std::not_equal_to()) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to()) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to()) ); mcont1 += 1; BOOST_CHECK( !boost::equal(cont1, cont2) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2) ); + BOOST_CHECK( !boost::equal(cont1, boost::make_iterator_range(cont2)) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) ); BOOST_CHECK( !boost::equal(cont1, cont2, std::equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to()) ); + BOOST_CHECK( !boost::equal(cont1, boost::make_iterator_range(cont2), std::equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to()) ); BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to()) ); mcont1.clear(); mcont2 += 1; BOOST_CHECK( !boost::equal(cont1, cont2) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) ); BOOST_CHECK( !boost::equal(cont1, cont2, std::equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to()) ); BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to()) ); mcont1 += 1; BOOST_CHECK( boost::equal(cont1, cont2) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2) ); + BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2)) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) ); BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to()) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to()) ); + BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2), std::equal_to()) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to()) ); BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(cont1, boost::make_iterator_range(cont2), std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to()) ); mcont1 += 2,3,4,5,6,7,8,9; mcont2 += 2,3,4,5,6,7,8,9; BOOST_CHECK( boost::equal(cont1, cont2) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2) ); + BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2)) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) ); BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to()) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to()) ); + BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2), std::equal_to()) ); + BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to()) ); BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(cont1, boost::make_iterator_range(cont2), std::not_equal_to()) ); + BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to()) ); } template< class Container1, class Container2 > diff --git a/test/algorithm_test/equal_range.cpp b/test/algorithm_test/equal_range.cpp index 652508c..612f1a4 100644 --- a/test/algorithm_test/equal_range.cpp +++ b/test/algorithm_test/equal_range.cpp @@ -70,8 +70,11 @@ namespace boost pair_t test_result = boost::equal_range(test, 5); - check_result(reference, reference_result, - test, test_result); + check_result(reference, reference_result, test, test_result); + + pair_t test_result2 = boost::equal_range(boost::make_iterator_range(test), 5); + + check_result(reference, reference_result, test, test_result2); } template @@ -107,8 +110,11 @@ namespace boost pair_t test_result = boost::equal_range(test, 5, BinaryPredicate()); - check_result(reference, reference_result, - test, test_result); + check_result(reference, reference_result, test, test_result); + + pair_t test_result2 = boost::equal_range(boost::make_iterator_range(test), 5, BinaryPredicate()); + + check_result(reference, reference_result, test, test_result2); } template diff --git a/test/algorithm_test/fill.cpp b/test/algorithm_test/fill.cpp index 93dba7e..2f975c4 100644 --- a/test/algorithm_test/fill.cpp +++ b/test/algorithm_test/fill.cpp @@ -36,6 +36,12 @@ namespace boost BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), target.begin(), target.end() ); + + Container target2(cont); + boost::fill(boost::make_iterator_range(target2), 1); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target2.begin(), target2.end() ); } template< class Container > diff --git a/test/algorithm_test/find.cpp b/test/algorithm_test/find.cpp index fd179f1..6eb1528 100644 --- a/test/algorithm_test/find.cpp +++ b/test/algorithm_test/find.cpp @@ -33,7 +33,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::find(cont, 3); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::find(cont, 3); + iter_t result2 = boost::find(boost::make_iterator_range(cont), 3); + BOOST_CHECK( result == result2 ); + return result; } template @@ -43,7 +47,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy&, Container& cont) { - return boost::find(cont, 3); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::find(cont, 3); + result_t result2 = boost::find(boost::make_iterator_range(cont), 3); + BOOST_CHECK( result == result2 ); + return result; } }; @@ -90,6 +98,8 @@ namespace boost std::vector vi; const std::vector& cvi = vi; std::vector::const_iterator it = boost::find(vi, 0); + std::vector::const_iterator it2 = boost::find(cvi, 0); + BOOST_CHECK( it == it2 ); } } } diff --git a/test/algorithm_test/find_end.cpp b/test/algorithm_test/find_end.cpp index a126e87..0592d5f 100644 --- a/test/algorithm_test/find_end.cpp +++ b/test/algorithm_test/find_end.cpp @@ -41,7 +41,12 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::find_end(cont, m_cont); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::find_end(cont, m_cont); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), m_cont) ); + BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(m_cont)) ); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont)) ); + return result; } template @@ -51,7 +56,13 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::find_end(cont, policy.cont()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::find_end(cont, policy.cont()); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), policy.cont()) ); + BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(policy.cont())) ); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), + boost::make_iterator_range(policy.cont())) ); + return result; } }; @@ -84,7 +95,12 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::find_end(cont, m_cont, m_pred); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t it = boost::find_end(cont, m_cont, m_pred); + BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), m_cont, m_pred) ); + BOOST_CHECK( it == boost::find_end(cont, boost::make_iterator_range(m_cont), m_pred) ); + BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont), m_pred) ); + return it; } template @@ -94,6 +110,12 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::find_end(cont, policy.cont(), policy.pred()); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), policy.cont(), policy.pred()) ); + BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(policy.cont()), policy.pred()) ); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), + boost::make_iterator_range(policy.cont()), policy.pred()) ); return boost::find_end(cont, policy.cont(), policy.pred()); } }; diff --git a/test/algorithm_test/find_first_of.cpp b/test/algorithm_test/find_first_of.cpp index 9ff7adb..c96d36a 100644 --- a/test/algorithm_test/find_first_of.cpp +++ b/test/algorithm_test/find_first_of.cpp @@ -41,7 +41,12 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::find_first_of(cont, m_cont); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::find_first_of(cont, m_cont); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont) ); + BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont)) ); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont)) ); + return result; } template @@ -51,7 +56,12 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::find_first_of(cont, policy.cont()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::find_first_of(cont, policy.cont()); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), policy.cont()) ); + BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(policy.cont())) ); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(policy.cont())) ); + return result; } }; @@ -84,7 +94,12 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::find_first_of(cont, m_cont, m_pred); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::find_first_of(cont, m_cont, m_pred); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont, m_pred) ); + BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont), m_pred) ); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont), m_pred) ); + return result; } template @@ -94,7 +109,12 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::find_first_of(cont, policy.cont(), policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::find_first_of(cont, policy.cont(), policy.pred()); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), policy.cont(), policy.pred()) ); + BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(policy.cont()), policy.pred()) ); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(policy.cont()), policy.pred()) ); + return result; } }; @@ -103,8 +123,8 @@ namespace boost reference(Container& cont) { return std::find_first_of(cont.begin(), cont.end(), - m_cont.begin(), m_cont.end(), - m_pred); + m_cont.begin(), m_cont.end(), + m_pred); } private: diff --git a/test/algorithm_test/find_if.cpp b/test/algorithm_test/find_if.cpp index a5fe459..04fe6f2 100644 --- a/test/algorithm_test/find_if.cpp +++ b/test/algorithm_test/find_if.cpp @@ -38,7 +38,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::find_if(cont, m_pred); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::find_if(cont, m_pred); + BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), m_pred) ); + return result; } template @@ -48,7 +51,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(find_if_test_policy& policy, Container& cont) { - return boost::find_if(cont, policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::find_if(cont, policy.pred()); + BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), policy.pred()) ); + return result; } }; diff --git a/test/algorithm_test/for_each.cpp b/test/algorithm_test/for_each.cpp index ac517ad..2ef51bf 100644 --- a/test/algorithm_test/for_each.cpp +++ b/test/algorithm_test/for_each.cpp @@ -26,6 +26,12 @@ namespace boost { namespace { + template< class Range > + unsigned int udistance(Range& rng) + { + return static_cast(boost::distance(rng)); + } + template< class SinglePassRange > void test_for_each_impl( SinglePassRange rng ) { @@ -35,12 +41,15 @@ namespace boost // Test the mutable version fn_t result_fn = boost::for_each(rng, fn_t(rng)); - BOOST_CHECK_EQUAL( boost::distance(rng), result_fn.invocation_count() ); + BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() ); + + fn_t result_fn2 = boost::for_each(boost::make_iterator_range(rng), fn_t(rng)); + BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() ); // Test the constant version const SinglePassRange& cref_rng = rng; result_fn = boost::for_each(cref_rng, fn_t(cref_rng)); - BOOST_CHECK_EQUAL( boost::distance(cref_rng), result_fn.invocation_count() ); + BOOST_CHECK_EQUAL( boost::udistance(cref_rng), result_fn.invocation_count() ); } template< class Container > @@ -51,7 +60,7 @@ namespace boost // Test empty Container cont; test_for_each_impl(cont); - + // Test one element cont += 0; test_for_each_impl(cont); @@ -63,7 +72,7 @@ namespace boost void test_for_each() { - boost::array a = { 0,1,2,3,4,5,6,7,8,9 }; + boost::array a = {{ 0,1,2,3,4,5,6,7,8,9 }}; test_for_each_impl(a); test_for_each_t< std::vector >(); @@ -79,8 +88,8 @@ init_unit_test_suite(int argc, char* argv[]) { boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.for_each" ); - + test->add( BOOST_TEST_CASE( &boost::test_for_each ) ); - + return test; } diff --git a/test/algorithm_test/generate.cpp b/test/algorithm_test/generate.cpp index ab47b06..d8fc0e6 100644 --- a/test/algorithm_test/generate.cpp +++ b/test/algorithm_test/generate.cpp @@ -49,6 +49,12 @@ namespace boost BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), test.begin(), test.end() ); + + Container test2(cont); + boost::generate(boost::make_iterator_range(test2), generator_fn()); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); } template< class Container > diff --git a/test/algorithm_test/heap.cpp b/test/algorithm_test/heap.cpp index 933d1f6..74b7fa3 100644 --- a/test/algorithm_test/heap.cpp +++ b/test/algorithm_test/heap.cpp @@ -41,28 +41,39 @@ namespace boost reference += 1,2,3,4,5,6,7,8,9; std::vector test_cont(reference); + std::vector test_cont2(reference); std::make_heap(reference.begin(), reference.end()); boost::make_heap(test_cont); check_equal(reference, test_cont); + boost::make_heap(boost::make_iterator_range(test_cont2)); + check_equal(reference, test_cont2); std::push_heap(reference.begin(), reference.end()); boost::push_heap(test_cont); check_equal(reference, test_cont); + boost::push_heap(boost::make_iterator_range(test_cont2)); + check_equal(reference, test_cont2); std::make_heap(reference.begin(), reference.end()); boost::make_heap(test_cont); + boost::make_heap(boost::make_iterator_range(test_cont2)); std::sort_heap(reference.begin(), reference.end()); boost::sort_heap(test_cont); check_equal(reference, test_cont); + boost::sort_heap(boost::make_iterator_range(test_cont2)); + check_equal(reference, test_cont2); std::make_heap(reference.begin(), reference.end()); boost::make_heap(test_cont); + boost::make_heap(boost::make_iterator_range(test_cont2)); std::pop_heap(reference.begin(), reference.end()); boost::pop_heap(test_cont); check_equal(reference, test_cont); + boost::pop_heap(boost::make_iterator_range(test_cont2)); + check_equal(reference, test_cont2); } template @@ -75,30 +86,42 @@ namespace boost std::sort(reference.begin(), reference.end(), pred); std::vector test_cont(reference); + std::vector test_cont2(reference); std::make_heap(reference.begin(), reference.end(), pred); boost::make_heap(test_cont, pred); check_equal(reference, test_cont); + boost::make_heap(boost::make_iterator_range(test_cont2), pred); + check_equal(reference, test_cont2); reference.push_back(5); test_cont.push_back(5); + test_cont2.push_back(5); std::push_heap(reference.begin(), reference.end(), pred); boost::push_heap(test_cont, pred); check_equal(reference, test_cont); + boost::push_heap(boost::make_iterator_range(test_cont2), pred); + check_equal(reference, test_cont2); std::make_heap(reference.begin(), reference.end(), pred); boost::make_heap(test_cont, pred); + boost::make_heap(boost::make_iterator_range(test_cont2), pred); std::sort_heap(reference.begin(), reference.end(), pred); boost::sort_heap(test_cont, pred); check_equal(reference, test_cont); + boost::sort_heap(boost::make_iterator_range(test_cont2), pred); + check_equal(reference, test_cont2); std::make_heap(reference.begin(), reference.end(), pred); boost::make_heap(test_cont, pred); + boost::make_heap(boost::make_iterator_range(test_cont2), pred); std::pop_heap(reference.begin(), reference.end(), pred); boost::pop_heap(test_cont, pred); check_equal(reference, test_cont); + boost::pop_heap(boost::make_iterator_range(test_cont2), pred); + check_equal(reference, test_cont2); } void test_heap() diff --git a/test/algorithm_test/includes.cpp b/test/algorithm_test/includes.cpp index f928957..8977532 100644 --- a/test/algorithm_test/includes.cpp +++ b/test/algorithm_test/includes.cpp @@ -46,6 +46,10 @@ namespace boost old_cont2.begin(), old_cont2.end(), cont2.begin(), cont2.end() ); + + BOOST_CHECK( test_result == boost::includes(boost::make_iterator_range(cont1), cont2) ); + BOOST_CHECK( test_result == boost::includes(cont1, boost::make_iterator_range(cont2)) ); + BOOST_CHECK( test_result == boost::includes(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) ); } template @@ -88,6 +92,10 @@ namespace boost old_cont2.begin(), old_cont2.end(), cont2.begin(), cont2.end() ); + + BOOST_CHECK( test_result == boost::includes(boost::make_iterator_range(cont1), cont2, pred) ); + BOOST_CHECK( test_result == boost::includes(cont1, boost::make_iterator_range(cont2), pred) ); + BOOST_CHECK( test_result == boost::includes(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), pred) ); } template diff --git a/test/algorithm_test/inplace_merge.cpp b/test/algorithm_test/inplace_merge.cpp index f109257..d0cad73 100644 --- a/test/algorithm_test/inplace_merge.cpp +++ b/test/algorithm_test/inplace_merge.cpp @@ -35,6 +35,7 @@ namespace boost cont2.begin(), cont2.end()); std::vector test_target(reference_target); + std::vector test_target2(reference_target); std::inplace_merge(reference_target.begin(), reference_target.begin() + cont1.size(), @@ -47,6 +48,14 @@ namespace boost reference_target.begin(), reference_target.end(), test_target.begin(), test_target.end() ); + + boost::inplace_merge(boost::make_iterator_range(test_target2), + test_target2.begin() + cont1.size()); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference_target.begin(), reference_target.end(), + test_target2.begin(), test_target2.end() + ); } template @@ -75,6 +84,7 @@ namespace boost cont2.begin(), cont2.end()); std::vector test_target(reference_target); + std::vector test_target2(reference_target); std::inplace_merge(reference_target.begin(), reference_target.begin() + cont1.size(), @@ -88,6 +98,15 @@ namespace boost reference_target.begin(), reference_target.end(), test_target.begin(), test_target.end() ); + + boost::inplace_merge(boost::make_iterator_range(test_target2), + test_target2.begin() + cont1.size(), + pred); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference_target.begin(), reference_target.end(), + test_target2.begin(), test_target2.end() + ); } template diff --git a/test/algorithm_test/lexicographical_compare.cpp b/test/algorithm_test/lexicographical_compare.cpp index c57f390..f724bd1 100644 --- a/test/algorithm_test/lexicographical_compare.cpp +++ b/test/algorithm_test/lexicographical_compare.cpp @@ -28,13 +28,16 @@ namespace boost void test_lexicographical_compare_impl_nopred(ForwardRange1& rng1, ForwardRange2& rng2) { - bool reference = std::lexicographical_compare( + const bool reference = std::lexicographical_compare( boost::begin(rng1), boost::end(rng1), boost::begin(rng2), boost::end(rng2)); - bool test = boost::lexicographical_compare(rng1, rng2); + const bool test = boost::lexicographical_compare(rng1, rng2); BOOST_CHECK( reference == test ); + BOOST_CHECK( test == boost::lexicographical_compare(boost::make_iterator_range(rng1), rng2) ); + BOOST_CHECK( test == boost::lexicographical_compare(rng1, boost::make_iterator_range(rng2)) ); + BOOST_CHECK( test == boost::lexicographical_compare(boost::make_iterator_range(rng1), boost::make_iterator_range(rng2)) ); } template diff --git a/test/algorithm_test/lower_bound.cpp b/test/algorithm_test/lower_bound.cpp index ca622bc..e627708 100644 --- a/test/algorithm_test/lower_bound.cpp +++ b/test/algorithm_test/lower_bound.cpp @@ -33,7 +33,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::lower_bound(cont, 5); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::lower_bound(cont, 5); + BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) ); + return result; } template @@ -43,7 +46,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy&, Container& cont) { - return boost::lower_bound(cont, 5); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::lower_bound(cont, 5); + BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) ); + return result; } }; @@ -62,7 +68,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::lower_bound(cont, 5, m_pred); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::lower_bound(cont, 5, m_pred); + BOOST_CHECK( result == boost::lower_bound( + boost::make_iterator_range(cont), 5, m_pred) ); + return result; } template< range_return_value return_type > @@ -72,8 +82,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::lower_bound( - cont, 5, policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::lower_bound(cont, 5, policy.pred()); + BOOST_CHECK( result == boost::lower_bound( + boost::make_iterator_range(cont), 5, policy.pred()) ); + return result; } }; diff --git a/test/algorithm_test/max_element.cpp b/test/algorithm_test/max_element.cpp index d4c70ca..c4c6cb9 100644 --- a/test/algorithm_test/max_element.cpp +++ b/test/algorithm_test/max_element.cpp @@ -33,7 +33,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::max_element(cont); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::max_element(cont); + BOOST_CHECK( result == boost::max_element( + boost::make_iterator_range(cont)) ); + return result; } template @@ -43,7 +47,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy&, Container& cont) { - return boost::max_element(cont); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::max_element(cont); + BOOST_CHECK( result == boost::max_element( + boost::make_iterator_range(cont)) ); + return result; } }; @@ -63,7 +71,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::max_element(cont, Pred()); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::max_element(cont, Pred()); + BOOST_CHECK( result == boost::max_element( + boost::make_iterator_range(cont), Pred()) ); + return result; } Pred pred() const { return Pred(); } @@ -75,7 +87,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::max_element(cont, policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::max_element(cont, policy.pred()); + BOOST_CHECK( result == boost::max_element( + boost::make_iterator_range(cont), policy.pred()) ); + return result; } }; diff --git a/test/algorithm_test/merge.cpp b/test/algorithm_test/merge.cpp index aed7cd7..5038782 100644 --- a/test/algorithm_test/merge.cpp +++ b/test/algorithm_test/merge.cpp @@ -51,6 +51,46 @@ namespace boost reference_target.begin(), reference_target.end(), test_target.begin(), test_target.end() ); + + test_it = boost::merge(boost::make_iterator_range(cont1), + cont2, test_target.begin()); + + BOOST_CHECK_EQUAL( + std::distance(reference_target.begin(), reference_it), + std::distance(test_target.begin(), test_it) + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference_target.begin(), reference_target.end(), + test_target.begin(), test_target.end() + ); + + test_it = boost::merge(cont1, boost::make_iterator_range(cont2), + test_target.begin()); + + BOOST_CHECK_EQUAL( + std::distance(reference_target.begin(), reference_it), + std::distance(test_target.begin(), test_it) + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference_target.begin(), reference_target.end(), + test_target.begin(), test_target.end() + ); + + test_it = boost::merge(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_target.begin()); + + BOOST_CHECK_EQUAL( + std::distance(reference_target.begin(), reference_it), + std::distance(test_target.begin(), test_it) + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference_target.begin(), reference_target.end(), + test_target.begin(), test_target.end() + ); } template @@ -95,6 +135,46 @@ namespace boost reference_target.begin(), reference_target.end(), test_target.begin(), test_target.end() ); + + test_it = boost::merge(boost::make_iterator_range(cont1), cont2, + test_target.begin(), pred); + + BOOST_CHECK_EQUAL( + std::distance(reference_target.begin(), reference_it), + std::distance(test_target.begin(), test_it) + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference_target.begin(), reference_target.end(), + test_target.begin(), test_target.end() + ); + + test_it = boost::merge(cont1, boost::make_iterator_range(cont2), + test_target.begin(), pred); + + BOOST_CHECK_EQUAL( + std::distance(reference_target.begin(), reference_it), + std::distance(test_target.begin(), test_it) + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference_target.begin(), reference_target.end(), + test_target.begin(), test_target.end() + ); + + test_it = boost::merge(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_target.begin(), pred); + + BOOST_CHECK_EQUAL( + std::distance(reference_target.begin(), reference_it), + std::distance(test_target.begin(), test_it) + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference_target.begin(), reference_target.end(), + test_target.begin(), test_target.end() + ); } template diff --git a/test/algorithm_test/min_element.cpp b/test/algorithm_test/min_element.cpp index c68a655..c8fceda 100644 --- a/test/algorithm_test/min_element.cpp +++ b/test/algorithm_test/min_element.cpp @@ -33,7 +33,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::min_element(cont); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::min_element(cont); + BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) ); + return result; } template< range_return_value return_type > @@ -43,7 +46,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy&, Container& cont) { - return boost::min_element(cont); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::min_element(cont); + BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) ); + return result; } }; @@ -63,7 +69,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::min_element(cont, Pred()); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::min_element(cont, Pred()); + BOOST_CHECK( result == boost::min_element( + boost::make_iterator_range(cont), Pred()) ); + return result; } Pred pred() const { return Pred(); } @@ -75,7 +85,11 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::min_element(cont, policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::min_element(cont, policy.pred()); + BOOST_CHECK( result == boost::min_element( + boost::make_iterator_range(cont), policy.pred()) ); + return result; } }; diff --git a/test/algorithm_test/mismatch.cpp b/test/algorithm_test/mismatch.cpp index eb8f5e7..2336e59 100644 --- a/test/algorithm_test/mismatch.cpp +++ b/test/algorithm_test/mismatch.cpp @@ -23,6 +23,130 @@ namespace boost { namespace { + template< class Container1, class Container2 > + void eval_mismatch(Container1& cont1, + Container2& cont2, + BOOST_DEDUCED_TYPENAME range_iterator::type ref_it1, + BOOST_DEDUCED_TYPENAME range_iterator::type ref_it2 + ) + { + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter1_t; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter2_t; + typedef std::pair result_pair_t; + + result_pair_t result = boost::mismatch(cont1, cont2); + BOOST_CHECK( result.first == ref_it1 ); + BOOST_CHECK( result.second == ref_it2 ); + + result = boost::mismatch(boost::make_iterator_range(cont1), + cont2); + BOOST_CHECK( result.first == ref_it1 ); + BOOST_CHECK( result.second == ref_it2 ); + + result = boost::mismatch(cont1, + boost::make_iterator_range(cont2)); + BOOST_CHECK( result.first == ref_it1 ); + BOOST_CHECK( result.second == ref_it2 ); + + result = boost::mismatch(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2)); + BOOST_CHECK( result.first == ref_it1 ); + BOOST_CHECK( result.second == ref_it2 ); + } + + template< class Container1, class Container2, class Pred > + void eval_mismatch(Container1& cont1, + Container2& cont2, + Pred pred, + BOOST_DEDUCED_TYPENAME range_iterator::type ref_it1, + BOOST_DEDUCED_TYPENAME range_iterator::type ref_it2 + ) + { + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter1_t; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter2_t; + typedef std::pair result_pair_t; + + result_pair_t result = boost::mismatch(cont1, cont2, pred); + BOOST_CHECK( result.first == ref_it1 ); + BOOST_CHECK( result.second == ref_it2 ); + + result = boost::mismatch(boost::make_iterator_range(cont1), + cont2, pred); + BOOST_CHECK( result.first == ref_it1 ); + BOOST_CHECK( result.second == ref_it2 ); + + result = boost::mismatch(cont1, + boost::make_iterator_range(cont2), pred); + BOOST_CHECK( result.first == ref_it1 ); + BOOST_CHECK( result.second == ref_it2 ); + + result = boost::mismatch(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + pred); + BOOST_CHECK( result.first == ref_it1 ); + BOOST_CHECK( result.second == ref_it2 ); + } + + template< class Container1, class Container2 > + void eval_mismatch(Container1& cont1, + Container2& cont2, + const int ref1, + const int ref2) + { + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter1_t; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter2_t; + typedef std::pair result_pair_t; + + result_pair_t result = boost::mismatch(cont1, cont2); + BOOST_CHECK_EQUAL( ref1, *result.first ); + BOOST_CHECK_EQUAL( ref2, *result.second ); + + result = boost::mismatch(boost::make_iterator_range(cont1), cont2); + BOOST_CHECK_EQUAL( ref1, *result.first ); + BOOST_CHECK_EQUAL( ref2, *result.second ); + + result = boost::mismatch(cont1, boost::make_iterator_range(cont2)); + BOOST_CHECK_EQUAL( ref1, *result.first ); + BOOST_CHECK_EQUAL( ref2, *result.second ); + + result = boost::mismatch(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2)); + BOOST_CHECK_EQUAL( ref1, *result.first ); + BOOST_CHECK_EQUAL( ref2, *result.second ); + } + + template< class Container1, class Container2, class Pred > + void eval_mismatch(Container1& cont1, + Container2& cont2, + Pred pred, + const int ref1, + const int ref2) + { + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter1_t; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter2_t; + typedef std::pair result_pair_t; + + result_pair_t result = boost::mismatch(cont1, cont2, pred); + BOOST_CHECK_EQUAL( ref1, *result.first ); + BOOST_CHECK_EQUAL( ref2, *result.second ); + + result = boost::mismatch(boost::make_iterator_range(cont1), + cont2, pred); + BOOST_CHECK_EQUAL( ref1, *result.first ); + BOOST_CHECK_EQUAL( ref2, *result.second ); + + result = boost::mismatch(cont1, boost::make_iterator_range(cont2), + pred); + BOOST_CHECK_EQUAL( ref1, *result.first ); + BOOST_CHECK_EQUAL( ref2, *result.second ); + + result = boost::mismatch(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + pred); + BOOST_CHECK_EQUAL( ref1, *result.first ); + BOOST_CHECK_EQUAL( ref2, *result.second ); + } + template< class Container1, class Container2 > void test_mismatch_impl() { @@ -46,107 +170,42 @@ namespace boost typedef std::pair pair_mcit_t; typedef std::pair pair_ccit_t; - pair_mmit_t pair_mmit = boost::mismatch(cont1, cont2); - BOOST_CHECK( pair_mmit.first == cont1.end() ); - BOOST_CHECK( pair_mmit.second == cont2.end() ); - pair_mmit = boost::mismatch(cont1, cont2, std::equal_to()); - BOOST_CHECK( pair_mmit.first == cont1.end() ); - BOOST_CHECK( pair_mmit.second == cont2.end() ); - - pair_cmit_t pair_cmit = boost::mismatch(cref_cont1, cont2); - BOOST_CHECK( pair_cmit.first == cref_cont1.end() ); - BOOST_CHECK( pair_cmit.second == cont2.end() ); - pair_cmit = boost::mismatch(cref_cont1, cont2, std::equal_to()); - BOOST_CHECK( pair_cmit.first == cref_cont1.end() ); - BOOST_CHECK( pair_cmit.second == cont2.end() ); - - pair_mcit_t pair_mcit = boost::mismatch(cont1, cref_cont2); - BOOST_CHECK( pair_mcit.first == cont1.end() ); - BOOST_CHECK( pair_mcit.second == cref_cont2.end() ); - pair_mcit = boost::mismatch(cont1, cref_cont2, std::equal_to()); - BOOST_CHECK( pair_mcit.first == cont1.end() ); - BOOST_CHECK( pair_mcit.second == cref_cont2.end() ); - - pair_ccit_t pair_ccit = boost::mismatch(cref_cont1, cref_cont2); - BOOST_CHECK( pair_ccit.first == cref_cont1.end() ); - BOOST_CHECK( pair_ccit.second == cref_cont2.end() ); - pair_ccit = boost::mismatch(cref_cont1, cref_cont2, std::equal_to()); - BOOST_CHECK( pair_ccit.first == cref_cont1.end() ); - BOOST_CHECK( pair_ccit.second == cref_cont2.end() ); + eval_mismatch(cont1, cont2, cont1.end(), cont2.end()); + eval_mismatch(cont1, cont2, std::equal_to(), cont1.end(), cont2.end()); + eval_mismatch(cref_cont1, cont2, cref_cont1.end(), cont2.end()); + eval_mismatch(cref_cont1, cont2, std::equal_to(), cref_cont1.end(), cont2.end()); + eval_mismatch(cont1, cref_cont2, cont1.end(), cref_cont2.end()); + eval_mismatch(cont1, cref_cont2, std::equal_to(), cont1.end(), cref_cont2.end()); + eval_mismatch(cref_cont1, cref_cont2, cref_cont1.end(), cref_cont2.end()); + eval_mismatch(cref_cont1, cref_cont2, std::equal_to(), cref_cont1.end(), cref_cont2.end()); cont1 += 1,2,3,4; cont2 += 1,2,3,4; - pair_mmit = boost::mismatch(cont1, cont2); - BOOST_CHECK( pair_mmit.first == cont1.end() ); - BOOST_CHECK( pair_mmit.second == cont2.end() ); - pair_mmit = boost::mismatch(cont1, cont2, std::equal_to()); - BOOST_CHECK( pair_mmit.first == cont1.end() ); - BOOST_CHECK( pair_mmit.second == cont2.end() ); - - pair_cmit = boost::mismatch(cref_cont1, cont2); - BOOST_CHECK( pair_cmit.first == cref_cont1.end() ); - BOOST_CHECK( pair_cmit.second == cont2.end() ); - pair_cmit = boost::mismatch(cref_cont1, cont2, std::equal_to()); - BOOST_CHECK( pair_cmit.first == cref_cont1.end() ); - BOOST_CHECK( pair_cmit.second == cont2.end() ); - - pair_mcit = boost::mismatch(cont1, cref_cont2); - BOOST_CHECK( pair_mcit.first == cont1.end() ); - BOOST_CHECK( pair_mcit.second == cref_cont2.end() ); - pair_mcit = boost::mismatch(cont1, cref_cont2, std::equal_to()); - BOOST_CHECK( pair_mcit.first == cont1.end() ); - BOOST_CHECK( pair_mcit.second == cref_cont2.end() ); - - pair_ccit = boost::mismatch(cref_cont1, cref_cont2); - BOOST_CHECK( pair_ccit.first == cref_cont1.end() ); - BOOST_CHECK( pair_ccit.second == cref_cont2.end() ); - pair_ccit = boost::mismatch(cref_cont1, cref_cont2, std::equal_to()); - BOOST_CHECK( pair_ccit.first == cref_cont1.end() ); - BOOST_CHECK( pair_ccit.second == cref_cont2.end() ); + eval_mismatch(cont1, cont2, cont1.end(), cont2.end()); + eval_mismatch(cont1, cont2, std::equal_to(), cont1.end(), cont2.end()); + eval_mismatch(cref_cont1, cont2, cref_cont1.end(), cont2.end()); + eval_mismatch(cref_cont1, cont2, std::equal_to(), cref_cont1.end(), cont2.end()); + eval_mismatch(cont1, cref_cont2, cont1.end(), cref_cont2.end()); + eval_mismatch(cont1, cref_cont2, std::equal_to(), cont1.end(), cref_cont2.end()); + eval_mismatch(cref_cont1, cref_cont2, cref_cont1.end(), cref_cont2.end()); + eval_mismatch(cref_cont1, cref_cont2, std::equal_to(), cref_cont1.end(), cref_cont2.end()); cont1.clear(); cont2.clear(); cont1 += 1,2,3,4; cont2 += 1,2,5,4; - pair_mmit = boost::mismatch(cont1, cont2); - BOOST_CHECK( pair_mmit.first != cont1.end() && *pair_mmit.first == 3 ); - BOOST_CHECK( pair_mmit.second != cont2.end() && *pair_mmit.second == 5 ); - pair_mmit = boost::mismatch(cont1, cont2, std::equal_to()); - BOOST_CHECK( pair_mmit.first != cont1.end() && *pair_mmit.first == 3 ); - BOOST_CHECK( pair_mmit.second != cont2.end() && *pair_mmit.second == 5 ); - pair_mmit = boost::mismatch(cont1, cont2, std::not_equal_to()); - BOOST_CHECK( pair_mmit.first == cont1.begin() ); - BOOST_CHECK( pair_mmit.second == cont2.begin() ); - - pair_cmit = boost::mismatch(cref_cont1, cont2); - BOOST_CHECK( pair_cmit.first != cref_cont1.end() && *pair_cmit.first == 3 ); - BOOST_CHECK( pair_cmit.second != cont2.end() && *pair_cmit.second == 5 ); - pair_cmit = boost::mismatch(cref_cont1, cont2, std::equal_to()); - BOOST_CHECK( pair_cmit.first != cref_cont1.end() && *pair_cmit.first == 3 ); - BOOST_CHECK( pair_cmit.second != cont2.end() && *pair_cmit.second == 5 ); - pair_cmit = boost::mismatch(cref_cont1, cont2, std::not_equal_to()); - BOOST_CHECK( pair_cmit.first == cref_cont1.begin() ); - BOOST_CHECK( pair_cmit.second == cont2.begin() ); - - pair_mcit = boost::mismatch(cont1, cref_cont2); - BOOST_CHECK( pair_mcit.first != cont1.end() && *pair_mcit.first == 3 ); - BOOST_CHECK( pair_mcit.second != cref_cont2.end() && *pair_mcit.second == 5 ); - pair_mcit = boost::mismatch(cont1, cref_cont2, std::equal_to()); - BOOST_CHECK( pair_mcit.first != cont1.end() && *pair_mcit.first == 3 ); - BOOST_CHECK( pair_mcit.second != cref_cont2.end() && *pair_mcit.second == 5 ); - pair_mcit = boost::mismatch(cont1, cref_cont2, std::not_equal_to()); - BOOST_CHECK( pair_mcit.first == cont1.begin() ); - BOOST_CHECK( pair_mcit.second == cref_cont2.begin() ); - - pair_ccit = boost::mismatch(cref_cont1, cref_cont2); - BOOST_CHECK( pair_ccit.first != cref_cont1.end() && *pair_ccit.first == 3 ); - BOOST_CHECK( pair_ccit.second != cref_cont2.end() && *pair_ccit.second == 5 ); - pair_ccit = boost::mismatch(cref_cont1, cref_cont2, std::equal_to()); - BOOST_CHECK( pair_ccit.first != cref_cont1.end() && *pair_ccit.first == 3 ); - BOOST_CHECK( pair_ccit.second != cref_cont2.end() && *pair_ccit.second == 5 ); - pair_ccit = boost::mismatch(cref_cont1, cref_cont2, std::not_equal_to()); - BOOST_CHECK( pair_ccit.first == cref_cont1.begin() ); - BOOST_CHECK( pair_ccit.second == cref_cont2.begin() ); + eval_mismatch(cont1, cont2, 3, 5); + eval_mismatch(cont1, cont2, std::equal_to(), 3, 5); + eval_mismatch(cont1, cont2, std::not_equal_to(), cont1.begin(), cont2.begin()); + eval_mismatch(cref_cont1, cont2, 3, 5); + eval_mismatch(cref_cont1, cont2, std::equal_to(), 3, 5); + eval_mismatch(cref_cont1, cont2, std::not_equal_to(), cref_cont1.begin(), cont2.begin()); + eval_mismatch(cont1, cref_cont2, 3, 5); + eval_mismatch(cont1, cref_cont2, std::equal_to(), 3, 5); + eval_mismatch(cont1, cref_cont2, std::not_equal_to(), cont1.begin(), cref_cont2.begin()); + eval_mismatch(cref_cont1, cref_cont2, 3, 5); + eval_mismatch(cref_cont1, cref_cont2, std::equal_to(), 3, 5); + eval_mismatch(cref_cont1, cref_cont2, std::not_equal_to(), cref_cont1.begin(), cref_cont2.begin()); } void test_mismatch() diff --git a/test/algorithm_test/next_permutation.cpp b/test/algorithm_test/next_permutation.cpp index c2d782b..ee1c371 100644 --- a/test/algorithm_test/next_permutation.cpp +++ b/test/algorithm_test/next_permutation.cpp @@ -29,11 +29,19 @@ namespace boost const bool reference_ret = std::next_permutation(reference.begin(), reference.end()); - const bool test_ret - = boost::next_permutation(test); + const bool test_ret = boost::next_permutation(test); BOOST_CHECK( reference_ret == test_ret ); + BOOST_CHECK_EQUAL_COLLECTIONS( + reference.begin(), reference.end(), + test.begin(), test.end() + ); + + test = cont; + + BOOST_CHECK( test_ret == boost::next_permutation(boost::make_iterator_range(test)) ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), test.begin(), test.end() @@ -56,6 +64,15 @@ namespace boost BOOST_CHECK( reference_ret == test_ret ); + BOOST_CHECK_EQUAL_COLLECTIONS( + reference.begin(), reference.end(), + test.begin(), test.end() + ); + + test = cont; + + BOOST_CHECK( test_ret == boost::next_permutation(boost::make_iterator_range(test), pred) ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), test.begin(), test.end() diff --git a/test/algorithm_test/nth_element.cpp b/test/algorithm_test/nth_element.cpp index dac2a2f..df241e9 100644 --- a/test/algorithm_test/nth_element.cpp +++ b/test/algorithm_test/nth_element.cpp @@ -29,7 +29,21 @@ namespace boost template void test_nth_element(Container& cont, Iterator mid) { + const Container old_cont(cont); + boost::nth_element(cont, mid); + + // Test the same operation on the container, for the + // case where a temporary is passed as the first + // argument. + Container cont2(old_cont); + const std::size_t index = std::distance(cont.begin(), mid); + Iterator mid2(cont2.begin()); + std::advance(mid2, index); + boost::nth_element(boost::make_iterator_range(cont2), mid2); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); } template @@ -45,7 +59,19 @@ namespace boost template void test_nth_element(Container& cont, Iterator mid) { + const Container old_cont(cont); + boost::nth_element(cont, mid, BinaryPredicate()); + + Container cont2(old_cont); + const std::size_t index = std::distance(cont.begin(), mid); + Iterator mid2(cont2.begin()); + std::advance(mid2, index); + boost::nth_element(boost::make_iterator_range(cont2), mid2, + BinaryPredicate()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); } template diff --git a/test/algorithm_test/partial_sort.cpp b/test/algorithm_test/partial_sort.cpp index 62ff64b..c13f7f1 100644 --- a/test/algorithm_test/partial_sort.cpp +++ b/test/algorithm_test/partial_sort.cpp @@ -31,7 +31,18 @@ namespace boost template void test_partial_sort(Container& cont, Iterator mid) { + const Container old_cont(cont); + boost::partial_sort(cont, mid); + + const std::size_t index = std::distance(cont.begin(), mid); + Container cont2(old_cont); + Iterator mid2(cont2.begin()); + std::advance(mid2, index); + boost::partial_sort(cont2, mid2); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); } template @@ -47,7 +58,18 @@ namespace boost template void test_partial_sort(Container& cont, Iterator mid) { + const Container old_cont(cont); + boost::partial_sort(cont, mid, BinaryPredicate()); + + const std::size_t index = std::distance(cont.begin(), mid); + Container cont2(old_cont); + Iterator mid2(cont2.begin()); + std::advance(mid2, index); + boost::partial_sort(cont2, mid2, BinaryPredicate()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); } template diff --git a/test/algorithm_test/partition.cpp b/test/algorithm_test/partition.cpp index 3f0ce61..0160dae 100644 --- a/test/algorithm_test/partition.cpp +++ b/test/algorithm_test/partition.cpp @@ -41,7 +41,21 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::partition(cont, UnaryPredicate()); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + + const Container old_cont(cont); + Container cont2(old_cont); + iter_t result = boost::partition(cont, UnaryPredicate()); + + boost::partition(cont2, UnaryPredicate()); + cont2 = old_cont; + boost::partition( + boost::make_iterator_range(cont2), UnaryPredicate()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; } UnaryPredicate pred() const { return UnaryPredicate(); } @@ -53,7 +67,21 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::partition(cont, policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + + const Container old_cont(cont); + Container cont2(old_cont); + result_t result = boost::partition(cont, policy.pred()); + + // Test that operation a temporary created by using + // make_iterator_range. + boost::partition( + boost::make_iterator_range(cont2), policy.pred()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; } }; diff --git a/test/algorithm_test/prev_permutation.cpp b/test/algorithm_test/prev_permutation.cpp index e1073c9..a4adc7b 100644 --- a/test/algorithm_test/prev_permutation.cpp +++ b/test/algorithm_test/prev_permutation.cpp @@ -25,12 +25,12 @@ namespace boost { Container reference(cont); Container test(cont); + Container test2(cont); const bool reference_ret = std::prev_permutation(reference.begin(), reference.end()); - const bool test_ret - = boost::prev_permutation(test); + const bool test_ret = boost::prev_permutation(test); BOOST_CHECK( reference_ret == test_ret ); @@ -38,6 +38,14 @@ namespace boost reference.begin(), reference.end(), test.begin(), test.end() ); + + BOOST_CHECK( test_ret == boost::prev_permutation( + boost::make_iterator_range(test2)) ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference.begin(), reference.end(), + test2.begin(), test2.end() + ); } template @@ -46,13 +54,13 @@ namespace boost { Container reference(cont); Container test(cont); + Container test2(cont); const bool reference_ret = std::prev_permutation(reference.begin(), reference.end(), pred); - const bool test_ret - = boost::prev_permutation(test, pred); + const bool test_ret = boost::prev_permutation(test, pred); BOOST_CHECK( reference_ret == test_ret ); @@ -60,6 +68,14 @@ namespace boost reference.begin(), reference.end(), test.begin(), test.end() ); + + BOOST_CHECK( test_ret == boost::prev_permutation( + boost::make_iterator_range(test2), pred) ); + + BOOST_CHECK_EQUAL_COLLECTIONS( + reference.begin(), reference.end(), + test2.begin(), test2.end() + ); } template diff --git a/test/algorithm_test/random_shuffle.cpp b/test/algorithm_test/random_shuffle.cpp index ba55f51..410749a 100644 --- a/test/algorithm_test/random_shuffle.cpp +++ b/test/algorithm_test/random_shuffle.cpp @@ -110,6 +110,14 @@ namespace boost { shuffled = true; } + + // Verify that the shuffle can be performed on a + // temporary range + Container test2(cont); + boost::random_shuffle(boost::make_iterator_range(test2)); + ok = test_shuffle_result(cont, test2); + if (!ok) + break; } } @@ -124,6 +132,17 @@ namespace boost { BOOST_CHECK( gen.invocation_count() > 0 ); } + + // Test that random shuffle works when + // passed a temporary range + RandomGenerator gen2; + Container cont2(old_cont); + boost::random_shuffle(boost::make_iterator_range(cont2), gen2); + test_shuffle_result(cont2, old_cont); + if (cont2.size() > 2) + { + BOOST_CHECK( gen2.invocation_count() > 0 ); + } } template diff --git a/test/algorithm_test/remove.cpp b/test/algorithm_test/remove.cpp index 46e6591..3e4ab16 100644 --- a/test/algorithm_test/remove.cpp +++ b/test/algorithm_test/remove.cpp @@ -43,7 +43,16 @@ namespace boost std::distance(reference.begin(), reference_it) ); BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), - test.begin(), test.end() ); + test.begin(), test.end() ); + + Container test2(c); + iterator_t test_it2 = boost::remove(test2, to_remove); + + BOOST_CHECK_EQUAL( std::distance(test2.begin(), test_it2), + std::distance(reference.begin(), reference_it) ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); } template< class Container > diff --git a/test/algorithm_test/remove_copy.cpp b/test/algorithm_test/remove_copy.cpp new file mode 100644 index 0000000..4050ef4 --- /dev/null +++ b/test/algorithm_test/remove_copy.cpp @@ -0,0 +1,107 @@ +// Boost.Range library +// +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + template + void test_append(Iterator target, Value value) + { + *target++ = value; + } + + template< class Container, class Value > + void test_remove_copy_impl( const Container& c, Value to_remove ) + { + typedef typename boost::range_value::type value_type; + std::vector reference; + + typedef BOOST_DEDUCED_TYPENAME std::vector::iterator iterator_t; + + test_append( + std::remove_copy(c.begin(), c.end(), + std::back_inserter(reference), to_remove), + to_remove); + + std::vector test; + test_append( + boost::remove_copy(c, std::back_inserter(test), to_remove), + to_remove); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + std::vector test2; + test_append( + boost::remove_copy(boost::make_iterator_range(c), + std::back_inserter(test2), to_remove), + to_remove); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); + } + + template< class Container > + void test_remove_copy_impl() + { + using namespace boost::assign; + + Container cont; + test_remove_copy_impl(cont, 0); + + cont.clear(); + cont += 1; + test_remove_copy_impl(cont, 0); + test_remove_copy_impl(cont, 1); + + cont.clear(); + cont += 1,1,1,1,1; + test_remove_copy_impl(cont, 0); + test_remove_copy_impl(cont, 1); + + cont.clear(); + cont += 1,2,3,4,5,6,7,8,9; + test_remove_copy_impl(cont, 1); + test_remove_copy_impl(cont, 9); + test_remove_copy_impl(cont, 4); + } + + void test_remove_copy() + { + test_remove_copy_impl< std::vector >(); + test_remove_copy_impl< std::list >(); + test_remove_copy_impl< std::deque >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.remove_copy" ); + + test->add( BOOST_TEST_CASE( &test_remove_copy ) ); + + return test; +} + diff --git a/test/algorithm_test/remove_copy_if.cpp b/test/algorithm_test/remove_copy_if.cpp new file mode 100644 index 0000000..c269c2a --- /dev/null +++ b/test/algorithm_test/remove_copy_if.cpp @@ -0,0 +1,113 @@ +// Boost.Range library +// +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + template< class Iterator, class Value > + void test_append(Iterator target, Value value) + { + *target++ = value; + } + + template< class Container, class UnaryPredicate > + void test_remove_copy_if_impl( const Container& c, UnaryPredicate pred ) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_value::type value_type; + std::vector reference; + + test_append( + std::remove_copy_if(c.begin(), c.end(), std::back_inserter(reference), pred), + value_type() + ); + + std::vector test; + test_append( + boost::remove_copy_if(c, std::back_inserter(test), pred), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + std::vector test2; + test_append( + boost::remove_copy_if(boost::make_iterator_range(c), + std::back_inserter(test2), pred), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); + } + + template< class Container > + void test_remove_copy_if_( const Container& c, int to_remove ) + { + test_remove_copy_if_impl(c, boost::bind(std::equal_to(), _1, to_remove)); + test_remove_copy_if_impl(c, boost::bind(std::not_equal_to(), _1, to_remove)); + } + + template< class Container > + void test_remove_copy_if_impl() + { + using namespace boost::assign; + + Container cont; + test_remove_copy_if_(cont, 0); + + cont.clear(); + cont += 1; + test_remove_copy_if_(cont, 0); + test_remove_copy_if_(cont, 1); + + cont.clear(); + cont += 1,1,1,1,1; + test_remove_copy_if_(cont, 0); + test_remove_copy_if_(cont, 1); + + cont.clear(); + cont += 1,2,3,4,5,6,7,8,9; + test_remove_copy_if_(cont, 1); + test_remove_copy_if_(cont, 9); + test_remove_copy_if_(cont, 4); + } + + inline void test_remove_copy_if() + { + test_remove_copy_if_impl< std::vector >(); + test_remove_copy_if_impl< std::list >(); + test_remove_copy_if_impl< std::deque >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.remove_copy_if" ); + + test->add( BOOST_TEST_CASE( &test_remove_copy_if ) ); + + return test; +} diff --git a/test/algorithm_test/remove_if.cpp b/test/algorithm_test/remove_if.cpp index 1e77e7b..58fc07f 100644 --- a/test/algorithm_test/remove_if.cpp +++ b/test/algorithm_test/remove_if.cpp @@ -43,7 +43,17 @@ namespace boost std::distance(reference.begin(), reference_it) ); BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), - test.begin(), test.end() ); + test.begin(), test.end() ); + + Container test2(c); + iterator_t test_it2 = boost::remove_if( + boost::make_iterator_range(test2), pred); + + BOOST_CHECK_EQUAL( std::distance(test2.begin(), test_it2), + std::distance(reference.begin(), reference_it) ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); } template< class Container > diff --git a/test/algorithm_test/replace.cpp b/test/algorithm_test/replace.cpp index 4a882dc..356024f 100644 --- a/test/algorithm_test/replace.cpp +++ b/test/algorithm_test/replace.cpp @@ -36,7 +36,14 @@ namespace boost boost::replace(target, what, with_what); BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), - target.begin(), target.end() ); + target.begin(), target.end() ); + + std::vector target2(cont.begin(), cont.end()); + boost::replace(boost::make_iterator_range(target2), what, + with_what); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target2.begin(), target2.end() ); } diff --git a/test/algorithm_test/replace_copy.cpp b/test/algorithm_test/replace_copy.cpp new file mode 100644 index 0000000..6ae12e2 --- /dev/null +++ b/test/algorithm_test/replace_copy.cpp @@ -0,0 +1,110 @@ +// Boost.Range library +// +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + template + void test_append(Iterator target, Value value) + { + *target++ = value; + } + + template< class Container, class Value > + void test_replace_copy_impl( const Container& c, Value to_replace ) + { + const Value replace_with = to_replace * 2; + + typedef typename boost::range_value::type value_type; + std::vector reference; + + typedef BOOST_DEDUCED_TYPENAME std::vector::iterator iterator_t; + + test_append( + std::replace_copy(c.begin(), c.end(), + std::back_inserter(reference), to_replace, replace_with), + to_replace); + + std::vector test; + test_append( + boost::replace_copy(c, std::back_inserter(test), to_replace, replace_with), + to_replace); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + std::vector test2; + test_append( + boost::replace_copy(boost::make_iterator_range(c), + std::back_inserter(test2), to_replace, + replace_with), + to_replace); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); + } + + template< class Container > + void test_replace_copy_impl() + { + using namespace boost::assign; + + Container cont; + test_replace_copy_impl(cont, 0); + + cont.clear(); + cont += 1; + test_replace_copy_impl(cont, 0); + test_replace_copy_impl(cont, 1); + + cont.clear(); + cont += 1,1,1,1,1; + test_replace_copy_impl(cont, 0); + test_replace_copy_impl(cont, 1); + + cont.clear(); + cont += 1,2,3,4,5,6,7,8,9; + test_replace_copy_impl(cont, 1); + test_replace_copy_impl(cont, 9); + test_replace_copy_impl(cont, 4); + } + + void test_replace_copy() + { + test_replace_copy_impl< std::vector >(); + test_replace_copy_impl< std::list >(); + test_replace_copy_impl< std::deque >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.replace_copy" ); + + test->add( BOOST_TEST_CASE( &test_replace_copy ) ); + + return test; +} + diff --git a/test/algorithm_test/replace_copy_if.cpp b/test/algorithm_test/replace_copy_if.cpp new file mode 100644 index 0000000..6873547 --- /dev/null +++ b/test/algorithm_test/replace_copy_if.cpp @@ -0,0 +1,115 @@ +// Boost.Range library +// +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + template< class Iterator, class Value > + void test_append(Iterator target, Value value) + { + *target++ = value; + } + + template< class Container, class UnaryPredicate > + void test_replace_copy_if_impl( const Container& c, UnaryPredicate pred ) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_value::type value_type; + const value_type replace_with = value_type(); + std::vector reference; + + test_append( + std::replace_copy_if(c.begin(), c.end(), std::back_inserter(reference), pred, replace_with), + value_type() + ); + + std::vector test; + test_append( + boost::replace_copy_if(c, std::back_inserter(test), pred, replace_with), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + std::vector test2; + test_append( + boost::replace_copy_if(boost::make_iterator_range(c), + std::back_inserter(test2), pred, + replace_with), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); + } + + template< class Container > + void test_replace_copy_if_( const Container& c, int to_replace ) + { + test_replace_copy_if_impl(c, boost::bind(std::equal_to(), _1, to_replace)); + test_replace_copy_if_impl(c, boost::bind(std::not_equal_to(), _1, to_replace)); + } + + template< class Container > + void test_replace_copy_if_impl() + { + using namespace boost::assign; + + Container cont; + test_replace_copy_if_(cont, 0); + + cont.clear(); + cont += 1; + test_replace_copy_if_(cont, 0); + test_replace_copy_if_(cont, 1); + + cont.clear(); + cont += 1,1,1,1,1; + test_replace_copy_if_(cont, 0); + test_replace_copy_if_(cont, 1); + + cont.clear(); + cont += 1,2,3,4,5,6,7,8,9; + test_replace_copy_if_(cont, 1); + test_replace_copy_if_(cont, 9); + test_replace_copy_if_(cont, 4); + } + + inline void test_replace_copy_if() + { + test_replace_copy_if_impl< std::vector >(); + test_replace_copy_if_impl< std::list >(); + test_replace_copy_if_impl< std::deque >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.replace_copy_if" ); + + test->add( BOOST_TEST_CASE( &test_replace_copy_if ) ); + + return test; +} diff --git a/test/algorithm_test/replace_if.cpp b/test/algorithm_test/replace_if.cpp index e1dd26f..12d7293 100644 --- a/test/algorithm_test/replace_if.cpp +++ b/test/algorithm_test/replace_if.cpp @@ -40,8 +40,14 @@ namespace boost boost::replace_if(target, boost::bind(pred, _1, what), with_what); BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), - target.begin(), target.end() ); - + target.begin(), target.end() ); + + std::vector target2(cont.begin(), cont.end()); + boost::replace_if(boost::make_iterator_range(target2), + boost::bind(pred, _1, what), with_what); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target2.begin(), target2.end() ); } template< class Container > diff --git a/test/algorithm_test/reverse.cpp b/test/algorithm_test/reverse.cpp index 611a464..3ad63cb 100644 --- a/test/algorithm_test/reverse.cpp +++ b/test/algorithm_test/reverse.cpp @@ -29,14 +29,16 @@ namespace boost { Container reference(cont); Container test(cont); + Container test2(cont); boost::reverse(test); std::reverse(reference.begin(), reference.end()); - - BOOST_CHECK_EQUAL_COLLECTIONS( - reference.begin(), reference.end(), - test.begin(), test.end() - ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + boost::reverse(boost::make_iterator_range(test2)); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); } template diff --git a/test/algorithm_test/reverse_copy.cpp b/test/algorithm_test/reverse_copy.cpp new file mode 100644 index 0000000..92ef485 --- /dev/null +++ b/test/algorithm_test/reverse_copy.cpp @@ -0,0 +1,97 @@ +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + template + void test_append(OutputIterator out, Value value) + { + *out++ = value; + } + + template + void test_reverse_copy_impl(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_value::type value_type; + std::vector reference; + std::vector test; + + test_append( + std::reverse_copy(cont.begin(), cont.end(), std::back_inserter(reference)), + value_type() + ); + + test_append( + boost::reverse_copy(cont, std::back_inserter(test)), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + test.clear(); + + test_append( + boost::reverse_copy(boost::make_iterator_range(cont), + std::back_inserter(test)), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + } + + template + void test_reverse_copy_impl() + { + using namespace boost::assign; + + Container cont; + test_reverse_copy_impl(cont); + + cont.clear(); + cont += 1; + test_reverse_copy_impl(cont); + + cont.clear(); + cont += 1,2,3,4,5,6,7,8,9; + test_reverse_copy_impl(cont); + } + + void test_reverse_copy() + { + test_reverse_copy_impl< std::vector >(); + test_reverse_copy_impl< std::list >(); + test_reverse_copy_impl< std::deque >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.reverse_copy" ); + + test->add( BOOST_TEST_CASE( &::test_reverse_copy ) ); + + return test; +} diff --git a/test/algorithm_test/rotate.cpp b/test/algorithm_test/rotate.cpp index f8b394a..b6b7af2 100644 --- a/test/algorithm_test/rotate.cpp +++ b/test/algorithm_test/rotate.cpp @@ -42,10 +42,18 @@ namespace boost boost::rotate(test, test_where_it); - BOOST_CHECK_EQUAL_COLLECTIONS( - reference.begin(), reference.end(), - test.begin(), test.end() - ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + test = cont; + test_where_it = test.begin(); + std::advance(test_where_it, + std::distance(cont.begin(), where_it)); + + boost::rotate(boost::make_iterator_range(test), test_where_it); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); } template diff --git a/test/algorithm_test/rotate_copy.cpp b/test/algorithm_test/rotate_copy.cpp new file mode 100644 index 0000000..5615479 --- /dev/null +++ b/test/algorithm_test/rotate_copy.cpp @@ -0,0 +1,112 @@ +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + template + void test_append(OutputIterator target, Value value) + { + *target++ = value; + } + + template + void test_rotate_copy_impl(Container& cont, Iterator where_it) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_value::type value_type; + std::vector reference; + std::vector test; + + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iterator_t; + + test_append( + std::rotate_copy(cont.begin(), where_it, cont.end(), + std::back_inserter(reference)), + value_type() + ); + + test_append( + boost::rotate_copy(cont, where_it, std::back_inserter(test)), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + test.clear(); + + test_append( + boost::rotate_copy(boost::make_iterator_range(cont), where_it, + std::back_inserter(test)), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + } + + template + void test_rotate_copy_impl(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iterator_t; + + iterator_t last = cont.end(); + for (iterator_t it = cont.begin(); it != last; ++it) + { + test_rotate_copy_impl(cont, it); + } + } + + template + void test_rotate_copy_impl() + { + using namespace boost::assign; + + Container cont; + test_rotate_copy_impl(cont); + + cont.clear(); + cont += 1; + test_rotate_copy_impl(cont); + + cont.clear(); + cont += 1,2,3,4,5,6,7,8,9; + test_rotate_copy_impl(cont); + } + + void test_rotate_copy() + { + test_rotate_copy_impl< std::vector >(); + test_rotate_copy_impl< std::list >(); + test_rotate_copy_impl< std::deque >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.rotate_copy" ); + + test->add( BOOST_TEST_CASE( &test_rotate_copy ) ); + + return test; +} diff --git a/test/algorithm_test/search.cpp b/test/algorithm_test/search.cpp index 460f70d..91f19bd 100644 --- a/test/algorithm_test/search.cpp +++ b/test/algorithm_test/search.cpp @@ -33,9 +33,25 @@ namespace boost const Container2& ccont2 = cont2; iterator1_t it = boost::search(cont1, cont2); + BOOST_CHECK( it == boost::search(boost::make_iterator_range(cont1), cont2) ); + BOOST_CHECK( it == boost::search(cont1, boost::make_iterator_range(cont2)) ); + BOOST_CHECK( it == boost::search(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2)) ); iterator1_t it2 = boost::search(cont1, ccont2); + BOOST_CHECK( it2 == boost::search(boost::make_iterator_range(cont1), ccont2) ); + BOOST_CHECK( it2 == boost::search(cont1, boost::make_iterator_range(ccont2)) ); + BOOST_CHECK( it2 == boost::search(boost::make_iterator_range(cont1), + boost::make_iterator_range(ccont2)) ); const_iterator1_t cit = boost::search(ccont1, cont2); + BOOST_CHECK( cit == boost::search(boost::make_iterator_range(ccont1), cont2) ); + BOOST_CHECK( cit == boost::search(ccont1, boost::make_iterator_range(cont2)) ); + BOOST_CHECK( cit == boost::search(boost::make_iterator_range(ccont1), + boost::make_iterator_range(cont2)) ); const_iterator1_t cit2 = boost::search(ccont1, ccont2); + BOOST_CHECK( cit2 == boost::search(boost::make_iterator_range(ccont1), ccont2) ); + BOOST_CHECK( cit2 == boost::search(ccont1, boost::make_iterator_range(ccont2)) ); + BOOST_CHECK( cit2 == boost::search(boost::make_iterator_range(ccont1), + boost::make_iterator_range(ccont2)) ); BOOST_CHECK( it == std::search(cont1.begin(), cont1.end(), cont2.begin(), cont2.end()) ); BOOST_CHECK( it2 == std::search(cont1.begin(), cont1.end(), ccont2.begin(), ccont2.end()) ); diff --git a/test/algorithm_test/search_n.cpp b/test/algorithm_test/search_n.cpp new file mode 100644 index 0000000..3b0aa91 --- /dev/null +++ b/test/algorithm_test/search_n.cpp @@ -0,0 +1,93 @@ +// Boost.Range library +// +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include + +namespace +{ + template< class Container1, class Value > + void test_search_n_impl(Container1& cont1, Value value) + { + typedef BOOST_DEDUCED_TYPENAME Container1::const_iterator const_iterator1_t; + typedef BOOST_DEDUCED_TYPENAME Container1::iterator iterator1_t; + + const Container1& ccont1 = cont1; + + for (std::size_t n = 0; n < cont1.size(); ++n) + { + iterator1_t it = boost::search_n(cont1, n, value); + BOOST_CHECK( it == boost::search_n(boost::make_iterator_range(cont1), n, value) ); + BOOST_CHECK( it == std::search_n(cont1.begin(), cont1.end(), n, value) ); + + const_iterator1_t cit = boost::search_n(ccont1, n, value); + BOOST_CHECK( cit == boost::search_n(boost::make_iterator_range(ccont1), n, value) ); + BOOST_CHECK( cit == std::search_n(ccont1.begin(), ccont1.end(), n, value) ); + } + } + + template< class Container1, class Container2 > + void test_search_n_impl() + { + using namespace boost::assign; + + Container1 cont1; + + test_search_n_impl(cont1, 1); + + cont1 += 1; + test_search_n_impl(cont1, 1); + test_search_n_impl(cont1, 0); + + cont1.clear(); + cont1 += 1,1; + test_search_n_impl(cont1, 1); + test_search_n_impl(cont1, 0); + + cont1 += 1,1,1; + test_search_n_impl(cont1, 1); + test_search_n_impl(cont1, 0); + + cont1.clear(); + cont1 += 1,2,3,4,5,6,7,8,9; + test_search_n_impl(cont1, 1); + test_search_n_impl(cont1, 2); + test_search_n_impl(cont1, 5); + test_search_n_impl(cont1, 9); + } + + void test_search_n() + { + test_search_n_impl< std::list, std::list >(); + test_search_n_impl< std::vector, std::vector >(); + test_search_n_impl< std::set, std::set >(); + test_search_n_impl< std::list, std::vector >(); + test_search_n_impl< std::vector, std::list >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.search_n" ); + + test->add( BOOST_TEST_CASE( &test_search_n ) ); + + return test; +} diff --git a/test/algorithm_test/set_difference.cpp b/test/algorithm_test/set_difference.cpp index 7fb0974..84dc62c 100644 --- a/test/algorithm_test/set_difference.cpp +++ b/test/algorithm_test/set_difference.cpp @@ -62,6 +62,28 @@ namespace boost check_result(reference, reference_result, test_cont, test_result); + + test_result = boost::set_difference( + boost::make_iterator_range(cont1), cont2, + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_difference( + cont1, boost::make_iterator_range(cont2), + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_difference( + boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); } template @@ -100,6 +122,28 @@ namespace boost check_result(reference, reference_result, test_cont, test_result); + + test_result = boost::set_difference( + boost::make_iterator_range(cont1), cont2, + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_difference( + cont1, boost::make_iterator_range(cont2), + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_difference( + boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); } template diff --git a/test/algorithm_test/set_intersection.cpp b/test/algorithm_test/set_intersection.cpp index 5e2ce1b..213bbdf 100644 --- a/test/algorithm_test/set_intersection.cpp +++ b/test/algorithm_test/set_intersection.cpp @@ -62,6 +62,28 @@ namespace boost check_result(reference, reference_result, test_cont, test_result); + + test_result = boost::set_intersection( + boost::make_iterator_range(cont1), cont2, + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_intersection( + cont1, boost::make_iterator_range(cont2), + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_intersection( + boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); } template @@ -100,6 +122,28 @@ namespace boost check_result(reference, reference_result, test_cont, test_result); + + test_result = boost::set_intersection( + boost::make_iterator_range(cont1), cont2, + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_intersection( + cont1, boost::make_iterator_range(cont2), + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_intersection( + boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); } template diff --git a/test/algorithm_test/set_symmetric_difference.cpp b/test/algorithm_test/set_symmetric_difference.cpp index 149532c..b792fd8 100644 --- a/test/algorithm_test/set_symmetric_difference.cpp +++ b/test/algorithm_test/set_symmetric_difference.cpp @@ -63,6 +63,28 @@ namespace boost check_result(reference, reference_result, test_cont, test_result); + + test_result = boost::set_symmetric_difference( + boost::make_iterator_range(cont1), cont2, + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_symmetric_difference( + cont1, boost::make_iterator_range(cont2), + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_symmetric_difference( + boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); } template @@ -102,6 +124,28 @@ namespace boost check_result(reference, reference_result, test_cont, test_result); + + test_result = boost::set_symmetric_difference( + boost::make_iterator_range(cont1), cont2, + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_symmetric_difference( + cont1, boost::make_iterator_range(cont2), + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_symmetric_difference( + boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); } template diff --git a/test/algorithm_test/set_union.cpp b/test/algorithm_test/set_union.cpp index f9450b3..7f9f10a 100644 --- a/test/algorithm_test/set_union.cpp +++ b/test/algorithm_test/set_union.cpp @@ -62,6 +62,26 @@ namespace boost check_result(reference, reference_result, test_cont, test_result); + + test_result = boost::set_union(boost::make_iterator_range(cont1), + cont2, test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_union(cont1, + boost::make_iterator_range(cont2), + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_union(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_cont.begin()); + + check_result(reference, reference_result, + test_cont, test_result); } template @@ -100,6 +120,26 @@ namespace boost check_result(reference, reference_result, test_cont, test_result); + + test_result = boost::set_union(boost::make_iterator_range(cont1), + cont2, test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_union(cont1, + boost::make_iterator_range(cont2), + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); + + test_result = boost::set_union(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + test_cont.begin(), pred); + + check_result(reference, reference_result, + test_cont, test_result); } template diff --git a/test/algorithm_test/sort.cpp b/test/algorithm_test/sort.cpp index b1b26e7..c6611f7 100644 --- a/test/algorithm_test/sort.cpp +++ b/test/algorithm_test/sort.cpp @@ -33,10 +33,13 @@ namespace boost boost::sort(test); std::sort(reference.begin(), reference.end()); - BOOST_CHECK_EQUAL_COLLECTIONS( - reference.begin(), reference.end(), - test.begin(), test.end() - ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + Container test2(cont); + boost::sort(boost::make_iterator_range(test2)); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); } template @@ -52,6 +55,11 @@ namespace boost reference.begin(), reference.end(), test.begin(), test.end() ); + + Container test2(cont); + boost::sort(boost::make_iterator_range(test2), pred); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test2.begin(), test2.end() ); } template diff --git a/test/algorithm_test/stable_partition.cpp b/test/algorithm_test/stable_partition.cpp index fad4bef..5f55b7d 100644 --- a/test/algorithm_test/stable_partition.cpp +++ b/test/algorithm_test/stable_partition.cpp @@ -41,7 +41,21 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::stable_partition(cont, UnaryPredicate()); + Container cont2(cont); + + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::stable_partition(cont, UnaryPredicate()); + + iter_t temp_result = boost::stable_partition( + boost::make_iterator_range(cont2), UnaryPredicate()); + + BOOST_CHECK_EQUAL( std::distance(cont.begin(), result), + std::distance(cont2.begin(), temp_result) ); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; } UnaryPredicate pred() const { return UnaryPredicate(); } @@ -53,7 +67,17 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::stable_partition(cont, policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + Container cont2(cont); + result_t result = boost::stable_partition(cont, policy.pred()); + + result_t result2 = boost::stable_partition( + boost::make_iterator_range(cont2), policy.pred()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont2.begin(), cont2.end(), + cont.begin(), cont.end() ); + + return result; } }; diff --git a/test/algorithm_test/stable_sort.cpp b/test/algorithm_test/stable_sort.cpp index eb5518c..8372bd6 100644 --- a/test/algorithm_test/stable_sort.cpp +++ b/test/algorithm_test/stable_sort.cpp @@ -33,10 +33,13 @@ namespace boost boost::stable_sort(test); std::stable_sort(reference.begin(), reference.end()); - BOOST_CHECK_EQUAL_COLLECTIONS( - reference.begin(), reference.end(), - test.begin(), test.end() - ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + test = cont; + boost::stable_sort(boost::make_iterator_range(test)); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); } template @@ -48,10 +51,13 @@ namespace boost boost::stable_sort(test, pred); std::stable_sort(reference.begin(), reference.end(), pred); - BOOST_CHECK_EQUAL_COLLECTIONS( - reference.begin(), reference.end(), - test.begin(), test.end() - ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); + + test = cont; + boost::stable_sort(boost::make_iterator_range(test), pred); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + test.begin(), test.end() ); } template diff --git a/test/algorithm_test/swap_ranges.cpp b/test/algorithm_test/swap_ranges.cpp new file mode 100644 index 0000000..a96bfac --- /dev/null +++ b/test/algorithm_test/swap_ranges.cpp @@ -0,0 +1,116 @@ +// Boost.Range library +// +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + template + void test_swap_ranges_impl(const Container1& source1, const Container2& source2) + { + Container1 reference1(source1); + Container2 reference2(source2); + std::swap_ranges(reference1.begin(), reference1.end(), reference2.begin()); + + Container1 test1(source1); + Container2 test2(source2); + boost::swap_ranges(test1, test2); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference1.begin(), reference1.end(), + test1.begin(), test1.end() ); + + BOOST_CHECK_EQUAL_COLLECTIONS( reference2.begin(), reference2.end(), + test2.begin(), test2.end() ); + + test1 = source1; + test2 = source2; + boost::swap_ranges(boost::make_iterator_range(test1), test2); + BOOST_CHECK_EQUAL_COLLECTIONS( reference1.begin(), reference1.end(), + test1.begin(), test1.end() ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference2.begin(), reference2.end(), + test2.begin(), test2.end() ); + + test1 = source1; + test2 = source2; + boost::swap_ranges(test1, boost::make_iterator_range(test2)); + BOOST_CHECK_EQUAL_COLLECTIONS( reference1.begin(), reference1.end(), + test1.begin(), test1.end() ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference2.begin(), reference2.end(), + test2.begin(), test2.end() ); + + test1 = source1; + test2 = source2; + boost::swap_ranges(boost::make_iterator_range(test1), + boost::make_iterator_range(test2)); + BOOST_CHECK_EQUAL_COLLECTIONS( reference1.begin(), reference1.end(), + test1.begin(), test1.end() ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference2.begin(), reference2.end(), + test2.begin(), test2.end() ); + } + + template + void test_swap_ranges_impl() + { + using namespace boost::assign; + + Container1 c1; + Container2 c2; + + test_swap_ranges_impl(c1, c2); + + c1.clear(); + c1 += 1; + c2.clear(); + c2 += 2; + test_swap_ranges_impl(c1, c2); + + c1.clear(); + c1 += 1,2,3,4,5,6,7,8,9,10; + c2.clear(); + c2 += 10,9,8,7,6,5,4,3,2,1; + test_swap_ranges_impl(c1, c2); + } + + inline void test_swap_ranges() + { + test_swap_ranges_impl< std::vector, std::vector >(); + test_swap_ranges_impl< std::vector, std::list >(); + test_swap_ranges_impl< std::vector, std::deque >(); + test_swap_ranges_impl< std::list, std::vector >(); + test_swap_ranges_impl< std::list, std::list >(); + test_swap_ranges_impl< std::list, std::deque >(); + test_swap_ranges_impl< std::deque, std::vector >(); + test_swap_ranges_impl< std::deque, std::list >(); + test_swap_ranges_impl< std::deque, std::deque >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.swap_ranges" ); + + test->add( BOOST_TEST_CASE( &test_swap_ranges ) ); + + return test; +} diff --git a/test/algorithm_test/transform.cpp b/test/algorithm_test/transform.cpp index 7f016a2..3e37180 100644 --- a/test/algorithm_test/transform.cpp +++ b/test/algorithm_test/transform.cpp @@ -47,16 +47,23 @@ namespace boost BOOST_CHECK( test_it == target.end() ); BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), - target.begin(), target.end() ); - + target.begin(), target.end() ); + + BOOST_CHECK( test_it == boost::transform(boost::make_iterator_range(cont), target.begin(), fn) ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target.begin(), target.end() ); + target.clear(); target.resize(ccont.size()); test_it = boost::transform(ccont, target.begin(), fn); - + BOOST_CHECK( test_it == target.end() ); BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), - target.begin(), target.end() ); + target.begin(), target.end() ); + BOOST_CHECK( test_it == boost::transform(boost::make_iterator_range(ccont), target.begin(), fn) ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target.begin(), target.end() ); } template< class Container > @@ -97,10 +104,25 @@ namespace boost iterator_t test_it = boost::transform(cont1, cont2, target.begin(), fn); - + BOOST_CHECK( test_it == target.end() ); BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), - target.begin(), target.end() ); + target.begin(), target.end() ); + + BOOST_CHECK( test_it == boost::transform(boost::make_iterator_range(cont1), cont2, target.begin(), fn) ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target.begin(), target.end() ); + + BOOST_CHECK( test_it == boost::transform(cont1, boost::make_iterator_range(cont2), target.begin(), fn) ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target.begin(), target.end() ); + + BOOST_CHECK( test_it == boost::transform(boost::make_iterator_range(cont1), + boost::make_iterator_range(cont2), + target.begin(), fn) ); + BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(), + target.begin(), target.end() ); + target.clear(); target.resize(ccont1.size()); diff --git a/test/algorithm_test/unique.cpp b/test/algorithm_test/unique.cpp index 2e2ebfa..49af0e3 100644 --- a/test/algorithm_test/unique.cpp +++ b/test/algorithm_test/unique.cpp @@ -47,7 +47,18 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy&, Container& cont) { - return boost::unique(cont); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + + Container cont2(cont); + + result_t result = boost::unique(cont); + + boost::unique(boost::make_iterator_range(cont2)); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; } }; @@ -82,7 +93,18 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::unique(cont, policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + + Container cont2(cont); + + result_t result = boost::unique(cont, policy.pred()); + + boost::unique(boost::make_iterator_range(cont2), policy.pred()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; } }; diff --git a/test/algorithm_test/unique_copy.cpp b/test/algorithm_test/unique_copy.cpp new file mode 100644 index 0000000..21f107a --- /dev/null +++ b/test/algorithm_test/unique_copy.cpp @@ -0,0 +1,158 @@ +// Boost.Range library +// +// Copyright Neil Groves 2009. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + template + void test_append(OutputIterator target, Value value) + { + *target++ = value; + } + + template + void test_unique_copy_impl(Container& c) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_value::type value_type; + std::vector reference; + std::vector test; + + test_append( + std::unique_copy(c.begin(), c.end(), std::back_inserter(reference)), + value_type() + ); + + test_append( + boost::unique_copy(c, std::back_inserter(test)), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(), + test.begin(), test.end()); + + test.clear(); + + test_append( + boost::unique_copy(boost::make_iterator_range(c), + std::back_inserter(test)), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(), + test.begin(), test.end()); + } + + template + void test_unique_copy_impl(Container& c, Pred pred) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_value::type value_type; + std::vector reference; + std::vector test; + + test_append( + std::unique_copy(c.begin(), c.end(), std::back_inserter(reference), pred), + value_type() + ); + + test_append( + boost::unique_copy(c, std::back_inserter(test), pred), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(), + test.begin(), test.end()); + + test.clear(); + + test_append( + boost::unique_copy(boost::make_iterator_range(c), + std::back_inserter(test), pred), + value_type() + ); + + BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(), + test.begin(), test.end()); + } + + template + void test_unique_copy_driver(Pred pred) + { + using namespace boost::assign; + + typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; + + Container cont; + + test_unique_copy_impl(cont); + test_unique_copy_impl(cont, pred); + + cont.clear(); + cont += 1; + + std::vector temp(cont.begin(), cont.end()); + std::sort(temp.begin(), temp.end()); + cont.assign(temp.begin(), temp.end()); + test_unique_copy_impl(cont); + + std::sort(temp.begin(), temp.end(), pred); + cont.assign(temp.begin(), temp.end()); + test_unique_copy_impl(cont, pred); + + cont.clear(); + cont += 1,2,2,2,2,3,4,5,6,7,8,9; + + temp.assign(cont.begin(), cont.end()); + std::sort(temp.begin(), temp.end()); + cont.assign(temp.begin(), temp.end()); + test_unique_copy_impl(cont); + + std::sort(temp.begin(), temp.end(), pred); + cont.assign(temp.begin(), temp.end()); + test_unique_copy_impl(cont, pred); + } + + template + void test_unique_copy_impl() + { + test_unique_copy_driver(std::less()); + test_unique_copy_driver(std::greater()); + } + + void test_unique_copy() + { + test_unique_copy_impl< std::vector >(); + test_unique_copy_impl< std::list >(); + test_unique_copy_impl< std::deque >(); + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.unique_copy" ); + + test->add( BOOST_TEST_CASE( &test_unique_copy ) ); + + return test; +} diff --git a/test/algorithm_test/upper_bound.cpp b/test/algorithm_test/upper_bound.cpp index 2eb64cf..95e3965 100644 --- a/test/algorithm_test/upper_bound.cpp +++ b/test/algorithm_test/upper_bound.cpp @@ -32,7 +32,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::upper_bound(cont, 5); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::upper_bound(cont, 5); + BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) ); + return result; } template @@ -42,7 +45,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy&, Container& cont) { - return boost::upper_bound(cont, 5); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + result_t result = boost::upper_bound(cont, 5); + BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) ); + return result; } }; @@ -61,7 +67,10 @@ namespace boost BOOST_DEDUCED_TYPENAME range_iterator::type test_iter(Container& cont) { - return boost::upper_bound(cont, 5, BinaryPredicate()); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + iter_t result = boost::upper_bound(cont, 5, BinaryPredicate()); + BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5, BinaryPredicate()) ); + return result; } template< range_return_value result_type> @@ -71,8 +80,14 @@ namespace boost BOOST_DEDUCED_TYPENAME range_return::type operator()(Policy& policy, Container& cont) { - return boost::upper_bound( - cont, 5, policy.pred()); + typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; + + result_t result = boost::upper_bound(cont, 5, policy.pred()); + + BOOST_CHECK( result == boost::upper_bound( + boost::make_iterator_range(cont), 5, policy.pred()) ); + + return result; } }; diff --git a/test/replace_copy.cpp b/test/replace_copy.cpp new file mode 100644 index 0000000..e69de29 diff --git a/test/string.cpp b/test/string.cpp index 127f70a..f73abb0 100644 --- a/test/string.cpp +++ b/test/string.cpp @@ -17,6 +17,7 @@ # pragma warn -8057 // unused argument argc/argv in Boost.Test #endif +#include #include #include #include @@ -29,6 +30,34 @@ #include #include +namespace +{ + template< class CharT, std::size_t Length > + class test_string + { + public: + typedef CharT value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef std::size_t size_type; + typedef value_type array_t[Length]; + typedef const value_type const_array_t[Length]; + + explicit test_string(const CharT literal_sz[]) + { + std::copy(literal_sz, literal_sz + Length, m_buffer.data()); + m_buffer[Length] = value_type(); + } + + const_pointer const_sz() const { return m_buffer.data(); } + pointer mutable_sz() { return m_buffer.data(); } + + private: + typedef boost::array buffer_t; + buffer_t m_buffer; + }; +} + template< class T > inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type str_begin( T& r ) @@ -105,11 +134,15 @@ void check_char() { typedef char* char_iterator_t; typedef char char_array_t[10]; - const char* char_s = "a string"; - char my_string[] = "another string"; + + test_string a_string("a string"); + test_string another_string("another string"); + + const char* char_s = a_string.const_sz(); + char my_string[] = "another_string"; const char my_const_string[] = "another string"; - const unsigned my_string_length = 14; - char* char_s2 = "a string"; + const unsigned my_string_length = 14; + char* char_s2 = a_string.mutable_sz(); BOOST_STATIC_ASSERT(( is_same< range_value::type, detail::iterator_traits::value_type>::value )); @@ -181,10 +214,14 @@ void check_string() check_char(); #ifndef BOOST_NO_STD_WSTRING - typedef wchar_t* wchar_iterator_t; - const wchar_t* char_ws = L"a wide string"; + typedef wchar_t* wchar_iterator_t; + + test_string a_wide_string(L"a wide string"); + test_string another_wide_string(L"another wide string"); + + const wchar_t* char_ws = a_wide_string.const_sz(); wchar_t my_wstring[] = L"another wide string"; - wchar_t* char_ws2 = L"a wide string"; + wchar_t* char_ws2 = a_wide_string.mutable_sz(); BOOST_STATIC_ASSERT(( is_same< range_value::type, detail::iterator_traits::value_type>::value )); @@ -203,12 +240,17 @@ void check_string() BOOST_CHECK_EQUAL( sz, std::char_traits::length( char_ws ) ); 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) ); + BOOST_CHECK( find( char_ws2, to_search ) != str_end(char_ws2) ); #if BOOST_WORKAROUND(_MSC_VER, BOOST_TESTED_AT(1300)) BOOST_CHECK( find( my_wstring, to_search ) != str_end(my_wstring) ); +#else + + boost::ignore_unused_variable_warning( my_wstring ); + #endif #endif diff --git a/test/test_function/true_predicate.hpp b/test/test_function/true_predicate.hpp new file mode 100644 index 0000000..87a0dca --- /dev/null +++ b/test/test_function/true_predicate.hpp @@ -0,0 +1,29 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#ifndef BOOST_RANGE_TEST_TEST_FUNCTION_TRUE_PREDICATE_HPP_INCLUDED +#define BOOST_RANGE_TEST_TEST_FUNCTION_TRUE_PREDICATE_HPP_INCLUDED + +namespace boost +{ + namespace range_test_function + { + struct true_predicate + { + typedef bool result_type; + + bool operator()() const { return true; } + template bool operator()(Arg) const { return true; } + template bool operator()(Arg1,Arg2) const { return true; } + }; + } +} + +#endif // include guard From fb8994f51c00146117979a8432bc309bf8af1253 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 19 Jul 2010 23:29:09 +0000 Subject: [PATCH 40/73] Merge documentation changes. [SVN r64186] --- .../adaptors_general_requirements.html | 141 ------ .../adaptors/adaptors_introduction.html | 274 ------------ .../reference/adaptors/adaptors_synopsis.html | 67 --- doc/html/range/reference/algorithms/non.html | 64 --- .../concept_implementation/overview.html | 68 --- doc/html/range/reference/range_algorithm.html | 52 --- .../range/reference/ranges/introduction.html | 46 -- .../range/reference/ranges/reference.html | 50 --- .../ranges/reference/counting_range.html | 91 ---- .../reference/ranges/reference/irange.html | 104 ----- .../ranges/reference/istream_range.html | 73 ---- .../range/reference/semantics/functions.html | 408 ------------------ .../reference/semantics/metafunctions.html | 236 ---------- doc/html/range/reference/synopsis.html | 185 -------- .../range/upgrade/upgrade_1_34_to_1_35.html | 77 ---- doc/html/range/utilities/iterator_range.html | 322 -------------- doc/html/range/utilities/join.html | 89 ---- doc/html/range/utilities/sub_range.html | 122 ------ 18 files changed, 2469 deletions(-) delete mode 100644 doc/html/range/reference/adaptors/adaptors_general_requirements.html delete mode 100644 doc/html/range/reference/adaptors/adaptors_introduction.html delete mode 100644 doc/html/range/reference/adaptors/adaptors_synopsis.html delete mode 100644 doc/html/range/reference/algorithms/non.html delete mode 100644 doc/html/range/reference/concept_implementation/overview.html delete mode 100644 doc/html/range/reference/range_algorithm.html delete mode 100644 doc/html/range/reference/ranges/introduction.html delete mode 100644 doc/html/range/reference/ranges/reference.html delete mode 100644 doc/html/range/reference/ranges/reference/counting_range.html delete mode 100644 doc/html/range/reference/ranges/reference/irange.html delete mode 100644 doc/html/range/reference/ranges/reference/istream_range.html delete mode 100644 doc/html/range/reference/semantics/functions.html delete mode 100644 doc/html/range/reference/semantics/metafunctions.html delete mode 100644 doc/html/range/reference/synopsis.html delete mode 100644 doc/html/range/upgrade/upgrade_1_34_to_1_35.html delete mode 100644 doc/html/range/utilities/iterator_range.html delete mode 100644 doc/html/range/utilities/join.html delete mode 100644 doc/html/range/utilities/sub_range.html diff --git a/doc/html/range/reference/adaptors/adaptors_general_requirements.html b/doc/html/range/reference/adaptors/adaptors_general_requirements.html deleted file mode 100644 index a815bae..0000000 --- a/doc/html/range/reference/adaptors/adaptors_general_requirements.html +++ /dev/null @@ -1,141 +0,0 @@ - - - -General Requirements - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - In the description of generator expressions, the following notation is - used: -

    -
      -
    • -fwdRng is an expression - of a type R that models - ForwardRange -
    • -
    • -biRng is an expression - of a type R that models - BidirectionalRange -
    • -
    • -rndRng is an expression - of a type R that models - RandomAccessRange -
    • -
    • -pred is an expression - of a type that models UnaryPredicate -
    • -
    • -bi_pred is an expression - of a type that models BinaryPredicate -
    • -
    • -fun is an expression - of a type that models UnaryFunction -
    • -
    • -value, new_value and old_value - are objects convertible to boost::range_value<R>::type -
    • -
    • -n,m are integer expressions convertible - to range_difference<R>::type -
    • -
    -

    - Also note that boost::range_value<R>::type must be implicitly convertible to - the type arguments to pred, - bi_pred and fun. -

    -

    - Range Category in the following adaptor descriptions refers to the minimum - range concept required by the range passed to the adaptor. The resultant - range is a model of the same range concept as the input range unless specified - otherwise. -

    -

    - Returned Range Category is the concept of the returned range. In some cases - the returned range is of a lesser category than the range passed to the - adaptor. For example, the filtered - adaptor returns only a ForwardRange - regardless of the input. -

    -

    - Furthermore, the following rules apply to any expression of the form -

    -
    rng | boost::adaptors::adaptor_generator
    -
    -

    -

    -

    - 1. Applying operator|() - to a range R (always left - argument) and a range adapter RA - (always right argument) yields a new range type which may not conform to - the same range concept as R. -

    -

    - 2. The return-type of operator|() is otherwise unspecified. -

    -

    - 3. operator|() - is found by Argument Dependent Lookup (ADL) because a range adaptor is - implemented in namespace boost::adaptors. -

    -

    - 4. operator|() - is used to add new behaviour lazily - and never modifies its left argument. -

    -

    - 5. All iterators extracted from the left argument are extracted using qualified - calls to boost::begin() - and boost::end(). -

    -

    - 6. In addition to the throw-clauses - below, operator|() - may throw exceptions as a result of copying iterators. If such copying - cannot throw an exception, then neither can the whole expression. -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/adaptors/adaptors_introduction.html b/doc/html/range/reference/adaptors/adaptors_introduction.html deleted file mode 100644 index 80d2e25..0000000 --- a/doc/html/range/reference/adaptors/adaptors_introduction.html +++ /dev/null @@ -1,274 +0,0 @@ - - - -Introduction and motivation - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - A Range Adaptor is a class that wraps - an existing Range to provide a new Range with different behaviour. Since - the behaviour of Ranges is determined by their associated iterators, a - Range Adaptor simply wraps the underlying iterators with new special iterators. - In this example -

    -

    - -

    -
    #include <boost/range/adaptors.hpp>
    -#include <boost/range/algorithm.hpp>
    -#include <iostream>
    -#include <vector>
    -
    -std::vector<int> vec;
    -boost::copy( vec | boost::adaptors::reversed,
    -             std::ostream_iterator<int>(std::cout) );
    -
    -

    -

    -

    - the iterators from vec - are wrapped reverse_iterators. - The type of the underlying Range Adapter is not documented because you - do not need to know it. All that is relevant is that the expression -

    -

    - -

    -
    vec | boost::adaptors::reversed
    -
    -

    -

    -

    - returns a Range Adaptor where the iterator type is now the iterator type - of the range vec wrapped - in reverse_iterator. The - expression boost::adaptors::reversed is called an Adaptor - Generator. -

    -

    - There are two ways of constructing a range adaptor. The first is by using - operator|(). - This is my preferred technique, however while discussing range adaptors - with others it became clear that some users of the library strongly prefer - a more familiar function syntax, so equivalent functions of the present - tense form have been added as an alternative syntax. The equivalent to - rng | - reversed is adaptors::reverse(rng) for example. -

    -

    - Why do I prefer the operator| syntax? The answer is readability: -

    -

    - -

    -
    std::vector<int> vec;
    -boost::copy( boost::adaptors::reverse(vec),
    -             std::ostream_iterator<int>(std::cout) );
    -
    -

    -

    -

    - This might not look so bad, but when we apply several adaptors, it becomes - much worse. Just compare -

    -

    - -

    -
    std::vector<int> vec;
    -boost::copy( boost::adaptors::unique( boost::adaptors::reverse( vec ) ),
    -             std::ostream_iterator<int>(std::cout) );
    -
    -

    -

    -

    - to -

    -

    - -

    -
    std::vector<int> vec;
    -boost::copy( vec | boost::adaptors::reversed
    -                 | boost::adaptors::uniqued,
    -             std::ostream_iterator<int>(std::cout) );
    -
    -

    -

    -

    - Furthermore, some of the adaptor generators take arguments themselves and - these arguments are expressed with function call notation too. In those - situations, you will really appreciate the succinctness of operator|(). -

    -
    - - Composition - of Adaptors -
    -

    - Range Adaptors are a powerful complement to Range algorithms. The reason - is that adaptors are orthogonal - to algorithms. For example, consider these Range algorithms: -

    -
      -
    • boost::copy( rng, out )
    • -
    • boost::count( rng, pred )
    • -
    -

    - What should we do if we only want to copy an element a - if it satisfies some predicate, say pred(a)? - And what if we only want to count the elements that satisfy the same predicate? - The naive answer would be to use these algorithms: -

    -
      -
    • boost::copy_if( - rng, - pred, - out )
    • -
    • boost::count_if( - rng, - pred )
    • -
    -

    - These algorithms are only defined to maintain a one to one relationship - with the standard library algorithms. This approach of adding algorithm - suffers a combinatorial explosion. Inevitably many algorithms are missing - _if variants and there - is redundant development overhead for each new algorithm. The Adaptor Generator - is the design solution to this problem. -

    -
    - - Range - Adaptor alternative to copy_if algorithm -
    -

    - -

    -
    boost::copy_if( rng, pred, out );
    -
    -

    - can be expressed as -

    -
    boost::copy( rng | boost::adaptors::filtered(pred), out );
    -
    -

    -

    -
    - - Range - Adaptor alternative to count_if algorithm -
    -

    - -

    -
    boost::count_if( rng, pred );
    -
    -

    - can be expressed as -

    -
    boost::count( rng | boost::adaptors::filtered(pred), out );
    -
    -

    -

    -

    - What this means is that no - algorithm with the _if - suffix is needed. Furthermore, it turns out that algorithms with the _copy suffix are not needed either. Consider - the somewhat misdesigned replace_copy_if() which may be used as -

    -

    - -

    -
    std::vector<int> vec;
    -boost::replace_copy_if( rng, std::back_inserter(vec), pred );
    -
    -

    -

    -

    - With adaptors and algorithms we can express this as -

    -

    - -

    -
    std::vector<int> vec;
    -boost::push_back(vec, rng | boost::adaptors::replaced_if(pred, new_value));
    -
    -

    -

    -

    - The latter code has several benefits: -

    -

    - 1. it is more efficient - because we avoid extra allocations as might happen with std::back_inserter -

    -

    - 2. it is flexible - as we can subsequently apply even more adaptors, for example: -

    -
    boost::push_back(vec, rng | boost::adaptors::replaced_if(pred, new_value)
    -                          | boost::adaptors::reversed);
    -
    -

    -

    -

    - 3. it is safer because - there is no use of an unbounded output iterator. -

    -

    - In this manner, the composition - of Range Adaptors has the following consequences: -

    -

    - 1. we no longer need _if, - _copy, _copy_if - and _n variants of algorithms. -

    -

    - 2. we can generate a multitude of new algorithms on the fly, for example, - above we generated reverse_replace_copy_if() -

    -

    - In other words: -

    -

    - Range Adaptors are to algorithms what algorithms - are to containers -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/adaptors/adaptors_synopsis.html b/doc/html/range/reference/adaptors/adaptors_synopsis.html deleted file mode 100644 index c18bb4f..0000000 --- a/doc/html/range/reference/adaptors/adaptors_synopsis.html +++ /dev/null @@ -1,67 +0,0 @@ - - - -Synopsis - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - The library provides the following Adapter Generator expressions: -

    -

    - -

    -
    rng | boost::adaptors::adjacent_filtered(bi_pred)
    -rng | boost::adaptors::copied(n,m)
    -rng | boost::adaptors::filtered(pred)
    -rng | boost::adaptors::indexed
    -rng | boost::adaptors::indirected
    -rng | boost::adaptors::map_keys
    -rng | boost::adaptors::map_values
    -rng | boost::adaptors::replaced(new_value, old_value)
    -rng | boost::adaptors::replaced_if(pred, new_value)
    -rng | boost::adaptors::reversed
    -rng | boost::adaptors::sliced(n, m)
    -rng | boost::adaptors::strided(n)
    -rng | boost::adaptors::tokenized( <see arguments below> )
    -rng | boost::adaptors::transformed(fun)
    -rng | boost::adaptors::uniqued
    -
    -

    -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/algorithms/non.html b/doc/html/range/reference/algorithms/non.html deleted file mode 100644 index f1f9123..0000000 --- a/doc/html/range/reference/algorithms/non.html +++ /dev/null @@ -1,64 +0,0 @@ - - - --mutating Non-mutating algorithms - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    - - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/concept_implementation/overview.html b/doc/html/range/reference/concept_implementation/overview.html deleted file mode 100644 index d0c35e1..0000000 --- a/doc/html/range/reference/concept_implementation/overview.html +++ /dev/null @@ -1,68 +0,0 @@ - - - -Overview - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - Three types of objects are currently supported by the library: -

    -
      -
    • - standard-like containers -
    • -
    • std::pair<iterator,iterator>
    • -
    • - built-in arrays -
    • -
    -

    - Even though the behavior of the primary templates are exactly such that - standard containers will be supported by default, the requirements are - much lower than the standard container requirements. For example, the utility - class iterator_range implements the - minimal interface required - to make the class a Forward - Range. -

    -

    - Please also see Range concepts for - more details. -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/range_algorithm.html b/doc/html/range/reference/range_algorithm.html deleted file mode 100644 index 1e197c9..0000000 --- a/doc/html/range/reference/range_algorithm.html +++ /dev/null @@ -1,52 +0,0 @@ - - - -Range Algorithm - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    - - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/ranges/introduction.html b/doc/html/range/reference/ranges/introduction.html deleted file mode 100644 index f0080c6..0000000 --- a/doc/html/range/reference/ranges/introduction.html +++ /dev/null @@ -1,46 +0,0 @@ - - - -Introduction - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - The Boost.Range library provides some of the more commonly required ranges. -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/ranges/reference.html b/doc/html/range/reference/ranges/reference.html deleted file mode 100644 index edaf8fa..0000000 --- a/doc/html/range/reference/ranges/reference.html +++ /dev/null @@ -1,50 +0,0 @@ - - - -Reference - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    - - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/ranges/reference/counting_range.html b/doc/html/range/reference/ranges/reference/counting_range.html deleted file mode 100644 index 68fa72c..0000000 --- a/doc/html/range/reference/ranges/reference/counting_range.html +++ /dev/null @@ -1,91 +0,0 @@ - - - -counting_range - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -
    - - Prototype -
    -

    - -

    -
    template< class Incrementable > inline
    -iterator_range< counting_iterator<Incrementable> >
    -counting_range(Incrementable first, Incrementable last);
    -
    -template< class SinglePassRange > inline
    -iterator_range< counting_iterator<typename range_iterator<SinglePassRange>::type >
    -counting_range(const SinglePassRange& rng);
    -
    -template< class SinglePassRange > inline
    -iterator_range< counting_iterator<typename range_iterator<SinglePassRange>::type >
    -counting_range(SinglePassRange& rng);
    -
    -

    -

    -
    - - Description -
    -

    - counting_range is a function - to generator that generates an iterator_range - wrapping a counting_iterator - (from Boost.Iterator). -

    -
    - - Definition -
    -

    - Defined in header file boost/range/counting_range.hpp -

    -
    - - Requirements -
    -
    1. -Incrementable is a - model of the Incrementable - Concept. -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/ranges/reference/irange.html b/doc/html/range/reference/ranges/reference/irange.html deleted file mode 100644 index d827097..0000000 --- a/doc/html/range/reference/ranges/reference/irange.html +++ /dev/null @@ -1,104 +0,0 @@ - - - -irange - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -
    - - Prototype -
    -

    - -

    -
    template<class Integer>
    -integer_range< range_detail::integer_iterator<Integer> >
    -irange(Integer first, Integer  last);
    -
    -template<class Integer, class StepSize>
    -integer_range< range_detail::integer_iterator_with_step<Integer, StepSize> >
    -irange(Integer first, Integer last, StepSize step_size);
    -
    -

    -

    -
    - - Description -
    -

    - irange is a function - to generate an Integer Range. -

    -

    - irange allows treating - integers as a model of the Random - Access Range Concept. It should be noted that the first and last - parameters denoted a half-open range. -

    -
    - - Definition -
    -

    - Defined in the header file boost/range/irange.hpp -

    -
    - - Requirements -
    -
      -
    1. -Integer is a model - of the Integer Concept. -
    2. -
    3. -StepSize is a model - of the SignedInteger - Concept. -
    4. -
    -
    - - Complexity -
    -

    - Constant. Since this function generates a new range the most significant - performance cost is incurred through the iteration of the generated range. -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/ranges/reference/istream_range.html b/doc/html/range/reference/ranges/reference/istream_range.html deleted file mode 100644 index 7552ec7..0000000 --- a/doc/html/range/reference/ranges/reference/istream_range.html +++ /dev/null @@ -1,73 +0,0 @@ - - - -istream_range - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -
    - - Prototype -
    -

    - -

    -
    template< class Type, class Elem, class Traits > inline
    -iterator_range< std::istream_iterator<Type, Elem, Traits> >
    -istream_range(std::basic_istream<Elem, Traits>& in);
    -
    -

    -

    -
    - - Description -
    -

    - istream_range is a function - to generator that generates an iterator_range - wrapping a std::istream_iterator. -

    -
    - - Definition -
    -

    - Defined in header file boost/range/istream_range.hpp -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/semantics/functions.html b/doc/html/range/reference/semantics/functions.html deleted file mode 100644 index 232b680..0000000 --- a/doc/html/range/reference/semantics/functions.html +++ /dev/null @@ -1,408 +0,0 @@ - - - -Functions - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Expression -

    -
    -

    - Return type -

    -
    -

    - Returns -

    -
    -

    - Complexity -

    -
    -

    - begin(x) -

    -
    -

    - range_iterator<X>::type -

    -
    -

    - p.first if p - is of type std::pair<T> a - if a is an array - range_begin(x) - if that expression would invoke a function found by ADL t.begin() - otherwise -

    -
    -

    - constant time -

    -
    -

    - end(x) -

    -
    -

    - range_iterator<X>::type -

    -
    -

    - p.second if p - is of type std::pair<T> a - + sz - if a is an array - of size sz range_end(x) - if that expression would invoke a function found by ADL t.end() - otherwise -

    -
    -

    - constant time -

    -
    -

    - empty(x) -

    -
    -

    - bool -

    -
    -

    - boost::begin(x) - == boost::end(x) -

    -
    -

    - constant time -

    -
    -

    - distance(x) -

    -
    -

    - range_difference<X>::type -

    -
    -

    - std::distance(boost::begin(x),boost::end(x)) -

    -
    -

    - - -

    -
    -

    - size(x) -

    -
    -

    - range_difference<X>::type -

    -
    -

    - boost::end(x) - - boost::begin(x) -

    -
    -

    - constant time -

    -
    -

    - rbegin(x) -

    -
    -

    - range_reverse_iterator<X>::type -

    -
    -

    - range_reverse_iterator<X>::type(boost::end(x)) -

    -
    -

    - constant time -

    -
    -

    - rend(x) -

    -
    -

    - range_reverse_iterator<X>::type -

    -
    -

    - range_reverse_iterator<X>::type(boost::begin(x)) -

    -
    -

    - constant time -

    -
    -

    - const_begin(x) -

    -
    -

    - range_iterator<const - X>::type -

    -
    -

    - range_iterator<const - X>::type(boost::begin(x)) -

    -
    -

    - constant time -

    -
    -

    - const_end(x) -

    -
    -

    - range_iterator<const - X>::type -

    -
    -

    - range_iterator<const - X>::type(boost::end(x)) -

    -
    -

    - constant time -

    -
    -

    - const_rbegin(x) -

    -
    -

    - range_reverse_iterator<const - X>::type -

    -
    -

    - range_reverse_iterator<const - X>::type(boost::rbegin(x)) -

    -
    -

    - constant time -

    -
    -

    - const_rend(x) -

    -
    -

    - range_reverse_iterator<const - X>::type -

    -
    -

    - range_reverse_iterator<const - X>::type(boost::rend(x)) -

    -
    -

    - constant time -

    -
    -

    - as_literal(x) -

    -
    -

    - iterator_range<U> where U - is Char* - if x is a pointer - to a string and U - is range_iterator<X>::type - otherwise -

    -
    -

    - [s,s - + std::char_traits<X>::length(s)) if s - is a Char* - or an array of Char - [boost::begin(x),boost::end(x)) otherwise -

    -
    -

    - linear time for pointers to a string or arrays of Char, constant time otherwise -

    -
    -

    - as_array(x) -

    -
    -

    - iterator_range<X> -

    -
    -

    - [boost::begin(x),boost::end(x)) -

    -
     
    -

    - The special const_-named - functions are useful when you want to document clearly that your code is - read-only. -

    -

    - as_literal() - can be used internally - in string algorithm libraries such that arrays of characters are handled - correctly. -

    -

    - as_array() - can be used with string algorithm libraries to make it clear that arrays - of characters are handled like an array and not like a string. -

    -

    - Notice that the above functions should always be called with qualification - (boost::) - to prevent unintended - Argument Dependent Lookup (ADL). -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/semantics/metafunctions.html b/doc/html/range/reference/semantics/metafunctions.html deleted file mode 100644 index 6df4902..0000000 --- a/doc/html/range/reference/semantics/metafunctions.html +++ /dev/null @@ -1,236 +0,0 @@ - - - -Metafunctions - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -
    ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    - Expression -

    -
    -

    - Return type -

    -
    -

    - Complexity -

    -
    -

    - range_iterator<X>::type -

    -
    -

    - -

    -
    T::iterator
    -P::first_type
    -A*
    -
    -

    -

    -
    -

    - compile time -

    -
    -

    - range_iterator<const - X>::type -

    -
    -

    - -

    -
    T::const_iterator
    -P::first_type
    -const A*
    -
    -

    -

    -
    -

    - compile time -

    -
    -

    - range_value<X>::type -

    -
    -

    - boost::iterator_value<range_iterator<X>::type>::type -

    -
    -

    - compile time -

    -
    -

    - range_reference<X>::type -

    -
    -

    - boost::iterator_reference<range_iterator<X>::type>::type -

    -
    -

    - compile time -

    -
    -

    - range_pointer<X>::type -

    -
    -

    - boost::iterator_pointer<range_iterator<X>::type>::type -

    -
    -

    - compile time -

    -
    -

    - range_category<X>::type -

    -
    -

    - boost::iterator_category<range_iterator<X>::type>::type -

    -
    -

    - compile time -

    -
    -

    - range_difference<X>::type -

    -
    -

    - boost::iterator_category<range_iterator<X>::type>::type -

    -
    -

    - compile time -

    -
    -

    - range_reverse_iterator<X>::type -

    -
    -

    - boost::reverse_iterator<range_iterator<X>::type> -

    -
    -

    - compile time -

    -
    -

    - range_reverse_iterator<const - X>::type -

    -
    -

    - boost::reverse_iterator<range_iterator<const X>::type -

    -
    -

    - compile time -

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/reference/synopsis.html b/doc/html/range/reference/synopsis.html deleted file mode 100644 index 248e8c1..0000000 --- a/doc/html/range/reference/synopsis.html +++ /dev/null @@ -1,185 +0,0 @@ - - - -Synopsis - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - -

    -
    namespace boost
    -{
    -    //
    -    // Single Pass Range metafunctions
    -    //
    -
    -    template< class T >
    -    struct range_iterator;
    -
    -    template< class T >
    -    struct range_value;
    -
    -    template< class T >
    -    struct range_reference;
    -    
    -    template< class T >
    -    struct range_pointer;
    -    
    -    template< class T >
    -    struct range_category;
    -
    -    //
    -    // Forward Range metafunctions
    -    //
    -
    -    template< class T >
    -    struct range_difference;
    -
    -    //
    -    // Bidirectional Range metafunctions
    -    //
    -
    -    template< class T >
    -    struct range_reverse_iterator;
    -
    -    //
    -    // Single Pass Range functions
    -    //
    -
    -    template< class T >
    -    typename range_iterator<T>::type
    -    begin( T& r );
    -
    -    template< class T >
    -    typename range_iterator<const T>::type
    -    begin( const T& r );
    -
    -    template< class T >
    -    typename range_iterator<T>::type
    -    end( T& r );
    -
    -    template< class T >
    -    typename range_iterator<const T>::type
    -    end( const T& r );
    -
    -    template< class T >
    -    bool
    -    empty( const T& r );
    -
    -    //
    -    // Forward Range functions
    -    //
    -
    -    template< class T >
    -    typename range_difference<T>::type
    -    distance( const T& r );
    -
    -    //
    -    // Bidirectional Range functions
    -    //
    -
    -    template< class T >
    -    typename range_reverse_iterator<T>::type
    -    rbegin( T& r );
    -
    -    template< class T >
    -    typename range_reverse_iterator<const T>::type
    -    rbegin( const T& r );
    -
    -    template< class T >
    -    typename range_reverse_iterator<T>::type
    -    rend( T& r );
    -
    -    template< class T >
    -    typename range_reverse_iterator<const T>::type
    -    rend( const T& r );
    -    
    -    //
    -    // Random Access Range functions
    -    //
    -    
    -    template< class T >
    -    typename range_difference<T>::type
    -    size( const T& r );
    -
    -    //
    -    // Special const Range functions
    -    //
    -
    -    template< class T >
    -    typename range_iterator<const T>::type 
    -    const_begin( const T& r );
    -
    -    template< class T >
    -    typename range_iterator<const T>::type 
    -    const_end( const T& r );
    -
    -    template< class T >
    -    typename range_reverse_iterator<const T>::type 
    -    const_rbegin( const T& r );
    -
    -    template< class T >
    -    typename range_reverse_iterator<const T>::type 
    -    const_rend( const T& r );
    -    
    -    //
    -    // String utilities
    -    //
    -    
    -    template< class T >
    -    iterator_range< ... see below ... >
    -    as_literal( T& r );
    -    
    -    template< class T >
    -    iterator_range< ... see below ... >
    -    as_literal( const T& r );
    -    
    -    template< class T >
    -    iterator_range< typename range_iterator<T>::type >
    -    as_array( T& r );
    -    
    -    template< class T >
    -    iterator_range< typename range_iterator<const T>::type >
    -    as_array( const T& r );
    -
    -} // namespace 'boost' 
    -
    -

    -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/upgrade/upgrade_1_34_to_1_35.html b/doc/html/range/upgrade/upgrade_1_34_to_1_35.html deleted file mode 100644 index 252ec93..0000000 --- a/doc/html/range/upgrade/upgrade_1_34_to_1_35.html +++ /dev/null @@ -1,77 +0,0 @@ - - - -Upgrade from version 1.34 - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - Boost version 1.35 introduced some larger refactorings of the library: -

    -
      -
    1. - Direct support for character arrays was abandoned in favor of uniform treatment - of all arrays. Instead string algorithms can use the new function as_literal(). -
    2. -
    3. -size - now requires a Random - Access Range. The old behavior is provided as distance(). -
    4. -
    5. -range_size<T>::type has been completely removed in favor - of range_difference<T>::type -
    6. -
    7. -boost_range_begin() - and boost_range_end() - have been renamed range_begin() and range_end() respectively. -
    8. -
    9. -range_result_iterator<T>::type and range_reverse_result_iterator<T>::type - have been renamed range_iterator<T>::type - and range_reverse_iterator<T>::type. -
    10. -
    11. - The procedure that makes a custom type work with the library has been greatly - simplified. See Extending the - library for UDTs for details. -
    12. -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/utilities/iterator_range.html b/doc/html/range/utilities/iterator_range.html deleted file mode 100644 index 6f536e7..0000000 --- a/doc/html/range/utilities/iterator_range.html +++ /dev/null @@ -1,322 +0,0 @@ - - - -Class iterator_range - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - The intention of the iterator_range - class is to encapsulate two iterators so they fulfill the Forward - Range concept. A few other functions are also provided for convenience. -

    -

    - If the template argument is not a model of Forward - Traversal Iterator, one can still use a subset of the interface. - In particular, size() - requires Random Access Traversal Iterators whereas empty() only requires Single Pass Iterators. -

    -

    - Recall that many default constructed iterators are singular - and hence can only be assigned, but not compared or incremented or anything. - However, if one creates a default constructed iterator_range, - then one can still call all its member functions. This design decision avoids - the iterator_range imposing - limitations upon ranges of iterators that are not singular. Any singularity - limitation is simply propogated from the underlying iterator type. -

    -
    - - Synopsis -
    -

    - -

    -
    namespace boost
    -{
    -    template< class ForwardTraversalIterator >
    -    class iterator_range
    -    {
    -    public: // Forward Range types
    -        typedef ForwardTraversalIterator   iterator;
    -        typedef ForwardTraversalIterator   const_iterator;
    -        typedef iterator_difference<iterator>::type difference_type;
    -
    -    public: // construction, assignment
    -        template< class ForwardTraversalIterator2 >
    -        iterator_range( ForwardTraversalIterator2 Begin, ForwardTraversalIterator2 End );
    -                    
    -        template< class ForwardRange >
    -        iterator_range( ForwardRange& r );
    -  
    -        template< class ForwardRange >
    -        iterator_range( const ForwardRange& r );
    -        
    -        template< class ForwardRange >
    -        iterator_range& operator=( ForwardRange& r );
    -
    -        template< class ForwardRange >
    -        iterator_range& operator=( const ForwardRange& r );
    -    
    -    public: // Forward Range functions
    -        iterator  begin() const;
    -        iterator  end() const;
    -        
    -    public: // convenience
    -        operator    unspecified_bool_type() const;
    -        bool        equal( const iterator_range& ) const;
    -        value_type& front() const;
    -        value_type& back() const;
    -        iterator_range& advance_begin(difference_type n);
    -        iterator_range& advance_end(difference_type n);
    -        bool      empty() const;
    -        // for Random Access Range only: 
    -        reference operator[]( difference_type at ) const;
    -        value_type operator()( difference_type at ) const;
    -        size_type size() const;
    -    };
    -    
    -    // stream output
    -    template< class ForwardTraversalIterator, class T, class Traits >
    -    std::basic_ostream<T,Traits>& 
    -    operator<<( std::basic_ostream<T,Traits>& Os,
    -                const iterator_range<ForwardTraversalIterator>& r );
    -
    -    // comparison
    -    template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
    -    bool operator==( const iterator_range<ForwardTraversalIterator>& l, 
    -                     const iterator_range<ForwardTraversalIterator2>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator==( const iterator_range<ForwardTraversalIterator>& l, 
    -                     const ForwardRange& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator==( const ForwardRange& l,
    -                     const iterator_range<ForwardTraversalIterator>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
    -    bool operator!=( const iterator_range<ForwardTraversalIterator>& l, 
    -                     const iterator_range<ForwardTraversalIterator2>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator!=( const iterator_range<ForwardTraversalIterator>& l, 
    -                     const ForwardRange& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator!=( const ForwardRange& l,
    -                     const iterator_range<ForwardTraversalIterator>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardTraversalIterator2 >
    -    bool operator<( const iterator_range<ForwardTraversalIterator>& l, 
    -                    const iterator_range<ForwardTraversalIterator2>& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator<( const iterator_range<ForwardTraversalIterator>& l, 
    -                    const ForwardRange& r );
    -
    -    template< class ForwardTraversalIterator, class ForwardRange >
    -    bool operator<( const ForwardRange& l,
    -                    const iterator_range<ForwardTraversalIterator>& r );
    - 
    -    // external construction
    -    template< class ForwardTraversalIterator >
    -    iterator_range< ForwardTraversalIterator >
    -    make_iterator_range( ForwardTraversalIterator Begin, 
    -                         ForwardTraversalIterator End );
    -       
    -    template< class ForwardRange >
    -    iterator_range< typename range_iterator<ForwardRange>::type >
    -    make_iterator_range( ForwardRange& r );
    -
    -    template< class ForwardRange >
    -    iterator_range< typename range_iterator<const ForwardRange>::type >
    -    make_iterator_range( const ForwardRange& r );
    -    
    -    template< class Range >
    -    iterator_range< typename range_iterator<Range>::type >
    -    make_iterator_range( Range& r,
    -                         typename range_difference<Range>::type advance_begin,
    -                         typename range_difference<Range>::type advance_end );
    -    
    -    template< class Range >
    -    iterator_range< typename range_iterator<const Range>::type >
    -    make_iterator_range( const Range& r, 
    -                         typename range_difference<const Range>::type advance_begin,
    -                         typename range_difference<const Range>::type advance_end );
    -    
    -    // convenience
    -    template< class Sequence, class ForwardRange >
    -    Sequence copy_range( const ForwardRange& r );
    -    
    -} // namespace 'boost'
    -
    -

    -

    -

    - If an instance of iterator_range - is constructed by a client with two iterators, the client must ensure that - the two iterators delimit a valid closed-open range [begin,end). -

    -

    - It is worth noticing that the templated constructors and assignment operators - allow conversion from iterator_range<iterator> to iterator_range<const_iterator>. Similarly, since the comparison operators - have two template arguments, we can compare ranges whenever the iterators - are comparable; for example when we are dealing with const and non-const - iterators from the same container. -

    -
    - - Details - member functions -
    -

    - operator unspecified_bool_type() const; -

    -
    -

    -

    -

    - Returns !empty(); -

    -

    -

    -
    -

    - bool equal( iterator_range& r ) const; -

    -
    -

    -

    -

    - Returns begin() == r.begin() && - end() - == r.end(); -

    -

    -

    -
    -
    - - Details - functions -
    -

    - bool operator==( const ForwardRange1& - l, const ForwardRange2& r ); -

    -
    -

    -

    -

    - Returns size(l) != size(r) ? false - : std::equal( begin(l), end(l), begin(r) ); -

    -

    -

    -
    -

    - bool operator!=( const ForwardRange1& - l, const ForwardRange2& r ); -

    -
    -

    -

    -

    - Returns !( l == r ); -

    -

    -

    -
    -

    - bool operator<( const ForwardRange1& - l, const ForwardRange2& r ); -

    -
    -

    -

    -

    - Returns std::lexicographical_compare( - begin(l), end(l), begin(r), end(r) ); -

    -

    -

    -
    -

    - -

    -
    iterator_range make_iterator_range( Range& r,
    -                                    typename range_difference<Range>::type advance_begin, 
    -                                    typename range_difference<Range>::type advance_end );
    -
    -

    -

    -
    -

    -

    -

    - Effects: -

    -

    -

    -
    -

    - -

    -
    iterator new_begin = begin( r ),
    -iterator new_end   = end( r );
    -std::advance( new_begin, advance_begin );
    -std::advance( new_end, advance_end );
    -return make_iterator_range( new_begin, new_end );
    -
    -

    -

    -

    - Sequence copy_range( const ForwardRange& r ); -

    -
    -

    -

    -

    - Returns Sequence( - begin(r), end(r) ); -

    -

    -

    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/utilities/join.html b/doc/html/range/utilities/join.html deleted file mode 100644 index fa140e5..0000000 --- a/doc/html/range/utilities/join.html +++ /dev/null @@ -1,89 +0,0 @@ - - - -Function join - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - The intention of the join - function is to join two ranges into one longer range. -

    -

    - The resultant range will have the lowest common traversal of the two ranges - supplied as parameters. -

    -

    - Note that the joined range incurs a performance cost due to the need to check - if the end of a range has been reached internally during traversal. -

    -
    - - Synposis -
    -

    - -

    -
    template<typename SinglePassRange1, typename SinglePassRange2>
    -iterator_range<range_detail::join_iterator<
    -    typename range_iterator<const SinglePassRange1>::type,
    -    typename range_iterator<const SinglePassRange2>::type,
    -    typename add_const<
    -        typename range_value<const SinglePassRange1>::type>::type>
    ->
    -join(const SinglePassRange1& rng1, const SinglePassRange2& rng2)
    -
    -template<typename SinglePassRange1, typename SinglePassRange2>
    -iterator_range<range_detail::join_iterator<
    -    typename range_iterator<SinglePassRange1>::type,
    -    typename range_iterator<SinglePassRange2>::type,
    -    typename range_value<SinglePassRange1>::type>
    ->
    -join(SinglePassRange1& rng1, SinglePassRange2& rng2);
    -
    -

    -

    -
    - - Example -
    -

    - The expression join(irange(0,5), irange(5,10)) would - evaluate to a range representing an integer range [0,10) -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/doc/html/range/utilities/sub_range.html b/doc/html/range/utilities/sub_range.html deleted file mode 100644 index a9f5d42..0000000 --- a/doc/html/range/utilities/sub_range.html +++ /dev/null @@ -1,122 +0,0 @@ - - - -Class sub_range - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    - -

    - The sub_range class inherits - all its functionality from the iterator_range class. The sub_range class is often easier to use - because one must specify the Forward - Range template argument instead of an iterator. Moreover, the sub_range class can propagate constness - since it knows what a corresponding const_iterator - is. -

    -
    - - Synopsis -
    -

    - -

    -
    namespace boost
    -{
    -    template< class ForwardRange >
    -    class sub_range : public iterator_range< typename range_iterator<ForwardRange>::type >
    -    {
    -    public: 
    -        typedef typename range_iterator<ForwardRange>::type iterator;
    -        typedef typename range_iterator<const ForwardRange>::type  const_iterator;
    -        typedef typename iterator_difference<iterator>::type difference_type;
    -    
    -    public: // construction, assignment
    -        template< class ForwardTraversalIterator >
    -        sub_range( ForwardTraversalIterator Begin, ForwardTraversalIterator End );
    -
    -        template< class ForwardRange2 >
    -        sub_range( ForwardRange2& r );
    -         
    -        template< class ForwardRange2 >
    -        sub_range( const Range2& r );
    -         
    -        template< class ForwardRange2 >
    -        sub_range& operator=( ForwardRange2& r );
    -
    -        template< class ForwardRange2 >
    -        sub_range& operator=( const ForwardRange2& r );    
    -    
    -    public:  // Forward Range functions 
    -        iterator        begin();
    -        const_iterator  begin() const;
    -        iterator        end();
    -        const_iterator  end() const;    
    -        
    -    public: // convenience 
    -        value_type&       front();
    -        const value_type& front() const;
    -        value_type&       back();
    -        const value_type& back() const;
    -        // for Random Access Range only: 
    -        value_type&       operator[]( size_type at );
    -        const value_type& operator[]( size_type at ) const;
    -    
    -    public:
    -        // rest of interface inherited from iterator_range
    -    };
    -    
    -} // namespace 'boost'
    -
    -

    -

    -

    - The class should be trivial to use as seen below. Imagine that we have an - algorithm that searches for a sub-string in a string. The result is an iterator_range, - that delimits the match. We need to store the result from this algorithm. - Here is an example of how we can do it with and without sub_range -

    -

    - -

    -
    std::string str("hello");
    -iterator_range<std::string::iterator> ir = find_first( str, "ll" );
    -sub_range<std::string>               sub = find_first( str, "ll" );
    -
    -

    -

    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - From 65b22bfa38ae51eda1266aa1397b5ef485910f82 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 24 Jul 2010 14:26:01 +0000 Subject: [PATCH 41/73] Merge filesystem, range, doc from trunk. * Inline deprecated methods in filesystem. * Fix some links in range. * Clean up test document a bit. [SVN r64315] --- doc/concepts.qbk | 6 +++--- doc/html/index.html | 4 ++-- .../range/concepts/bidirectional_range.html | 16 ++++++++-------- doc/html/range/concepts/concept_checking.html | 4 ++-- doc/html/range/concepts/forward_range.html | 10 +++++----- doc/html/range/concepts/overview.html | 4 ++-- .../range/concepts/random_access_range.html | 12 ++++++------ .../range/concepts/single_pass_range.html | 16 ++++++++-------- doc/html/range/history_ack.html | 4 ++-- doc/html/range/introduction.html | 6 +++--- doc/html/range/mfc_atl.html | 4 ++-- .../reference/adaptors/introduction.html | 6 +++--- .../reference/algorithms/heap/make_heap.html | 10 +++++----- .../reference/algorithms/heap/pop_heap.html | 12 ++++++------ .../reference/algorithms/heap/push_heap.html | 12 ++++++------ .../reference/algorithms/heap/sort_heap.html | 12 ++++++------ .../reference/algorithms/mutating/copy.html | 12 ++++++------ .../algorithms/mutating/copy_backward.html | 12 ++++++------ .../reference/algorithms/mutating/fill.html | 10 +++++----- .../reference/algorithms/mutating/fill_n.html | 10 +++++----- .../algorithms/mutating/generate.html | 12 ++++++------ .../algorithms/mutating/inplace_merge.html | 16 ++++++++-------- .../reference/algorithms/mutating/merge.html | 16 ++++++++-------- .../algorithms/mutating/nth_element.html | 10 +++++----- .../algorithms/mutating/partial_sort.html | 10 +++++----- .../algorithms/mutating/partition.html | 10 +++++----- .../algorithms/mutating/random_shuffle.html | 12 ++++++------ .../reference/algorithms/mutating/remove.html | 10 +++++----- .../algorithms/mutating/remove_copy.html | 10 +++++----- .../algorithms/mutating/remove_copy_if.html | 10 +++++----- .../algorithms/mutating/remove_if.html | 10 +++++----- .../algorithms/mutating/replace.html | 10 +++++----- .../algorithms/mutating/replace_copy.html | 10 +++++----- .../algorithms/mutating/replace_copy_if.html | 10 +++++----- .../algorithms/mutating/replace_if.html | 10 +++++----- .../algorithms/mutating/reverse.html | 10 +++++----- .../algorithms/mutating/reverse_copy.html | 10 +++++----- .../reference/algorithms/mutating/rotate.html | 12 ++++++------ .../algorithms/mutating/rotate_copy.html | 12 ++++++------ .../reference/algorithms/mutating/sort.html | 10 +++++----- .../algorithms/mutating/stable_partition.html | 10 +++++----- .../algorithms/mutating/stable_sort.html | 10 +++++----- .../algorithms/mutating/swap_ranges.html | 10 +++++----- .../algorithms/mutating/transform.html | 12 ++++++------ .../reference/algorithms/mutating/unique.html | 10 +++++----- .../algorithms/mutating/unique_copy.html | 10 +++++----- .../reference/algorithms/new/copy_n.html | 10 +++++----- .../range/reference/algorithms/new/erase.html | 10 +++++----- .../reference/algorithms/new/for_each.html | 10 +++++----- .../reference/algorithms/new/insert.html | 10 +++++----- .../range/reference/algorithms/new/iota.html | 10 +++++----- .../reference/algorithms/new/is_sorted.html | 10 +++++----- .../reference/algorithms/new/overwrite.html | 10 +++++----- .../reference/algorithms/new/push_back.html | 10 +++++----- .../reference/algorithms/new/push_front.html | 10 +++++----- .../algorithms/new/remove_erase.html | 10 +++++----- .../algorithms/new/remove_erase_if.html | 10 +++++----- .../non_mutating/adjacent_find.html | 10 +++++----- .../non_mutating/binary_search.html | 12 ++++++------ .../algorithms/non_mutating/count.html | 10 +++++----- .../algorithms/non_mutating/count_if.html | 10 +++++----- .../algorithms/non_mutating/equal.html | 10 +++++----- .../algorithms/non_mutating/equal_range.html | 12 ++++++------ .../algorithms/non_mutating/find.html | 10 +++++----- .../algorithms/non_mutating/find_end.html | 10 +++++----- .../non_mutating/find_first_of.html | 10 +++++----- .../algorithms/non_mutating/find_if.html | 12 ++++++------ .../algorithms/non_mutating/for_each.html | 10 +++++----- .../non_mutating/lexicographical_compare.html | 10 +++++----- .../algorithms/non_mutating/lower_bound.html | 12 ++++++------ .../algorithms/non_mutating/max_element.html | 10 +++++----- .../algorithms/non_mutating/min_element.html | 10 +++++----- .../algorithms/non_mutating/mismatch.html | 12 ++++++------ .../algorithms/non_mutating/search.html | 10 +++++----- .../algorithms/non_mutating/search_n.html | 10 +++++----- .../algorithms/non_mutating/upper_bound.html | 12 ++++++------ .../algorithms/numeric/accumulate.html | 14 +++++++------- .../numeric/adjacent_difference.html | 16 ++++++++-------- .../algorithms/numeric/inner_product.html | 16 ++++++++-------- .../algorithms/numeric/partial_sum.html | 16 ++++++++-------- .../permutation/next_permutation.html | 10 +++++----- .../permutation/prev_permutation.html | 10 +++++----- .../reference/algorithms/set/includes.html | 12 ++++++------ .../algorithms/set/set_difference.html | 12 ++++++------ .../algorithms/set/set_intersection.html | 12 ++++++------ .../set/set_symmetric_difference.html | 12 ++++++------ .../reference/algorithms/set/set_union.html | 12 ++++++------ .../concept_implementation/semantics.html | 2 +- .../reference/ranges/counting_range.html | 8 ++++---- doc/html/range/reference/ranges/irange.html | 10 +++++----- .../range/reference/ranges/istream_range.html | 6 +++--- .../reference/utilities/iterator_range.html | 6 +++--- doc/html/range/reference/utilities/join.html | 4 ++-- .../range/reference/utilities/sub_range.html | 2 +- doc/html/standalone_HTML.manifest | 19 ------------------- 95 files changed, 478 insertions(+), 497 deletions(-) delete mode 100644 doc/html/standalone_HTML.manifest diff --git a/doc/concepts.qbk b/doc/concepts.qbk index cc6fd23..773ef9d 100644 --- a/doc/concepts.qbk +++ b/doc/concepts.qbk @@ -11,9 +11,9 @@ The motivation for the Range concept is that there are many useful Container-lik Because of the second requirement, a Range object must be passed by (const or non-const) reference in generic code. -The operations that can be performed on a Range is dependent on the [@../../iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal traversal category] of the underlying iterator type. Therefore the range concepts are named to reflect which traversal category its iterators support. See also terminology and style guidelines. for more information about naming of ranges. +The operations that can be performed on a Range is dependent on the [@boost:/libs/iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal traversal category] of the underlying iterator type. Therefore the range concepts are named to reflect which traversal category its iterators support. See also terminology and style guidelines. for more information about naming of ranges. -The concepts described below specifies associated types as [@../../libs/mpl/doc/refmanual/metafunction.html metafunctions] and all functions as free-standing functions to allow for a layer of indirection. +The concepts described below specifies associated types as [@boost:/libs/mpl/doc/refmanual/metafunction.html metafunctions] and all functions as free-standing functions to allow for a layer of indirection. [endsect] @@ -217,7 +217,7 @@ __bidirectional_range__ [section Concept Checking] -Each of the range concepts has a corresponding concept checking class in the file [@../../boost/range/concepts.hpp ``]. These classes may be used in conjunction with the __concept_check__ to ensure that the type of a template parameter is compatible with a range concept. If not, a meaningful compile time error is generated. Checks are provided for the range concepts related to iterator traversal categories. For example, the following line checks that the type `T` models the __forward_range__ concept. +Each of the range concepts has a corresponding concept checking class in the file [@boost:/boost/range/concepts.hpp ``]. These classes may be used in conjunction with the __concept_check__ to ensure that the type of a template parameter is compatible with a range concept. If not, a meaningful compile time error is generated. Checks are provided for the range concepts related to iterator traversal categories. For example, the following line checks that the type `T` models the __forward_range__ concept. `` BOOST_CONCEPT_ASSERT(( ForwardRangeConcept )); diff --git a/doc/html/index.html b/doc/html/index.html index 90355b6..cf6338e 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -30,7 +30,7 @@
    -

    +

    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)

    @@ -142,7 +142,7 @@

    - +

    Last revised: July 17, 2010 at 19:34:42 GMT

    Last revised: July 22, 2010 at 23:20:42 GMT


    diff --git a/doc/html/range/concepts/bidirectional_range.html b/doc/html/range/concepts/bidirectional_range.html index a8decd6..a75fbab 100644 --- a/doc/html/range/concepts/bidirectional_range.html +++ b/doc/html/range/concepts/bidirectional_range.html @@ -27,7 +27,7 @@ Bidirectional Range
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -75,7 +75,7 @@ Traversal Iterator.

    - + Refinement of
    @@ -83,7 +83,7 @@ Forward Range

    - + Associated types
    @@ -136,7 +136,7 @@
    - + Valid expressions
    @@ -221,7 +221,7 @@
    - + Complexity guarantees
    @@ -232,7 +232,7 @@ Forward Range.

    - + Invariants
    @@ -272,7 +272,7 @@
    - + See also

    diff --git a/doc/html/range/concepts/concept_checking.html b/doc/html/range/concepts/concept_checking.html index ca397ff..ec75e36 100644 --- a/doc/html/range/concepts/concept_checking.html +++ b/doc/html/range/concepts/concept_checking.html @@ -28,7 +28,7 @@

    Each of the range concepts has a corresponding concept checking class in - the file <boost/range/concepts.hpp>. + the file <boost/range/concepts.hpp>. These classes may be used in conjunction with the Boost Concept Check library to ensure that the type of a template parameter is compatible with a range concept. If not, a meaningful compile time error @@ -79,7 +79,7 @@

    - + See also

    diff --git a/doc/html/range/concepts/forward_range.html b/doc/html/range/concepts/forward_range.html index 1910a37..c74fdef 100644 --- a/doc/html/range/concepts/forward_range.html +++ b/doc/html/range/concepts/forward_range.html @@ -27,7 +27,7 @@ Forward Range

    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -73,14 +73,14 @@ Traversal Iterator.

    - + Refinement of

    Single Pass Range

    - + Associated types
    @@ -132,7 +132,7 @@
    - + See also

    diff --git a/doc/html/range/concepts/overview.html b/doc/html/range/concepts/overview.html index 0fa9643..bded544 100644 --- a/doc/html/range/concepts/overview.html +++ b/doc/html/range/concepts/overview.html @@ -52,14 +52,14 @@ or non-const) reference in generic code.

    - The operations that can be performed on a Range is dependent on the traversal + The operations that can be performed on a Range is dependent on the traversal category of the underlying iterator type. Therefore the range concepts are named to reflect which traversal category its iterators support. See also terminology and style guidelines. for more information about naming of ranges.

    - The concepts described below specifies associated types as metafunctions + The concepts described below specifies associated types as metafunctions and all functions as free-standing functions to allow for a layer of indirection.

    diff --git a/doc/html/range/concepts/random_access_range.html b/doc/html/range/concepts/random_access_range.html index 05cbdc0..0f0830b 100644 --- a/doc/html/range/concepts/random_access_range.html +++ b/doc/html/range/concepts/random_access_range.html @@ -27,7 +27,7 @@ Random Access Range
    - + Description

    @@ -35,7 +35,7 @@ Access Traversal Iterator.

    - + Refinement of
    @@ -43,7 +43,7 @@ Bidirectional Range

    - + Valid expressions
    @@ -89,7 +89,7 @@
    - + Expression semantics
    @@ -139,7 +139,7 @@
    - + Complexity guarantees
    @@ -147,7 +147,7 @@ boost::size(a) completes in amortized constant time.

    - + Invariants
    diff --git a/doc/html/range/concepts/single_pass_range.html b/doc/html/range/concepts/single_pass_range.html index a2372ac..e05c7eb 100644 --- a/doc/html/range/concepts/single_pass_range.html +++ b/doc/html/range/concepts/single_pass_range.html @@ -27,7 +27,7 @@ Single Pass Range
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -73,7 +73,7 @@ Pass Iterator.

    - + Associated types
    @@ -126,7 +126,7 @@
    - + Valid expressions
    @@ -198,7 +198,7 @@
    - + Expression semantics
    @@ -266,7 +266,7 @@
    - + Complexity guarantees
    @@ -276,7 +276,7 @@ constant time.

    - + Invariants
    @@ -316,7 +316,7 @@
    - + See also

    diff --git a/doc/html/range/history_ack.html b/doc/html/range/history_ack.html index 66191b9..d64b6e1 100644 --- a/doc/html/range/history_ack.html +++ b/doc/html/range/history_ack.html @@ -26,7 +26,7 @@ History and Acknowledgement

    - + Version 1 - before Boost 1.43

    @@ -79,7 +79,7 @@ The concept checks and their documentation was provided by Daniel Walker.

    - + Version 2 - Boost 1.43 and beyond

    diff --git a/doc/html/range/introduction.html b/doc/html/range/introduction.html index 5ea6f50..b0ce921 100644 --- a/doc/html/range/introduction.html +++ b/doc/html/range/introduction.html @@ -70,7 +70,7 @@

    - + Example - Iterate over the values in a map

    @@ -84,7 +84,7 @@

    - + Example - Iterate over the keys in a map

    @@ -98,7 +98,7 @@

    - + Example - Push the even values from a map in reverse order into the container target

    diff --git a/doc/html/range/mfc_atl.html b/doc/html/range/mfc_atl.html index 72221f9..9c2d65e 100644 --- a/doc/html/range/mfc_atl.html +++ b/doc/html/range/mfc_atl.html @@ -34,7 +34,7 @@
    References
    - + Introduction

    @@ -100,7 +100,7 @@

    - + Overview

    diff --git a/doc/html/range/reference/adaptors/introduction.html b/doc/html/range/reference/adaptors/introduction.html index bdf55ce..a049b13 100644 --- a/doc/html/range/reference/adaptors/introduction.html +++ b/doc/html/range/reference/adaptors/introduction.html @@ -122,7 +122,7 @@ situations, you will really appreciate the succinctness of operator|().

    - + Composition of Adaptors
    @@ -169,7 +169,7 @@ is the design solution to this problem.

    - + Range Adaptor alternative to copy_if algorithm
    @@ -186,7 +186,7 @@

    - + Range Adaptor alternative to count_if algorithm
    diff --git a/doc/html/range/reference/algorithms/heap/make_heap.html b/doc/html/range/reference/algorithms/heap/make_heap.html index ce7157e..d241d0f 100644 --- a/doc/html/range/reference/algorithms/heap/make_heap.html +++ b/doc/html/range/reference/algorithms/heap/make_heap.html @@ -27,7 +27,7 @@ make_heap
    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -60,14 +60,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -118,7 +118,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap/pop_heap.html b/doc/html/range/reference/algorithms/heap/pop_heap.html index b00c3ac..0fc429c 100644 --- a/doc/html/range/reference/algorithms/heap/pop_heap.html +++ b/doc/html/range/reference/algorithms/heap/pop_heap.html @@ -27,7 +27,7 @@ pop_heap

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -62,14 +62,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -120,7 +120,7 @@

    - + Precondition:
      @@ -132,7 +132,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap/push_heap.html b/doc/html/range/reference/algorithms/heap/push_heap.html index ece6dbf..7b304da 100644 --- a/doc/html/range/reference/algorithms/heap/push_heap.html +++ b/doc/html/range/reference/algorithms/heap/push_heap.html @@ -27,7 +27,7 @@ push_heap

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -62,14 +62,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -120,7 +120,7 @@

    - + Precondition:
      @@ -132,7 +132,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap/sort_heap.html b/doc/html/range/reference/algorithms/heap/sort_heap.html index 77a5dab..36ac8dc 100644 --- a/doc/html/range/reference/algorithms/heap/sort_heap.html +++ b/doc/html/range/reference/algorithms/heap/sort_heap.html @@ -27,7 +27,7 @@ sort_heap

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -61,14 +61,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -119,14 +119,14 @@

    - + Precondition:

    rng is a heap.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/copy.html b/doc/html/range/reference/algorithms/mutating/copy.html index 671e761..8aabe6a 100644 --- a/doc/html/range/reference/algorithms/mutating/copy.html +++ b/doc/html/range/reference/algorithms/mutating/copy.html @@ -27,7 +27,7 @@ copy

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -50,14 +50,14 @@ distance(source_rng)

    - + Definition

    Defined in the header file boost/range/algorithm/copy.hpp

    - + Requirements
      @@ -78,7 +78,7 @@
    - + Precondition:
      @@ -92,7 +92,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/copy_backward.html b/doc/html/range/reference/algorithms/mutating/copy_backward.html index 7c909c1..6450b6a 100644 --- a/doc/html/range/reference/algorithms/mutating/copy_backward.html +++ b/doc/html/range/reference/algorithms/mutating/copy_backward.html @@ -28,7 +28,7 @@ copy_backward

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -60,14 +60,14 @@ denotes the end of the output sequence.

    - + Definition

    Defined in the header file boost/range/algorithm/copy_backward.hpp

    - + Requirements
      @@ -88,7 +88,7 @@
    - + Precondition:
      @@ -102,7 +102,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/fill.html b/doc/html/range/reference/algorithms/mutating/fill.html index 013fa91..f3130ae 100644 --- a/doc/html/range/reference/algorithms/mutating/fill.html +++ b/doc/html/range/reference/algorithms/mutating/fill.html @@ -27,7 +27,7 @@ fill

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -48,14 +48,14 @@ in the range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/fill.hpp

    - + Requirements
      @@ -78,7 +78,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/fill_n.html b/doc/html/range/reference/algorithms/mutating/fill_n.html index a37bd29..50abf67 100644 --- a/doc/html/range/reference/algorithms/mutating/fill_n.html +++ b/doc/html/range/reference/algorithms/mutating/fill_n.html @@ -27,7 +27,7 @@ fill_n

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -47,14 +47,14 @@ val to n elements in the range rng begining with boost::begin(rng).

    - + Definition

    Defined in the header file boost/range/algorithm/fill_n.hpp

    - + Requirements
      @@ -77,7 +77,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/generate.html b/doc/html/range/reference/algorithms/mutating/generate.html index a81fca5..b53a312 100644 --- a/doc/html/range/reference/algorithms/mutating/generate.html +++ b/doc/html/range/reference/algorithms/mutating/generate.html @@ -27,7 +27,7 @@ generate

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -52,14 +52,14 @@ Returns the resultant range.

    - + Definition

    Defined in the header file boost/range/algorithm/generate.hpp

    - + Requirements
      @@ -83,7 +83,7 @@
    - + Precondition:
      @@ -97,7 +97,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/inplace_merge.html b/doc/html/range/reference/algorithms/mutating/inplace_merge.html index b77680d..8980d1a 100644 --- a/doc/html/range/reference/algorithms/mutating/inplace_merge.html +++ b/doc/html/range/reference/algorithms/mutating/inplace_merge.html @@ -28,7 +28,7 @@ inplace_merge

    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -72,14 +72,14 @@ input range is preserved.

    - + Definition

    Defined in the header file boost/range/algorithm/inplace_merge.hpp

    - + Requirements

    @@ -116,11 +116,11 @@ argument types.

    - + Precondition:
    - + For the non-predicate version:
    @@ -143,7 +143,7 @@
    - + For the predicate version:
    @@ -164,7 +164,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/merge.html b/doc/html/range/reference/algorithms/mutating/merge.html index 7fc40e8..83e88b7 100644 --- a/doc/html/range/reference/algorithms/mutating/merge.html +++ b/doc/html/range/reference/algorithms/mutating/merge.html @@ -27,7 +27,7 @@ merge

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -75,14 +75,14 @@ version uses the predicate instead of operator<().

    - + Definition

    Defined in the header file boost/range/algorithm/merge.hpp

    - + Requirements

    @@ -150,11 +150,11 @@

    - + Precondition:
    - + For the non-predicate version:
    @@ -194,7 +194,7 @@
    - + For the predicate version:
    @@ -230,7 +230,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/nth_element.html b/doc/html/range/reference/algorithms/mutating/nth_element.html index 1f3b2ef..bd42f1f 100644 --- a/doc/html/range/reference/algorithms/mutating/nth_element.html +++ b/doc/html/range/reference/algorithms/mutating/nth_element.html @@ -28,7 +28,7 @@ nth_element

    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -70,14 +70,14 @@ is the same as the element that would be in that position if rng has been sorted.

    - + Definition

    Defined in the header file boost/range/algorithm/nth_element.hpp

    - + Requirements

    @@ -128,7 +128,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/partial_sort.html b/doc/html/range/reference/algorithms/mutating/partial_sort.html index 57faa7d..c0445f4 100644 --- a/doc/html/range/reference/algorithms/mutating/partial_sort.html +++ b/doc/html/range/reference/algorithms/mutating/partial_sort.html @@ -28,7 +28,7 @@ partial_sort

    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -75,14 +75,14 @@ predicate instead.

    - + Definition

    Defined in the header file boost/range/algorithm/partial_sort.hpp

    - + Requirements

    @@ -133,7 +133,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/partition.html b/doc/html/range/reference/algorithms/mutating/partition.html index 597612c..0cdf0d9 100644 --- a/doc/html/range/reference/algorithms/mutating/partition.html +++ b/doc/html/range/reference/algorithms/mutating/partition.html @@ -27,7 +27,7 @@ partition

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -80,14 +80,14 @@ corresponds to the middle iterator.

    - + Definition

    Defined in the header file boost/range/algorithm/partition.hpp

    - + Requirements
      @@ -107,7 +107,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/random_shuffle.html b/doc/html/range/reference/algorithms/mutating/random_shuffle.html index ece4438..ce742b5 100644 --- a/doc/html/range/reference/algorithms/mutating/random_shuffle.html +++ b/doc/html/range/reference/algorithms/mutating/random_shuffle.html @@ -28,7 +28,7 @@ random_shuffle

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -61,14 +61,14 @@ the shuffles range.

    - + Definition

    Defined in the header file boost/range/algorithm/random_shuffle.hpp

    - + Requirements

    @@ -99,7 +99,7 @@

    - + Precondition:
    • @@ -108,7 +108,7 @@ maximum value.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/remove.html b/doc/html/range/reference/algorithms/mutating/remove.html index 58f2b6b..1017fa8 100644 --- a/doc/html/range/reference/algorithms/mutating/remove.html +++ b/doc/html/range/reference/algorithms/mutating/remove.html @@ -27,7 +27,7 @@ remove

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -83,14 +83,14 @@ are dereferenceable, but the elements are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove.hpp

    - + Requirements
      @@ -113,7 +113,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/remove_copy.html b/doc/html/range/reference/algorithms/mutating/remove_copy.html index c948593..9b69dec 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_copy.html +++ b/doc/html/range/reference/algorithms/mutating/remove_copy.html @@ -28,7 +28,7 @@ remove_copy

    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -54,14 +54,14 @@ rng for which x == val is false.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_copy.hpp

    - + Requirements
      @@ -84,7 +84,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/remove_copy_if.html b/doc/html/range/reference/algorithms/mutating/remove_copy_if.html index d631aab..b21f8c9 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_copy_if.html +++ b/doc/html/range/reference/algorithms/mutating/remove_copy_if.html @@ -28,7 +28,7 @@ remove_copy_if

    - + Prototype

    @@ -45,7 +45,7 @@

    - + Description

    @@ -55,14 +55,14 @@ is false.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_copy_if.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/remove_if.html b/doc/html/range/reference/algorithms/mutating/remove_if.html index 460b087..492ee63 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_if.html +++ b/doc/html/range/reference/algorithms/mutating/remove_if.html @@ -27,7 +27,7 @@ remove_if

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -82,14 +82,14 @@ are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_if.hpp

    - + Requirements
      @@ -112,7 +112,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/replace.html b/doc/html/range/reference/algorithms/mutating/replace.html index efd4c78..c68005f 100644 --- a/doc/html/range/reference/algorithms/mutating/replace.html +++ b/doc/html/range/reference/algorithms/mutating/replace.html @@ -27,7 +27,7 @@ replace

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -57,14 +57,14 @@ Return a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace.hpp

    - + Requirements
      @@ -93,7 +93,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/replace_copy.html b/doc/html/range/reference/algorithms/mutating/replace_copy.html index ccc4e22..41b3d07 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_copy.html +++ b/doc/html/range/reference/algorithms/mutating/replace_copy.html @@ -28,7 +28,7 @@ replace_copy

    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -54,14 +54,14 @@ x.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_copy.hpp

    - + Requirements
      @@ -88,7 +88,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/replace_copy_if.html b/doc/html/range/reference/algorithms/mutating/replace_copy_if.html index 60f4f9c..1d9be73 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_copy_if.html +++ b/doc/html/range/reference/algorithms/mutating/replace_copy_if.html @@ -28,7 +28,7 @@ replace_copy_if

    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -52,14 +52,14 @@ : x.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_copy_if.hpp

    - + Requirements
      @@ -90,7 +90,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/replace_if.html b/doc/html/range/reference/algorithms/mutating/replace_if.html index 293ae92..9730e67 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_if.html +++ b/doc/html/range/reference/algorithms/mutating/replace_if.html @@ -28,7 +28,7 @@ replace_if

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_if.hpp

    - + Requirements
      @@ -91,7 +91,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/reverse.html b/doc/html/range/reference/algorithms/mutating/reverse.html index 253d901..c32a5ea 100644 --- a/doc/html/range/reference/algorithms/mutating/reverse.html +++ b/doc/html/range/reference/algorithms/mutating/reverse.html @@ -27,7 +27,7 @@ reverse

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -50,14 +50,14 @@ Returns a reference to the reversed range.

    - + Definition

    Defined in the header file boost/range/algorithm/reverse.hpp

    - + Requirements
      @@ -72,7 +72,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/reverse_copy.html b/doc/html/range/reference/algorithms/mutating/reverse_copy.html index 4795437..3a94e8a 100644 --- a/doc/html/range/reference/algorithms/mutating/reverse_copy.html +++ b/doc/html/range/reference/algorithms/mutating/reverse_copy.html @@ -28,7 +28,7 @@ reverse_copy

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -50,14 +50,14 @@ Returns the output iterator one passed the last copied element.

    - + Definition

    Defined in the header file boost/range/algorithm/reverse_copy.hpp

    - + Requirements
      @@ -76,7 +76,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/rotate.html b/doc/html/range/reference/algorithms/mutating/rotate.html index 9e7cbb4..1d4646c 100644 --- a/doc/html/range/reference/algorithms/mutating/rotate.html +++ b/doc/html/range/reference/algorithms/mutating/rotate.html @@ -27,7 +27,7 @@ rotate

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,14 +53,14 @@ and [middle, end(rng)). Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/rotate.hpp

    - + Requirements
      @@ -74,7 +74,7 @@
    - + Precondition:
      @@ -86,7 +86,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/rotate_copy.html b/doc/html/range/reference/algorithms/mutating/rotate_copy.html index 53643bd..c1d3434 100644 --- a/doc/html/range/reference/algorithms/mutating/rotate_copy.html +++ b/doc/html/range/reference/algorithms/mutating/rotate_copy.html @@ -28,7 +28,7 @@ rotate_copy

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ and [middle, end(rng)) to out.

    - + Definition

    Defined in the header file boost/range/algorithm/rotate_copy.hpp

    - + Requirements
      @@ -77,7 +77,7 @@
    - + Precondition:
      @@ -89,7 +89,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/sort.html b/doc/html/range/reference/algorithms/mutating/sort.html index fa727b8..aac3921 100644 --- a/doc/html/range/reference/algorithms/mutating/sort.html +++ b/doc/html/range/reference/algorithms/mutating/sort.html @@ -27,7 +27,7 @@ sort

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -71,14 +71,14 @@ [x,y], pred(y, x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/sort.hpp

    - + Requirements

    @@ -129,7 +129,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/stable_partition.html b/doc/html/range/reference/algorithms/mutating/stable_partition.html index 59a763d..8450d4c 100644 --- a/doc/html/range/reference/algorithms/mutating/stable_partition.html +++ b/doc/html/range/reference/algorithms/mutating/stable_partition.html @@ -28,7 +28,7 @@ stable_partition

    - + Prototype

    @@ -61,7 +61,7 @@

    - + Description

    @@ -83,14 +83,14 @@ the iterator to the first element that fails to satisfy pred.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_partition.hpp

    - + Requirements
      @@ -108,7 +108,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/stable_sort.html b/doc/html/range/reference/algorithms/mutating/stable_sort.html index 8d9a6c0..5bb61fb 100644 --- a/doc/html/range/reference/algorithms/mutating/stable_sort.html +++ b/doc/html/range/reference/algorithms/mutating/stable_sort.html @@ -28,7 +28,7 @@ stable_sort

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ [x,y], pred(y,x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_sort.hpp

    - + Requirements

    @@ -130,7 +130,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/swap_ranges.html b/doc/html/range/reference/algorithms/mutating/swap_ranges.html index 42e33ce..956694f 100644 --- a/doc/html/range/reference/algorithms/mutating/swap_ranges.html +++ b/doc/html/range/reference/algorithms/mutating/swap_ranges.html @@ -28,7 +28,7 @@ swap_ranges

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -50,14 +50,14 @@ Returns a reference to rng2.

    - + Definition

    Defined in the header file boost/range/algorithm/swap_ranges.hpp

    - + Requirements
      @@ -81,7 +81,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/transform.html b/doc/html/range/reference/algorithms/mutating/transform.html index ca1a530..056255e 100644 --- a/doc/html/range/reference/algorithms/mutating/transform.html +++ b/doc/html/range/reference/algorithms/mutating/transform.html @@ -27,7 +27,7 @@ transform

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -92,14 +92,14 @@ The return value is out + min(distance(rng1), distance(rng2)).

    - + Definition

    Defined in the header file boost/range/algorithm/transform.hpp

    - + Requirements

    @@ -169,7 +169,7 @@

    - + Precondition:

    @@ -203,7 +203,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/unique.html b/doc/html/range/reference/algorithms/mutating/unique.html index 7c0c1b8..2a7bae6 100644 --- a/doc/html/range/reference/algorithms/mutating/unique.html +++ b/doc/html/range/reference/algorithms/mutating/unique.html @@ -27,7 +27,7 @@ unique

    - + Prototype

    @@ -68,7 +68,7 @@

    - + Description

    @@ -86,14 +86,14 @@ type.

    - + Definition

    Defined in the header file boost/range/algorithm/unique.hpp

    - + Requirements

    @@ -137,7 +137,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/unique_copy.html b/doc/html/range/reference/algorithms/mutating/unique_copy.html index b202b52..1b0c570 100644 --- a/doc/html/range/reference/algorithms/mutating/unique_copy.html +++ b/doc/html/range/reference/algorithms/mutating/unique_copy.html @@ -28,7 +28,7 @@ unique_copy

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -56,14 +56,14 @@ value type.

    - + Definition

    Defined in the header file boost/range/algorithm/unique_copy.hpp

    - + Requirements

    @@ -117,7 +117,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/copy_n.html b/doc/html/range/reference/algorithms/new/copy_n.html index 0a6c5cc..593724d 100644 --- a/doc/html/range/reference/algorithms/new/copy_n.html +++ b/doc/html/range/reference/algorithms/new/copy_n.html @@ -27,7 +27,7 @@ copy_n

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -53,14 +53,14 @@ from [boost::begin(rng), boost::begin(rng) + n) to the range [out, out + n)

    - + Definition

    Defined in the header file boost/range/algorithm_ext/copy_n.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/erase.html b/doc/html/range/reference/algorithms/new/erase.html index 346a24e..c802ee7 100644 --- a/doc/html/range/reference/algorithms/new/erase.html +++ b/doc/html/range/reference/algorithms/new/erase.html @@ -27,7 +27,7 @@ erase

    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -58,14 +58,14 @@ the frequently used combination equivalent to target.erase(std::remove_if(target.begin(), target.end(), pred), target.end());

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. @@ -73,7 +73,7 @@ erase of an iterator range.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/for_each.html b/doc/html/range/reference/algorithms/new/for_each.html index 8983318..3f685d5 100644 --- a/doc/html/range/reference/algorithms/new/for_each.html +++ b/doc/html/range/reference/algorithms/new/for_each.html @@ -27,7 +27,7 @@ for_each

    - + Prototype

    @@ -72,7 +72,7 @@

    - + Description

    @@ -88,14 +88,14 @@ It is safe to call this function with unequal length ranges.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/for_each.hpp

    - + Requirements
      @@ -125,7 +125,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/insert.html b/doc/html/range/reference/algorithms/new/insert.html index 7da8357..c9624e6 100644 --- a/doc/html/range/reference/algorithms/new/insert.html +++ b/doc/html/range/reference/algorithms/new/insert.html @@ -27,7 +27,7 @@ insert

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -54,14 +54,14 @@ target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/insert.hpp

    - + Requirements
      @@ -81,7 +81,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/iota.html b/doc/html/range/reference/algorithms/new/iota.html index 8693b0b..5d932ee 100644 --- a/doc/html/range/reference/algorithms/new/iota.html +++ b/doc/html/range/reference/algorithms/new/iota.html @@ -27,7 +27,7 @@ iota

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -50,14 +50,14 @@ + boost::distance(boost::begin(rng), it)

    - + Definition

    Defined in the header file boost/range/algorithm_ext/iota.hpp

    - + Requirements
      @@ -73,7 +73,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/is_sorted.html b/doc/html/range/reference/algorithms/new/is_sorted.html index f5a2462..53b79f1 100644 --- a/doc/html/range/reference/algorithms/new/is_sorted.html +++ b/doc/html/range/reference/algorithms/new/is_sorted.html @@ -27,7 +27,7 @@ is_sorted

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -58,14 +58,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/is_sorted.hpp

    - + Requirements
      @@ -85,7 +85,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/overwrite.html b/doc/html/range/reference/algorithms/new/overwrite.html index 6072237..c7de271 100644 --- a/doc/html/range/reference/algorithms/new/overwrite.html +++ b/doc/html/range/reference/algorithms/new/overwrite.html @@ -27,7 +27,7 @@ overwrite

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ into the range to.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/overwrite.hpp

    - + Requirements
      @@ -88,7 +88,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/push_back.html b/doc/html/range/reference/algorithms/new/push_back.html index ecd5949..b74c4d5 100644 --- a/doc/html/range/reference/algorithms/new/push_back.html +++ b/doc/html/range/reference/algorithms/new/push_back.html @@ -27,7 +27,7 @@ push_back

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ to the back of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_back.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/push_front.html b/doc/html/range/reference/algorithms/new/push_front.html index 13e2fe4..1104cc2 100644 --- a/doc/html/range/reference/algorithms/new/push_front.html +++ b/doc/html/range/reference/algorithms/new/push_front.html @@ -27,7 +27,7 @@ push_front

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ to the front of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_front.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/remove_erase.html b/doc/html/range/reference/algorithms/new/remove_erase.html index 0982bc7..3136430 100644 --- a/doc/html/range/reference/algorithms/new/remove_erase.html +++ b/doc/html/range/reference/algorithms/new/remove_erase.html @@ -27,7 +27,7 @@ remove_erase

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -50,14 +50,14 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. @@ -65,7 +65,7 @@ erase of an iterator range.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/remove_erase_if.html b/doc/html/range/reference/algorithms/new/remove_erase_if.html index b9f2d9a..994dd02 100644 --- a/doc/html/range/reference/algorithms/new/remove_erase_if.html +++ b/doc/html/range/reference/algorithms/new/remove_erase_if.html @@ -28,7 +28,7 @@ remove_erase_if

    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -52,14 +52,14 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
      @@ -73,7 +73,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html b/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html index c909827..28aacf3 100644 --- a/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html +++ b/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html @@ -28,7 +28,7 @@ adjacent_find

    - + Prototype

    @@ -77,7 +77,7 @@

    - + Description

    @@ -98,14 +98,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/adjacent_find.hpp

    - + Requirements

    @@ -143,7 +143,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/binary_search.html b/doc/html/range/reference/algorithms/non_mutating/binary_search.html index 96c6476..4c75b33 100644 --- a/doc/html/range/reference/algorithms/non_mutating/binary_search.html +++ b/doc/html/range/reference/algorithms/non_mutating/binary_search.html @@ -28,7 +28,7 @@ binary_search

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -53,14 +53,14 @@ range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/binary_search.hpp

    - + Requirements

    @@ -111,7 +111,7 @@

    - + Precondition:

    @@ -129,7 +129,7 @@ order according to the function object pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/count.html b/doc/html/range/reference/algorithms/non_mutating/count.html index 1360a5c..a7ec656 100644 --- a/doc/html/range/reference/algorithms/non_mutating/count.html +++ b/doc/html/range/reference/algorithms/non_mutating/count.html @@ -27,7 +27,7 @@ count

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -54,14 +54,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/count.hpp

    - + Requirements
      @@ -84,7 +84,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/count_if.html b/doc/html/range/reference/algorithms/non_mutating/count_if.html index 5e6e850..e56fb51 100644 --- a/doc/html/range/reference/algorithms/non_mutating/count_if.html +++ b/doc/html/range/reference/algorithms/non_mutating/count_if.html @@ -28,7 +28,7 @@ count_if

    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -51,14 +51,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/count_if.hpp

    - + Requirements
      @@ -81,7 +81,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/equal.html b/doc/html/range/reference/algorithms/non_mutating/equal.html index 0556a2a..1576f3e 100644 --- a/doc/html/range/reference/algorithms/non_mutating/equal.html +++ b/doc/html/range/reference/algorithms/non_mutating/equal.html @@ -27,7 +27,7 @@ equal

    - + Prototype

    @@ -52,7 +52,7 @@

    - + Description

    @@ -70,14 +70,14 @@ considered equal in the predicate version if pred(x,y) is true.

    - + Definition

    Defined in the header file boost/range/algorithm/equal.hpp

    - + Requirements

    @@ -138,7 +138,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/equal_range.html b/doc/html/range/reference/algorithms/non_mutating/equal_range.html index 766ee8a..51536ec 100644 --- a/doc/html/range/reference/algorithms/non_mutating/equal_range.html +++ b/doc/html/range/reference/algorithms/non_mutating/equal_range.html @@ -28,7 +28,7 @@ equal_range

    - + Prototype

    @@ -71,7 +71,7 @@

    - + Description

    @@ -85,14 +85,14 @@ is determined by pred.

    - + Definition

    Defined in the header file boost/range/algorithm/equal_range.hpp

    - + Requirements

    @@ -143,7 +143,7 @@

    - + Precondition:

    @@ -155,7 +155,7 @@ is ordered in ascending order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/find.html b/doc/html/range/reference/algorithms/non_mutating/find.html index 80ac8a1..583c1cb 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find.html +++ b/doc/html/range/reference/algorithms/non_mutating/find.html @@ -27,7 +27,7 @@ find

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -59,14 +59,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find.hpp

    - + Requirements
      @@ -87,7 +87,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_end.html b/doc/html/range/reference/algorithms/non_mutating/find_end.html index 40847b3..d4e9525 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_end.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_end.html @@ -28,7 +28,7 @@ find_end

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -81,14 +81,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_end.hpp

    - + Requirements

    @@ -148,7 +148,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_first_of.html b/doc/html/range/reference/algorithms/non_mutating/find_first_of.html index ab764df..0585184 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_first_of.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_first_of.html @@ -28,7 +28,7 @@ find_first_of

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -86,14 +86,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_first_of.hpp

    - + Requirements

    @@ -147,7 +147,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_if.html b/doc/html/range/reference/algorithms/non_mutating/find_if.html index caa16d2..df62ea8 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_if.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_if.html @@ -28,7 +28,7 @@ find_if

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -64,14 +64,14 @@ defines found in the same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_if.hpp

    - + Requirements
      @@ -90,7 +90,7 @@
    - + Precondition:

    @@ -98,7 +98,7 @@ rng, *i is in the domain of UnaryPredicate.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/for_each.html b/doc/html/range/reference/algorithms/non_mutating/for_each.html index c8584f7..413fc82 100644 --- a/doc/html/range/reference/algorithms/non_mutating/for_each.html +++ b/doc/html/range/reference/algorithms/non_mutating/for_each.html @@ -28,7 +28,7 @@ for_each

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -59,14 +59,14 @@ fun(x).

    - + Definition

    Defined in the header file boost/range/algorithm/for_each.hpp

    - + Requirements
      @@ -90,7 +90,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html b/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html index 257ab7b..f3ea649 100644 --- a/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html +++ b/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html @@ -28,7 +28,7 @@ lexicographical_compare

    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -73,14 +73,14 @@ predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/lexicographical_compare.hpp

    - + Requirements

    @@ -145,7 +145,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/lower_bound.html b/doc/html/range/reference/algorithms/non_mutating/lower_bound.html index 0f92df5..e220c33 100644 --- a/doc/html/range/reference/algorithms/non_mutating/lower_bound.html +++ b/doc/html/range/reference/algorithms/non_mutating/lower_bound.html @@ -28,7 +28,7 @@ lower_bound

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -72,14 +72,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/lower_bound.hpp

    - + Requirements

    @@ -130,7 +130,7 @@

    - + Precondition:

    @@ -148,7 +148,7 @@ order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/max_element.html b/doc/html/range/reference/algorithms/non_mutating/max_element.html index 173b281..2b61404 100644 --- a/doc/html/range/reference/algorithms/non_mutating/max_element.html +++ b/doc/html/range/reference/algorithms/non_mutating/max_element.html @@ -28,7 +28,7 @@ max_element

    - + Prototype

    @@ -84,7 +84,7 @@

    - + Description

    @@ -98,14 +98,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/max_element.hpp

    - + Requirements

    @@ -142,7 +142,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/min_element.html b/doc/html/range/reference/algorithms/non_mutating/min_element.html index 14f7973..1d91462 100644 --- a/doc/html/range/reference/algorithms/non_mutating/min_element.html +++ b/doc/html/range/reference/algorithms/non_mutating/min_element.html @@ -28,7 +28,7 @@ min_element

    - + Prototype

    @@ -84,7 +84,7 @@

    - + Description

    @@ -98,14 +98,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/min_element.hpp

    - + Requirements

    @@ -142,7 +142,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/mismatch.html b/doc/html/range/reference/algorithms/non_mutating/mismatch.html index 0ae3639..484a7a0 100644 --- a/doc/html/range/reference/algorithms/non_mutating/mismatch.html +++ b/doc/html/range/reference/algorithms/non_mutating/mismatch.html @@ -28,7 +28,7 @@ mismatch

    - + Prototype

    @@ -106,7 +106,7 @@

    - + Description

    @@ -118,14 +118,14 @@ Equality is determined by operator== for non-predicate versions of mismatch, and by satisfying pred in the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/mismatch.hpp

    - + Requirements

    @@ -186,14 +186,14 @@

    - + Precondition:

    distance(rng2) >= distance(rng1)

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/search.html b/doc/html/range/reference/algorithms/non_mutating/search.html index 9c4f86a..16d35f0 100644 --- a/doc/html/range/reference/algorithms/non_mutating/search.html +++ b/doc/html/range/reference/algorithms/non_mutating/search.html @@ -28,7 +28,7 @@ search

    - + Prototype

    @@ -96,7 +96,7 @@

    - + Description

    @@ -115,14 +115,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/search.hpp

    - + Requirements

    @@ -183,7 +183,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/search_n.html b/doc/html/range/reference/algorithms/non_mutating/search_n.html index 1961ecf..394072c 100644 --- a/doc/html/range/reference/algorithms/non_mutating/search_n.html +++ b/doc/html/range/reference/algorithms/non_mutating/search_n.html @@ -28,7 +28,7 @@ search_n

    - + Prototype

    @@ -55,7 +55,7 @@

    - + Description

    @@ -64,14 +64,14 @@ and by a predicate when one is supplied.

    - + Definition

    Defined in the header file boost/range/algorithm/search_n.hpp

    - + Requirements

    @@ -125,7 +125,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/upper_bound.html b/doc/html/range/reference/algorithms/non_mutating/upper_bound.html index 0ef9e03..be7c7e7 100644 --- a/doc/html/range/reference/algorithms/non_mutating/upper_bound.html +++ b/doc/html/range/reference/algorithms/non_mutating/upper_bound.html @@ -28,7 +28,7 @@ upper_bound

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -71,14 +71,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/upper_bound.hpp

    - + Requirements

    @@ -129,7 +129,7 @@

    - + Precondition:

    @@ -147,7 +147,7 @@ order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/numeric/accumulate.html b/doc/html/range/reference/algorithms/numeric/accumulate.html index 6ea2097..2243e8c 100644 --- a/doc/html/range/reference/algorithms/numeric/accumulate.html +++ b/doc/html/range/reference/algorithms/numeric/accumulate.html @@ -27,7 +27,7 @@ accumulate

    - + Prototype

    @@ -52,7 +52,7 @@

    - + Description

    @@ -63,18 +63,18 @@ The return value is the resultant value of the above algorithm.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -99,7 +99,7 @@
    - + For the second version
    @@ -133,7 +133,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/numeric/adjacent_difference.html b/doc/html/range/reference/algorithms/numeric/adjacent_difference.html index 57d2bf8..0bfe131 100644 --- a/doc/html/range/reference/algorithms/numeric/adjacent_difference.html +++ b/doc/html/range/reference/algorithms/numeric/adjacent_difference.html @@ -28,7 +28,7 @@ adjacent_difference

    - + Prototype

    @@ -55,7 +55,7 @@

    - + Description

    @@ -69,18 +69,18 @@ instead of operator-().

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -111,7 +111,7 @@
    - + For the second version
    @@ -146,7 +146,7 @@
    - + Precondition:

    @@ -154,7 +154,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/numeric/inner_product.html b/doc/html/range/reference/algorithms/numeric/inner_product.html index 76a07fc..021ae08 100644 --- a/doc/html/range/reference/algorithms/numeric/inner_product.html +++ b/doc/html/range/reference/algorithms/numeric/inner_product.html @@ -28,7 +28,7 @@ inner_product

    - + Prototype

    @@ -54,7 +54,7 @@

    - + Description

    @@ -67,18 +67,18 @@ algorithm please see inner_product.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -113,7 +113,7 @@
    - + For the second version
    @@ -162,14 +162,14 @@
    - + Precondition:

    distance(rng2) >= distance(rng1) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/numeric/partial_sum.html b/doc/html/range/reference/algorithms/numeric/partial_sum.html index 0967f12..e1d88c8 100644 --- a/doc/html/range/reference/algorithms/numeric/partial_sum.html +++ b/doc/html/range/reference/algorithms/numeric/partial_sum.html @@ -28,7 +28,7 @@ partial_sum

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -58,18 +58,18 @@ in the same manner as std::partial_sum(boost::begin(rng), boost::end(rng), out_it). See partial_sum.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -99,7 +99,7 @@
    - + For the second version
    @@ -128,7 +128,7 @@
    - + Precondition:

    @@ -136,7 +136,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/permutation/next_permutation.html b/doc/html/range/reference/algorithms/permutation/next_permutation.html index c7533d7..73502be 100644 --- a/doc/html/range/reference/algorithms/permutation/next_permutation.html +++ b/doc/html/range/reference/algorithms/permutation/next_permutation.html @@ -28,7 +28,7 @@ next_permutation

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -67,14 +67,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -125,7 +125,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/permutation/prev_permutation.html b/doc/html/range/reference/algorithms/permutation/prev_permutation.html index 090c6c0..b1eb2bb 100644 --- a/doc/html/range/reference/algorithms/permutation/prev_permutation.html +++ b/doc/html/range/reference/algorithms/permutation/prev_permutation.html @@ -28,7 +28,7 @@ prev_permutation

    - + Prototype

    @@ -49,7 +49,7 @@

    - + Description

    @@ -67,14 +67,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -125,7 +125,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/includes.html b/doc/html/range/reference/algorithms/set/includes.html index 0e7e4b6..dc960b9 100644 --- a/doc/html/range/reference/algorithms/set/includes.html +++ b/doc/html/range/reference/algorithms/set/includes.html @@ -27,7 +27,7 @@ includes

    - + Prototype

    @@ -47,7 +47,7 @@

    - + Description

    @@ -59,14 +59,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -144,7 +144,7 @@

    - + Precondition:

    @@ -162,7 +162,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/set_difference.html b/doc/html/range/reference/algorithms/set/set_difference.html index c53281e..80c4cff 100644 --- a/doc/html/range/reference/algorithms/set/set_difference.html +++ b/doc/html/range/reference/algorithms/set/set_difference.html @@ -27,7 +27,7 @@ set_difference

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -70,14 +70,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -163,7 +163,7 @@

    - + Precondition:

    @@ -181,7 +181,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/set_intersection.html b/doc/html/range/reference/algorithms/set/set_intersection.html index b77838f..cde3eb5 100644 --- a/doc/html/range/reference/algorithms/set/set_intersection.html +++ b/doc/html/range/reference/algorithms/set/set_intersection.html @@ -28,7 +28,7 @@ set_intersection

    - + Prototype

    @@ -57,7 +57,7 @@

    - + Description

    @@ -71,14 +71,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -164,7 +164,7 @@

    - + Precondition:

    @@ -182,7 +182,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/set_symmetric_difference.html b/doc/html/range/reference/algorithms/set/set_symmetric_difference.html index bef721c..4be44e6 100644 --- a/doc/html/range/reference/algorithms/set/set_symmetric_difference.html +++ b/doc/html/range/reference/algorithms/set/set_symmetric_difference.html @@ -28,7 +28,7 @@ set_symmetric_difference

    - + Prototype

    @@ -59,7 +59,7 @@

    - + Description

    @@ -75,14 +75,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -168,7 +168,7 @@

    - + Precondition:

    @@ -186,7 +186,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/set_union.html b/doc/html/range/reference/algorithms/set/set_union.html index 026159c..b963850 100644 --- a/doc/html/range/reference/algorithms/set/set_union.html +++ b/doc/html/range/reference/algorithms/set/set_union.html @@ -27,7 +27,7 @@ set_union

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -69,14 +69,14 @@ in the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -162,7 +162,7 @@

    - + Precondition:

    @@ -180,7 +180,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/concept_implementation/semantics.html b/doc/html/range/reference/concept_implementation/semantics.html index 59fc394..55a2106 100644 --- a/doc/html/range/reference/concept_implementation/semantics.html +++ b/doc/html/range/reference/concept_implementation/semantics.html @@ -31,7 +31,7 @@

    Functions
    - + notation
    diff --git a/doc/html/range/reference/ranges/counting_range.html b/doc/html/range/reference/ranges/counting_range.html index b1d7294..01d404d 100644 --- a/doc/html/range/reference/ranges/counting_range.html +++ b/doc/html/range/reference/ranges/counting_range.html @@ -27,7 +27,7 @@ counting_range
    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -58,14 +58,14 @@ (from Boost.Iterator).

    - + Definition

    Defined in header file boost/range/counting_range.hpp

    - + Requirements
    1. diff --git a/doc/html/range/reference/ranges/irange.html b/doc/html/range/reference/ranges/irange.html index da9b33a..3beff0b 100644 --- a/doc/html/range/reference/ranges/irange.html +++ b/doc/html/range/reference/ranges/irange.html @@ -27,7 +27,7 @@ irange
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -58,14 +58,14 @@ parameters denoted a half-open range.

    - + Definition

    Defined in the header file boost/range/irange.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/ranges/istream_range.html b/doc/html/range/reference/ranges/istream_range.html index 52bb89c..df2709c 100644 --- a/doc/html/range/reference/ranges/istream_range.html +++ b/doc/html/range/reference/ranges/istream_range.html @@ -27,7 +27,7 @@ istream_range

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -49,7 +49,7 @@ wrapping a std::istream_iterator.

    - + Definition

    diff --git a/doc/html/range/reference/utilities/iterator_range.html b/doc/html/range/reference/utilities/iterator_range.html index 27df4a0..fb41371 100644 --- a/doc/html/range/reference/utilities/iterator_range.html +++ b/doc/html/range/reference/utilities/iterator_range.html @@ -48,7 +48,7 @@ type.

    - + Synopsis

    @@ -188,7 +188,7 @@ iterators from the same container.

    - + Details member functions
    @@ -207,7 +207,7 @@ ==r.end();

    - + Details functions
    diff --git a/doc/html/range/reference/utilities/join.html b/doc/html/range/reference/utilities/join.html index 458ed2e..a06440d 100644 --- a/doc/html/range/reference/utilities/join.html +++ b/doc/html/range/reference/utilities/join.html @@ -39,7 +39,7 @@ check if the end of a range has been reached internally during traversal.

    - + Synposis

    @@ -65,7 +65,7 @@

    - + Example

    diff --git a/doc/html/range/reference/utilities/sub_range.html b/doc/html/range/reference/utilities/sub_range.html index 684c838..ebbf648 100644 --- a/doc/html/range/reference/utilities/sub_range.html +++ b/doc/html/range/reference/utilities/sub_range.html @@ -35,7 +35,7 @@ is.

    - + Synopsis

    diff --git a/doc/html/standalone_HTML.manifest b/doc/html/standalone_HTML.manifest deleted file mode 100644 index e9d38e8..0000000 --- a/doc/html/standalone_HTML.manifest +++ /dev/null @@ -1,19 +0,0 @@ -index.html -range/concepts.html -range/concepts/single_pass_range.html -range/concepts/forward_range.html -range/concepts/bidirectional_range.html -range/concepts/random_access_range.html -range/concepts/concept_checking.html -range/reference.html -range/reference/synopsis.html -range/reference/semantics.html -range/reference/extending.html -range/utilities.html -range/utilities/sub_range.html -range/style_guide.html -range/library_headers.html -range/examples.html -range/portability.html -range/faq.html -range/history_ack.html From 6d46ce412f21cd8cbaa9e44c9567855a6029332c Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Mon, 10 Jan 2011 06:35:02 +0000 Subject: [PATCH 42/73] [range] - merge the tested changes from the trunk in preparation for the 1.46 release. [SVN r67905] --- doc/boost_range.qbk | 2 + doc/html/index.html | 5 +- doc/html/quickbook_HTML.manifest | 2 + .../range/concepts/bidirectional_range.html | 16 +- doc/html/range/concepts/concept_checking.html | 2 +- doc/html/range/concepts/forward_range.html | 10 +- .../range/concepts/random_access_range.html | 12 +- .../range/concepts/single_pass_range.html | 16 +- doc/html/range/history_ack.html | 4 +- doc/html/range/introduction.html | 6 +- doc/html/range/mfc_atl.html | 4 +- doc/html/range/reference.html | 1 + .../reference/adaptors/introduction.html | 6 +- .../range/reference/adaptors/reference.html | 1 + .../reference/adaptors/reference/strided.html | 10 +- .../adaptors/reference/tokenized.html | 6 +- .../adaptors/reference/type_erased.html | 305 +++++++++ .../reference/algorithms/heap/make_heap.html | 10 +- .../reference/algorithms/heap/pop_heap.html | 12 +- .../reference/algorithms/heap/push_heap.html | 12 +- .../reference/algorithms/heap/sort_heap.html | 12 +- .../reference/algorithms/mutating/copy.html | 12 +- .../algorithms/mutating/copy_backward.html | 12 +- .../reference/algorithms/mutating/fill.html | 10 +- .../reference/algorithms/mutating/fill_n.html | 10 +- .../algorithms/mutating/generate.html | 12 +- .../algorithms/mutating/inplace_merge.html | 16 +- .../reference/algorithms/mutating/merge.html | 16 +- .../algorithms/mutating/nth_element.html | 10 +- .../algorithms/mutating/partial_sort.html | 10 +- .../algorithms/mutating/partition.html | 10 +- .../algorithms/mutating/random_shuffle.html | 12 +- .../reference/algorithms/mutating/remove.html | 10 +- .../algorithms/mutating/remove_copy.html | 10 +- .../algorithms/mutating/remove_copy_if.html | 10 +- .../algorithms/mutating/remove_if.html | 10 +- .../algorithms/mutating/replace.html | 10 +- .../algorithms/mutating/replace_copy.html | 10 +- .../algorithms/mutating/replace_copy_if.html | 10 +- .../algorithms/mutating/replace_if.html | 10 +- .../algorithms/mutating/reverse.html | 10 +- .../algorithms/mutating/reverse_copy.html | 10 +- .../reference/algorithms/mutating/rotate.html | 12 +- .../algorithms/mutating/rotate_copy.html | 12 +- .../reference/algorithms/mutating/sort.html | 10 +- .../algorithms/mutating/stable_partition.html | 10 +- .../algorithms/mutating/stable_sort.html | 10 +- .../algorithms/mutating/swap_ranges.html | 10 +- .../algorithms/mutating/transform.html | 12 +- .../reference/algorithms/mutating/unique.html | 10 +- .../algorithms/mutating/unique_copy.html | 10 +- .../reference/algorithms/new/copy_n.html | 10 +- .../range/reference/algorithms/new/erase.html | 10 +- .../reference/algorithms/new/for_each.html | 10 +- .../reference/algorithms/new/insert.html | 10 +- .../range/reference/algorithms/new/iota.html | 10 +- .../reference/algorithms/new/is_sorted.html | 10 +- .../reference/algorithms/new/overwrite.html | 10 +- .../reference/algorithms/new/push_back.html | 10 +- .../reference/algorithms/new/push_front.html | 10 +- .../algorithms/new/remove_erase.html | 10 +- .../algorithms/new/remove_erase_if.html | 10 +- .../non_mutating/adjacent_find.html | 10 +- .../non_mutating/binary_search.html | 12 +- .../algorithms/non_mutating/count.html | 10 +- .../algorithms/non_mutating/count_if.html | 10 +- .../algorithms/non_mutating/equal.html | 10 +- .../algorithms/non_mutating/equal_range.html | 12 +- .../algorithms/non_mutating/find.html | 10 +- .../algorithms/non_mutating/find_end.html | 10 +- .../non_mutating/find_first_of.html | 10 +- .../algorithms/non_mutating/find_if.html | 12 +- .../algorithms/non_mutating/for_each.html | 10 +- .../non_mutating/lexicographical_compare.html | 10 +- .../algorithms/non_mutating/lower_bound.html | 12 +- .../algorithms/non_mutating/max_element.html | 10 +- .../algorithms/non_mutating/min_element.html | 10 +- .../algorithms/non_mutating/mismatch.html | 12 +- .../algorithms/non_mutating/search.html | 10 +- .../algorithms/non_mutating/search_n.html | 10 +- .../algorithms/non_mutating/upper_bound.html | 12 +- .../algorithms/numeric/accumulate.html | 14 +- .../numeric/adjacent_difference.html | 16 +- .../algorithms/numeric/inner_product.html | 16 +- .../algorithms/numeric/partial_sum.html | 16 +- .../permutation/next_permutation.html | 10 +- .../permutation/prev_permutation.html | 10 +- .../reference/algorithms/set/includes.html | 12 +- .../algorithms/set/set_difference.html | 12 +- .../algorithms/set/set_intersection.html | 12 +- .../set/set_symmetric_difference.html | 12 +- .../reference/algorithms/set/set_union.html | 12 +- .../concept_implementation/semantics.html | 2 +- .../semantics/functions.html | 25 +- doc/html/range/reference/ranges.html | 7 +- .../range/reference/ranges/any_range.html | 177 ++++++ .../reference/ranges/counting_range.html | 14 +- doc/html/range/reference/ranges/irange.html | 10 +- .../range/reference/ranges/istream_range.html | 6 +- .../reference/utilities/iterator_range.html | 6 +- doc/html/range/reference/utilities/join.html | 4 +- .../range/reference/utilities/sub_range.html | 2 +- doc/reference/adaptors.qbk | 1 + doc/reference/adaptors/strided.qbk | 2 +- doc/reference/adaptors/type_erased.qbk | 151 +++++ doc/reference/ranges.qbk | 1 + doc/reference/ranges/any_range.qbk | 115 ++++ doc/reference/semantics.qbk | 4 +- include/boost/range/adaptor/sliced.hpp | 1 + include/boost/range/adaptor/strided.hpp | 303 ++++++--- include/boost/range/adaptor/type_erased.hpp | 218 +++++-- include/boost/range/any_range.hpp | 204 ++++++ include/boost/range/begin.hpp | 23 +- include/boost/range/concepts.hpp | 23 +- include/boost/range/detail/any_iterator.hpp | 587 +++++++++++++++++ .../range/detail/any_iterator_buffer.hpp | 117 ++++ .../range/detail/any_iterator_interface.hpp | 258 ++++++++ .../range/detail/any_iterator_wrapper.hpp | 590 ++++++++++++++++++ include/boost/range/detail/begin.hpp | 28 +- include/boost/range/detail/end.hpp | 37 +- include/boost/range/detail/safe_bool.hpp | 72 +++ include/boost/range/end.hpp | 23 +- include/boost/range/iterator_range_core.hpp | 20 +- include/boost/range/size.hpp | 35 +- test/Jamfile.v2 | 4 + test/adaptor_test/strided.cpp | 16 +- test/adaptor_test/type_erased.cpp | 481 ++++++++++++++ test/adaptor_test/type_erased_example.cpp | 115 ++++ test/algorithm_test/count_if.cpp | 7 +- test/algorithm_test/find.cpp | 127 ++-- test/algorithm_test/find_end.cpp | 281 +++++---- test/algorithm_test/find_first_of.cpp | 271 ++++---- test/algorithm_test/find_if.cpp | 161 +++-- test/algorithm_test/lower_bound.cpp | 274 ++++---- test/algorithm_test/max_element.cpp | 213 ++++--- test/algorithm_test/min_element.cpp | 211 +++---- test/algorithm_test/partition.cpp | 165 +++-- test/algorithm_test/stable_partition.cpp | 172 +++-- test/algorithm_test/unique.cpp | 255 ++++---- test/algorithm_test/upper_bound.cpp | 259 ++++---- test/begin.cpp | 119 ++++ test/end.cpp | 119 ++++ test/extension_size.cpp | 52 +- 143 files changed, 5587 insertions(+), 2015 deletions(-) create mode 100644 doc/html/range/reference/adaptors/reference/type_erased.html create mode 100644 doc/html/range/reference/ranges/any_range.html create mode 100644 doc/reference/adaptors/type_erased.qbk create mode 100644 doc/reference/ranges/any_range.qbk create mode 100644 include/boost/range/any_range.hpp create mode 100644 include/boost/range/detail/any_iterator.hpp create mode 100644 include/boost/range/detail/any_iterator_buffer.hpp create mode 100644 include/boost/range/detail/any_iterator_interface.hpp create mode 100644 include/boost/range/detail/any_iterator_wrapper.hpp mode change 100755 => 100644 include/boost/range/detail/begin.hpp mode change 100755 => 100644 include/boost/range/detail/end.hpp create mode 100644 include/boost/range/detail/safe_bool.hpp create mode 100644 test/adaptor_test/type_erased.cpp create mode 100644 test/adaptor_test/type_erased_example.cpp create mode 100644 test/begin.cpp create mode 100644 test/end.cpp diff --git a/doc/boost_range.qbk b/doc/boost_range.qbk index 80bbf06..be09bc6 100644 --- a/doc/boost_range.qbk +++ b/doc/boost_range.qbk @@ -78,6 +78,7 @@ [def __range_adaptors_reversed__ [link range.reference.adaptors.reference.reversed reversed]] [def __range_adaptors_sliced__ [link range.reference.adaptors.reference.sliced sliced]] [def __range_adaptors_strided__ [link range.reference.adaptors.reference.strided strided]] +[def __range_adaptors_type_erased__ [link range.reference.adaptors.reference.type_erased type_erased]] [def __range_adaptors_tokenized__ [link range.reference.adaptors.reference.tokenized tokenized]] [def __range_adaptors_transformed__ [link range.reference.adaptors.reference.transformed transformed]] [def __range_adaptors_uniqued__ [link range.reference.adaptors.reference.uniqued uniqued]] @@ -174,6 +175,7 @@ [def __sgi_inner_product__ [@http://www.sgi.com/tech/stl/inner_product.html inner_product]] [def __sgi_partial_sum__ [@http://www.sgi.com/tech/stl/partial_sum.html partial_sum]] +[def __type_erasure_article__ [@http://www.artima.com/cppsource/type_erasure.html type erasure article]] Boost.Range is a collection of concepts and utilities, range-based algorithms, as well as range adaptors that allow for efficient and expressive code. diff --git a/doc/html/index.html b/doc/html/index.html index 8b74c06..1be23d5 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -30,7 +30,7 @@

    -

    +

    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)

    @@ -82,6 +82,7 @@
    Provided Ranges
    +
    any_range
    counting_range
    istream_range
    irange
    @@ -143,7 +144,7 @@

    - +

    Last revised: December 23, 2010 at 17:58:25 GMT

    Last revised: January 01, 2011 at 16:31:27 GMT


    diff --git a/doc/html/quickbook_HTML.manifest b/doc/html/quickbook_HTML.manifest index b12e40e..1b32f72 100644 --- a/doc/html/quickbook_HTML.manifest +++ b/doc/html/quickbook_HTML.manifest @@ -30,6 +30,7 @@ range/reference/adaptors/reference/replaced_if.html range/reference/adaptors/reference/reversed.html range/reference/adaptors/reference/sliced.html range/reference/adaptors/reference/strided.html +range/reference/adaptors/reference/type_erased.html range/reference/adaptors/reference/tokenized.html range/reference/adaptors/reference/transformed.html range/reference/adaptors/reference/uniqued.html @@ -118,6 +119,7 @@ range/reference/algorithms/numeric/adjacent_difference.html range/reference/algorithms/numeric/inner_product.html range/reference/algorithms/numeric/partial_sum.html range/reference/ranges.html +range/reference/ranges/any_range.html range/reference/ranges/counting_range.html range/reference/ranges/istream_range.html range/reference/ranges/irange.html diff --git a/doc/html/range/concepts/bidirectional_range.html b/doc/html/range/concepts/bidirectional_range.html index ba06db0..6e3dc8c 100644 --- a/doc/html/range/concepts/bidirectional_range.html +++ b/doc/html/range/concepts/bidirectional_range.html @@ -27,7 +27,7 @@ Bidirectional Range
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -75,7 +75,7 @@ Traversal Iterator.

    - + Refinement of
    @@ -83,7 +83,7 @@ Forward Range

    - + Associated types
    @@ -136,7 +136,7 @@
    - + Valid expressions
    @@ -221,7 +221,7 @@
    - + Complexity guarantees
    @@ -232,7 +232,7 @@ Forward Range.

    - + Invariants
    @@ -272,7 +272,7 @@
    - + See also

    diff --git a/doc/html/range/concepts/concept_checking.html b/doc/html/range/concepts/concept_checking.html index db21dbb..20a2fbb 100644 --- a/doc/html/range/concepts/concept_checking.html +++ b/doc/html/range/concepts/concept_checking.html @@ -79,7 +79,7 @@

    - + See also

    diff --git a/doc/html/range/concepts/forward_range.html b/doc/html/range/concepts/forward_range.html index 95b7dac..7937f8c 100644 --- a/doc/html/range/concepts/forward_range.html +++ b/doc/html/range/concepts/forward_range.html @@ -27,7 +27,7 @@ Forward Range

    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -73,14 +73,14 @@ Traversal Iterator.

    - + Refinement of

    Single Pass Range

    - + Associated types
    @@ -132,7 +132,7 @@
    - + See also

    diff --git a/doc/html/range/concepts/random_access_range.html b/doc/html/range/concepts/random_access_range.html index fa49539..3124ddc 100644 --- a/doc/html/range/concepts/random_access_range.html +++ b/doc/html/range/concepts/random_access_range.html @@ -27,7 +27,7 @@ Random Access Range

    - + Description

    @@ -35,7 +35,7 @@ Access Traversal Iterator.

    - + Refinement of
    @@ -43,7 +43,7 @@ Bidirectional Range

    - + Valid expressions
    @@ -89,7 +89,7 @@
    - + Expression semantics
    @@ -139,7 +139,7 @@
    - + Complexity guarantees
    @@ -147,7 +147,7 @@ boost::size(a) completes in amortized constant time.

    - + Invariants
    diff --git a/doc/html/range/concepts/single_pass_range.html b/doc/html/range/concepts/single_pass_range.html index a9acb72..273692a 100644 --- a/doc/html/range/concepts/single_pass_range.html +++ b/doc/html/range/concepts/single_pass_range.html @@ -27,7 +27,7 @@ Single Pass Range
    - + Notation
    @@ -65,7 +65,7 @@
    - + Description

    @@ -73,7 +73,7 @@ Pass Iterator.

    - + Associated types
    @@ -126,7 +126,7 @@
    - + Valid expressions
    @@ -198,7 +198,7 @@
    - + Expression semantics
    @@ -266,7 +266,7 @@
    - + Complexity guarantees
    @@ -276,7 +276,7 @@ constant time.

    - + Invariants
    @@ -316,7 +316,7 @@
    - + See also

    diff --git a/doc/html/range/history_ack.html b/doc/html/range/history_ack.html index 8c99a63..49355b5 100644 --- a/doc/html/range/history_ack.html +++ b/doc/html/range/history_ack.html @@ -26,7 +26,7 @@ History and Acknowledgement

    - + Version 1 - before Boost 1.43

    @@ -79,7 +79,7 @@ The concept checks and their documentation was provided by Daniel Walker.

    - + Version 2 - Boost 1.43 and beyond

    diff --git a/doc/html/range/introduction.html b/doc/html/range/introduction.html index 07af796..a68d315 100644 --- a/doc/html/range/introduction.html +++ b/doc/html/range/introduction.html @@ -70,7 +70,7 @@

    - + Example - Iterate over the values in a map

    @@ -84,7 +84,7 @@

    - + Example - Iterate over the keys in a map

    @@ -98,7 +98,7 @@

    - + Example - Push the even values from a map in reverse order into the container target

    diff --git a/doc/html/range/mfc_atl.html b/doc/html/range/mfc_atl.html index 91938cc..2ca51fd 100644 --- a/doc/html/range/mfc_atl.html +++ b/doc/html/range/mfc_atl.html @@ -34,7 +34,7 @@
    References
    - + Introduction

    @@ -100,7 +100,7 @@

    - + Overview

    diff --git a/doc/html/range/reference.html b/doc/html/range/reference.html index f8246fb..50f6ed0 100644 --- a/doc/html/range/reference.html +++ b/doc/html/range/reference.html @@ -58,6 +58,7 @@

    Provided Ranges
    +
    any_range
    counting_range
    istream_range
    irange
    diff --git a/doc/html/range/reference/adaptors/introduction.html b/doc/html/range/reference/adaptors/introduction.html index d3e606b..4991499 100644 --- a/doc/html/range/reference/adaptors/introduction.html +++ b/doc/html/range/reference/adaptors/introduction.html @@ -122,7 +122,7 @@ situations, you will really appreciate the succinctness of operator|().

    - + Composition of Adaptors
    @@ -169,7 +169,7 @@ is the design solution to this problem.

    - + Range Adaptor alternative to copy_if algorithm
    @@ -186,7 +186,7 @@

    - + Range Adaptor alternative to count_if algorithm
    diff --git a/doc/html/range/reference/adaptors/reference.html b/doc/html/range/reference/adaptors/reference.html index dffb6fe..4e5b99a 100644 --- a/doc/html/range/reference/adaptors/reference.html +++ b/doc/html/range/reference/adaptors/reference.html @@ -39,6 +39,7 @@
    reversed
    sliced
    strided
    +
    type_erased
    tokenized
    transformed
    uniqued
    diff --git a/doc/html/range/reference/adaptors/reference/strided.html b/doc/html/range/reference/adaptors/reference/strided.html index e79f8cf..592b83e 100644 --- a/doc/html/range/reference/adaptors/reference/strided.html +++ b/doc/html/range/reference/adaptors/reference/strided.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    @@ -77,9 +77,7 @@
    • Precondition: 0 - <= n - and boost::size(rng) - is a valid expression. + <= n.
    • Returns: A new range based on rng where traversal is performed @@ -145,7 +143,7 @@
      -PrevUpHomeNext +PrevUpHomeNext
      diff --git a/doc/html/range/reference/adaptors/reference/tokenized.html b/doc/html/range/reference/adaptors/reference/tokenized.html index 242fbc2..2dfa506 100644 --- a/doc/html/range/reference/adaptors/reference/tokenized.html +++ b/doc/html/range/reference/adaptors/reference/tokenized.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
      -PrevUpHomeNext +PrevUpHomeNext
      @@ -149,7 +149,7 @@
      -PrevUpHomeNext +PrevUpHomeNext
      diff --git a/doc/html/range/reference/adaptors/reference/type_erased.html b/doc/html/range/reference/adaptors/reference/type_erased.html new file mode 100644 index 0000000..87649ee --- /dev/null +++ b/doc/html/range/reference/adaptors/reference/type_erased.html @@ -0,0 +1,305 @@ + + + +type_erased + + + + + + + + + + + + + + + +
      Boost C++ LibrariesHomeLibrariesPeopleFAQMore
      +
      +
      +PrevUpHomeNext +
      +
      + + +
      ++++ + + + + + + + + + + + + + + +
      +

      + Syntax +

      +
      +

      + Code +

      +
      +

      + Pipe +

      +
      +

      + rng | + boost::adaptors::type_erased<Value, + Traversal, + Reference, + Difference, + Buffer>() +

      +
      +

      + Function +

      +
      +

      + boost::adaptors::type_erase(rng, + boost::adaptors::type_erased<Value, + Traversal, + Reference, + Difference, + Buffer>) +

      +
      +

      + Please note that it is frequently unnecessary to use the type_erased adaptor. It is often better + to use the implicit conversion to any_range. +

      +

      + Let Rng be the type of + rng. +

      +
        +
      • +

        + Template parameters: +

        +
          +
        • + Value is the + value_type for + the any_range. + If this is set to boost::use_default, Value + will be calculated from the range type when the adaptor is applied. +
        • +
        • + Traversal is + the tag used to identify the traversal of the resultant range. + Frequently it is desireable to set a traversal category lower + than the source container or range to maximize the number of + ranges that can convert to the any_range. + If this is left as boost::use_default then Traversal + will be typename boost::iterator_traversal<boost::range_iterator<Rng>::type>::type +
        • +
        • + Reference is + the reference + for the any_range. + boost::use_default will equate to + typename range_reference<Rng>::type. +
        • +
        • + Difference is + the difference_type + for the any_range. boost::use_default + will equate to typename + boost::range_difference<Rng>::type +
        • +
        • + Buffer is the + storage used to allocate the underlying iterator wrappers. This + can typically be ignored, but is available as a template parameter + for customization. Buffer must be a model of the AnyIteratorBufferConcept. +
        • +
        +
      • +
      • + Precondition: Traversal + is one of { boost::use_default, boost::single_pass_traversal_tag, boost::forward_traversal_tag, boost::bidirectional_traversal_tag, boost::random_access_traversal_tag + } +
      • +
      • + Returns: The returned value is the + same as typename any_range_type_generator< Rng, Value, Traversal, Reference, Difference, Buffer + > that represents rng in a type-erased manner. +
      • +
      • + Range Category: Single + Pass Range +
      • +
      • + Returned Range Category: if Traversal was specified as boost::use_default then typename boost::iterator_traversal<boost::range_iterator<Rng>::type>::type, + otherwise Traversal. +
      • +
      +
      + + AnyIteratorBufferConcept +
      +

      + +

      +
      class AnyIteratorBufferConcept
      +{
      +public:
      +    AnyIteratorBufferConcept();
      +    ~AnyIteratorBufferConcept();
      +
      +    // bytes is the requested size to allocate. This function
      +    // must return a pointer to an adequate area of memory.
      +    // throws: bad_alloc
      +    //
      +    // The buffer will only ever have zero or one
      +    // outstanding memory allocations.
      +    void* allocate(std::size_t bytes);
      +
      +    // deallocate this buffer
      +    void deallocate();
      +};
      +
      +

      +

      +
      + +

      + +

      +
      #include <boost/range/adaptor/type_erased.hpp>
      +#include <boost/range/algorithm/copy.hpp>
      +#include <boost/assign.hpp>
      +#include <boost/foreach.hpp>
      +#include <algorithm>
      +#include <iostream>
      +#include <list>
      +#include <vector>
      +
      +// The client interface from an OO perspective merely requires a sequence
      +// of integers that can be forward traversed
      +typedef boost::any_range<
      +    int
      +  , boost::forward_traversal_tag
      +  , int
      +  , std::ptrdiff_t
      +> integer_range;
      +
      +namespace server
      +{
      +    void display_integers(const integer_range& rng)
      +    {
      +        boost::copy(rng,
      +                    std::ostream_iterator<int>(std::cout, ","));
      +
      +        std::cout << std::endl;
      +    }
      +}
      +
      +namespace client
      +{
      +    void run()
      +    {
      +        using namespace boost::assign;
      +        using namespace boost::adaptors;
      +
      +        // Under most conditions one would simply use an appropriate
      +        // any_range as a function parameter. The type_erased adaptor
      +        // is often superfluous. However because the type_erased
      +        // adaptor is applied to a range, we can use default template
      +        // arguments that are generated in conjunction with the
      +        // range type to which we are applying the adaptor.
      +
      +        std::vector<int> input;
      +        input += 1,2,3,4,5;
      +
      +        // Note that this call is to a non-template function
      +        server::display_integers(input);
      +
      +        std::list<int> input2;
      +        input2 += 6,7,8,9,10;
      +
      +        // Note that this call is to the same non-tempate function
      +        server::display_integers(input2);
      +
      +        input2.clear();
      +        input2 += 11,12,13,14,15;
      +
      +        // Calling using the adaptor looks like this:
      +        // Notice that here I have a type_erased that would be a
      +        // bidirectional_traversal_tag, but this is convertible
      +        // to the forward_traversal_tag equivalent hence this
      +        // works.
      +        server::display_integers(input2 | type_erased<>());
      +
      +        // However we may simply wish to define an adaptor that
      +        // takes a range and makes it into an appropriate
      +        // forward_traversal any_range...
      +        typedef boost::adaptors::type_erased<
      +            boost::use_default
      +          , boost::forward_traversal_tag
      +        > type_erased_forward;
      +
      +        // This adaptor can turn other containers with different
      +        // value_types and reference_types into the appropriate
      +        // any_range.
      +
      +        server::display_integers(input2 | type_erased_forward());
      +    }
      +}
      +
      +int main(int argc, const char* argv[])
      +{
      +    client::run();
      +    return 0;
      +}
      +
      +

      +

      +
      +

      + This would produce the output: +

      +
      1,2,3,4,5
      +6,7,8,9,10
      +11,12,13,14,15
      +11,12,13,14,15
      +
      +

      +

      +
      + + + +
      +
      +
      +PrevUpHomeNext +
      + + diff --git a/doc/html/range/reference/algorithms/heap/make_heap.html b/doc/html/range/reference/algorithms/heap/make_heap.html index a7a201c..3d4b6ec 100644 --- a/doc/html/range/reference/algorithms/heap/make_heap.html +++ b/doc/html/range/reference/algorithms/heap/make_heap.html @@ -27,7 +27,7 @@ make_heap
      - + Prototype

      @@ -48,7 +48,7 @@

      - + Description

      @@ -60,14 +60,14 @@ the predicate versions.

      - + Definition

      Defined in the header file boost/range/algorithm/heap_algorithm.hpp

      - + Requirements

      @@ -118,7 +118,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap/pop_heap.html b/doc/html/range/reference/algorithms/heap/pop_heap.html index 4926fa5..d8f0283 100644 --- a/doc/html/range/reference/algorithms/heap/pop_heap.html +++ b/doc/html/range/reference/algorithms/heap/pop_heap.html @@ -27,7 +27,7 @@ pop_heap

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -62,14 +62,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -120,7 +120,7 @@

    - + Precondition:
      @@ -132,7 +132,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap/push_heap.html b/doc/html/range/reference/algorithms/heap/push_heap.html index 976aece..4223024 100644 --- a/doc/html/range/reference/algorithms/heap/push_heap.html +++ b/doc/html/range/reference/algorithms/heap/push_heap.html @@ -27,7 +27,7 @@ push_heap

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -62,14 +62,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -120,7 +120,7 @@

    - + Precondition:
      @@ -132,7 +132,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/heap/sort_heap.html b/doc/html/range/reference/algorithms/heap/sort_heap.html index 4366d76..7667438 100644 --- a/doc/html/range/reference/algorithms/heap/sort_heap.html +++ b/doc/html/range/reference/algorithms/heap/sort_heap.html @@ -27,7 +27,7 @@ sort_heap

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -61,14 +61,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/heap_algorithm.hpp

    - + Requirements

    @@ -119,14 +119,14 @@

    - + Precondition:

    rng is a heap.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/copy.html b/doc/html/range/reference/algorithms/mutating/copy.html index bfa49dc..fd096ff 100644 --- a/doc/html/range/reference/algorithms/mutating/copy.html +++ b/doc/html/range/reference/algorithms/mutating/copy.html @@ -27,7 +27,7 @@ copy

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -50,14 +50,14 @@ distance(source_rng)

    - + Definition

    Defined in the header file boost/range/algorithm/copy.hpp

    - + Requirements
      @@ -78,7 +78,7 @@
    - + Precondition:
      @@ -92,7 +92,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/copy_backward.html b/doc/html/range/reference/algorithms/mutating/copy_backward.html index 2c79bf9..29139c1 100644 --- a/doc/html/range/reference/algorithms/mutating/copy_backward.html +++ b/doc/html/range/reference/algorithms/mutating/copy_backward.html @@ -27,7 +27,7 @@ copy_backward

    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -59,14 +59,14 @@ denotes the end of the output sequence.

    - + Definition

    Defined in the header file boost/range/algorithm/copy_backward.hpp

    - + Requirements
      @@ -87,7 +87,7 @@
    - + Precondition:
      @@ -101,7 +101,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/fill.html b/doc/html/range/reference/algorithms/mutating/fill.html index 77c78c6..ea3fec4 100644 --- a/doc/html/range/reference/algorithms/mutating/fill.html +++ b/doc/html/range/reference/algorithms/mutating/fill.html @@ -27,7 +27,7 @@ fill

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -48,14 +48,14 @@ in the range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/fill.hpp

    - + Requirements
      @@ -78,7 +78,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/fill_n.html b/doc/html/range/reference/algorithms/mutating/fill_n.html index 5a7fb40..56594c9 100644 --- a/doc/html/range/reference/algorithms/mutating/fill_n.html +++ b/doc/html/range/reference/algorithms/mutating/fill_n.html @@ -27,7 +27,7 @@ fill_n

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -47,14 +47,14 @@ val to n elements in the range rng begining with boost::begin(rng).

    - + Definition

    Defined in the header file boost/range/algorithm/fill_n.hpp

    - + Requirements
      @@ -77,7 +77,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/generate.html b/doc/html/range/reference/algorithms/mutating/generate.html index d28c8ca..c4f568d 100644 --- a/doc/html/range/reference/algorithms/mutating/generate.html +++ b/doc/html/range/reference/algorithms/mutating/generate.html @@ -27,7 +27,7 @@ generate

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -52,14 +52,14 @@ Returns the resultant range.

    - + Definition

    Defined in the header file boost/range/algorithm/generate.hpp

    - + Requirements
      @@ -83,7 +83,7 @@
    - + Precondition:
      @@ -97,7 +97,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/inplace_merge.html b/doc/html/range/reference/algorithms/mutating/inplace_merge.html index a14c627..ced6655 100644 --- a/doc/html/range/reference/algorithms/mutating/inplace_merge.html +++ b/doc/html/range/reference/algorithms/mutating/inplace_merge.html @@ -27,7 +27,7 @@ inplace_merge

    - + Prototype

    @@ -58,7 +58,7 @@

    - + Description

    @@ -71,14 +71,14 @@ input range is preserved.

    - + Definition

    Defined in the header file boost/range/algorithm/inplace_merge.hpp

    - + Requirements

    @@ -115,11 +115,11 @@ argument types.

    - + Precondition:
    - + For the non-predicate version:
    @@ -142,7 +142,7 @@
    - + For the predicate version:
    @@ -163,7 +163,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/merge.html b/doc/html/range/reference/algorithms/mutating/merge.html index f847d5d..9d0ce89 100644 --- a/doc/html/range/reference/algorithms/mutating/merge.html +++ b/doc/html/range/reference/algorithms/mutating/merge.html @@ -27,7 +27,7 @@ merge

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -75,14 +75,14 @@ version uses the predicate instead of operator<().

    - + Definition

    Defined in the header file boost/range/algorithm/merge.hpp

    - + Requirements

    @@ -150,11 +150,11 @@

    - + Precondition:
    - + For the non-predicate version:
    @@ -194,7 +194,7 @@
    - + For the predicate version:
    @@ -230,7 +230,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/nth_element.html b/doc/html/range/reference/algorithms/mutating/nth_element.html index 624dfb2..16846cd 100644 --- a/doc/html/range/reference/algorithms/mutating/nth_element.html +++ b/doc/html/range/reference/algorithms/mutating/nth_element.html @@ -27,7 +27,7 @@ nth_element

    - + Prototype

    @@ -58,7 +58,7 @@

    - + Description

    @@ -69,14 +69,14 @@ is the same as the element that would be in that position if rng has been sorted.

    - + Definition

    Defined in the header file boost/range/algorithm/nth_element.hpp

    - + Requirements

    @@ -127,7 +127,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/partial_sort.html b/doc/html/range/reference/algorithms/mutating/partial_sort.html index 12a4024..33fb1df 100644 --- a/doc/html/range/reference/algorithms/mutating/partial_sort.html +++ b/doc/html/range/reference/algorithms/mutating/partial_sort.html @@ -27,7 +27,7 @@ partial_sort

    - + Prototype

    @@ -58,7 +58,7 @@

    - + Description

    @@ -74,14 +74,14 @@ predicate instead.

    - + Definition

    Defined in the header file boost/range/algorithm/partial_sort.hpp

    - + Requirements

    @@ -132,7 +132,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/partition.html b/doc/html/range/reference/algorithms/mutating/partition.html index 0cd0c73..d659dd4 100644 --- a/doc/html/range/reference/algorithms/mutating/partition.html +++ b/doc/html/range/reference/algorithms/mutating/partition.html @@ -27,7 +27,7 @@ partition

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -80,14 +80,14 @@ corresponds to the middle iterator.

    - + Definition

    Defined in the header file boost/range/algorithm/partition.hpp

    - + Requirements
      @@ -107,7 +107,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/random_shuffle.html b/doc/html/range/reference/algorithms/mutating/random_shuffle.html index f1a3c6c..8b8629d 100644 --- a/doc/html/range/reference/algorithms/mutating/random_shuffle.html +++ b/doc/html/range/reference/algorithms/mutating/random_shuffle.html @@ -27,7 +27,7 @@ random_shuffle

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -60,14 +60,14 @@ the shuffles range.

    - + Definition

    Defined in the header file boost/range/algorithm/random_shuffle.hpp

    - + Requirements

    @@ -98,7 +98,7 @@

    - + Precondition:
    • @@ -107,7 +107,7 @@ maximum value.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/remove.html b/doc/html/range/reference/algorithms/mutating/remove.html index 618d087..172fd87 100644 --- a/doc/html/range/reference/algorithms/mutating/remove.html +++ b/doc/html/range/reference/algorithms/mutating/remove.html @@ -27,7 +27,7 @@ remove

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -83,14 +83,14 @@ are dereferenceable, but the elements are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove.hpp

    - + Requirements
      @@ -113,7 +113,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/remove_copy.html b/doc/html/range/reference/algorithms/mutating/remove_copy.html index 410848d..a5aff6b 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_copy.html +++ b/doc/html/range/reference/algorithms/mutating/remove_copy.html @@ -27,7 +27,7 @@ remove_copy

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,14 +53,14 @@ rng for which x == val is false.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_copy.hpp

    - + Requirements
      @@ -83,7 +83,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/remove_copy_if.html b/doc/html/range/reference/algorithms/mutating/remove_copy_if.html index ed95b13..4763181 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_copy_if.html +++ b/doc/html/range/reference/algorithms/mutating/remove_copy_if.html @@ -27,7 +27,7 @@ remove_copy_if

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -54,14 +54,14 @@ is false.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_copy_if.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/remove_if.html b/doc/html/range/reference/algorithms/mutating/remove_if.html index 113d9dd..59aebc2 100644 --- a/doc/html/range/reference/algorithms/mutating/remove_if.html +++ b/doc/html/range/reference/algorithms/mutating/remove_if.html @@ -27,7 +27,7 @@ remove_if

    - + Prototype

    @@ -66,7 +66,7 @@

    - + Description

    @@ -82,14 +82,14 @@ are unspecified.

    - + Definition

    Defined in the header file boost/range/algorithm/remove_if.hpp

    - + Requirements
      @@ -112,7 +112,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/replace.html b/doc/html/range/reference/algorithms/mutating/replace.html index 9055f9a..b392c50 100644 --- a/doc/html/range/reference/algorithms/mutating/replace.html +++ b/doc/html/range/reference/algorithms/mutating/replace.html @@ -27,7 +27,7 @@ replace

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -57,14 +57,14 @@ Return a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace.hpp

    - + Requirements
      @@ -93,7 +93,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/replace_copy.html b/doc/html/range/reference/algorithms/mutating/replace_copy.html index 267f594..1784235 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_copy.html +++ b/doc/html/range/reference/algorithms/mutating/replace_copy.html @@ -27,7 +27,7 @@ replace_copy

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -53,14 +53,14 @@ x.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_copy.hpp

    - + Requirements
      @@ -87,7 +87,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/replace_copy_if.html b/doc/html/range/reference/algorithms/mutating/replace_copy_if.html index b053c1e..d4d3be2 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_copy_if.html +++ b/doc/html/range/reference/algorithms/mutating/replace_copy_if.html @@ -27,7 +27,7 @@ replace_copy_if

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -51,14 +51,14 @@ : x.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_copy_if.hpp

    - + Requirements
      @@ -89,7 +89,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/replace_if.html b/doc/html/range/reference/algorithms/mutating/replace_if.html index f63c30e..1e6609b 100644 --- a/doc/html/range/reference/algorithms/mutating/replace_if.html +++ b/doc/html/range/reference/algorithms/mutating/replace_if.html @@ -27,7 +27,7 @@ replace_if

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -51,14 +51,14 @@ Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/replace_if.hpp

    - + Requirements
      @@ -90,7 +90,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/reverse.html b/doc/html/range/reference/algorithms/mutating/reverse.html index 2e8262b..6907fe5 100644 --- a/doc/html/range/reference/algorithms/mutating/reverse.html +++ b/doc/html/range/reference/algorithms/mutating/reverse.html @@ -27,7 +27,7 @@ reverse

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -50,14 +50,14 @@ Returns a reference to the reversed range.

    - + Definition

    Defined in the header file boost/range/algorithm/reverse.hpp

    - + Requirements
      @@ -72,7 +72,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/reverse_copy.html b/doc/html/range/reference/algorithms/mutating/reverse_copy.html index ea0d3e9..b0c9624 100644 --- a/doc/html/range/reference/algorithms/mutating/reverse_copy.html +++ b/doc/html/range/reference/algorithms/mutating/reverse_copy.html @@ -27,7 +27,7 @@ reverse_copy

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -49,14 +49,14 @@ Returns the output iterator one passed the last copied element.

    - + Definition

    Defined in the header file boost/range/algorithm/reverse_copy.hpp

    - + Requirements
      @@ -75,7 +75,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/rotate.html b/doc/html/range/reference/algorithms/mutating/rotate.html index 4b55abb..de9388a 100644 --- a/doc/html/range/reference/algorithms/mutating/rotate.html +++ b/doc/html/range/reference/algorithms/mutating/rotate.html @@ -27,7 +27,7 @@ rotate

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -53,14 +53,14 @@ and [middle, end(rng)). Returns a reference to rng.

    - + Definition

    Defined in the header file boost/range/algorithm/rotate.hpp

    - + Requirements
      @@ -74,7 +74,7 @@
    - + Precondition:
      @@ -86,7 +86,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/rotate_copy.html b/doc/html/range/reference/algorithms/mutating/rotate_copy.html index 497fa1d..fbecb94 100644 --- a/doc/html/range/reference/algorithms/mutating/rotate_copy.html +++ b/doc/html/range/reference/algorithms/mutating/rotate_copy.html @@ -27,7 +27,7 @@ rotate_copy

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -51,14 +51,14 @@ and [middle, end(rng)) to out.

    - + Definition

    Defined in the header file boost/range/algorithm/rotate_copy.hpp

    - + Requirements
      @@ -76,7 +76,7 @@
    - + Precondition:
      @@ -88,7 +88,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/sort.html b/doc/html/range/reference/algorithms/mutating/sort.html index db9444b..aa9512c 100644 --- a/doc/html/range/reference/algorithms/mutating/sort.html +++ b/doc/html/range/reference/algorithms/mutating/sort.html @@ -27,7 +27,7 @@ sort

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -71,14 +71,14 @@ [x,y], pred(y, x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/sort.hpp

    - + Requirements

    @@ -129,7 +129,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/stable_partition.html b/doc/html/range/reference/algorithms/mutating/stable_partition.html index bd77f3c..c8dcd45 100644 --- a/doc/html/range/reference/algorithms/mutating/stable_partition.html +++ b/doc/html/range/reference/algorithms/mutating/stable_partition.html @@ -27,7 +27,7 @@ stable_partition

    - + Prototype

    @@ -60,7 +60,7 @@

    - + Description

    @@ -82,14 +82,14 @@ the iterator to the first element that fails to satisfy pred.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_partition.hpp

    - + Requirements
      @@ -107,7 +107,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/stable_sort.html b/doc/html/range/reference/algorithms/mutating/stable_sort.html index 6196114..e22f262 100644 --- a/doc/html/range/reference/algorithms/mutating/stable_sort.html +++ b/doc/html/range/reference/algorithms/mutating/stable_sort.html @@ -27,7 +27,7 @@ stable_sort

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -71,14 +71,14 @@ [x,y], pred(y,x) == false.

    - + Definition

    Defined in the header file boost/range/algorithm/stable_sort.hpp

    - + Requirements

    @@ -129,7 +129,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/swap_ranges.html b/doc/html/range/reference/algorithms/mutating/swap_ranges.html index 2e818ce..0e329dd 100644 --- a/doc/html/range/reference/algorithms/mutating/swap_ranges.html +++ b/doc/html/range/reference/algorithms/mutating/swap_ranges.html @@ -27,7 +27,7 @@ swap_ranges

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -49,14 +49,14 @@ Returns a reference to rng2.

    - + Definition

    Defined in the header file boost/range/algorithm/swap_ranges.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/transform.html b/doc/html/range/reference/algorithms/mutating/transform.html index 068db05..77a319c 100644 --- a/doc/html/range/reference/algorithms/mutating/transform.html +++ b/doc/html/range/reference/algorithms/mutating/transform.html @@ -27,7 +27,7 @@ transform

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -92,14 +92,14 @@ The return value is out + min(distance(rng1), distance(rng2)).

    - + Definition

    Defined in the header file boost/range/algorithm/transform.hpp

    - + Requirements

    @@ -169,7 +169,7 @@

    - + Precondition:

    @@ -203,7 +203,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/unique.html b/doc/html/range/reference/algorithms/mutating/unique.html index e36cbfe..7aa3f2f 100644 --- a/doc/html/range/reference/algorithms/mutating/unique.html +++ b/doc/html/range/reference/algorithms/mutating/unique.html @@ -27,7 +27,7 @@ unique

    - + Prototype

    @@ -68,7 +68,7 @@

    - + Description

    @@ -86,14 +86,14 @@ type.

    - + Definition

    Defined in the header file boost/range/algorithm/unique.hpp

    - + Requirements

    @@ -137,7 +137,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/mutating/unique_copy.html b/doc/html/range/reference/algorithms/mutating/unique_copy.html index 432191e..cd4a014 100644 --- a/doc/html/range/reference/algorithms/mutating/unique_copy.html +++ b/doc/html/range/reference/algorithms/mutating/unique_copy.html @@ -27,7 +27,7 @@ unique_copy

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -55,14 +55,14 @@ value type.

    - + Definition

    Defined in the header file boost/range/algorithm/unique_copy.hpp

    - + Requirements

    @@ -116,7 +116,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/copy_n.html b/doc/html/range/reference/algorithms/new/copy_n.html index dedfad3..d7ce746 100644 --- a/doc/html/range/reference/algorithms/new/copy_n.html +++ b/doc/html/range/reference/algorithms/new/copy_n.html @@ -27,7 +27,7 @@ copy_n

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -53,14 +53,14 @@ from [boost::begin(rng), boost::begin(rng) + n) to the range [out, out + n)

    - + Definition

    Defined in the header file boost/range/algorithm_ext/copy_n.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/erase.html b/doc/html/range/reference/algorithms/new/erase.html index ef49c5f..dffd697 100644 --- a/doc/html/range/reference/algorithms/new/erase.html +++ b/doc/html/range/reference/algorithms/new/erase.html @@ -27,7 +27,7 @@ erase

    - + Prototype

    @@ -41,7 +41,7 @@

    - + Description

    @@ -58,14 +58,14 @@ the frequently used combination equivalent to target.erase(std::remove_if(target.begin(), target.end(), pred), target.end());

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. @@ -73,7 +73,7 @@ erase of an iterator range.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/for_each.html b/doc/html/range/reference/algorithms/new/for_each.html index 15ec17b..58885de 100644 --- a/doc/html/range/reference/algorithms/new/for_each.html +++ b/doc/html/range/reference/algorithms/new/for_each.html @@ -27,7 +27,7 @@ for_each

    - + Prototype

    @@ -72,7 +72,7 @@

    - + Description

    @@ -88,14 +88,14 @@ It is safe to call this function with unequal length ranges.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/for_each.hpp

    - + Requirements
      @@ -125,7 +125,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/insert.html b/doc/html/range/reference/algorithms/new/insert.html index dec9b6a..e702ab7 100644 --- a/doc/html/range/reference/algorithms/new/insert.html +++ b/doc/html/range/reference/algorithms/new/insert.html @@ -27,7 +27,7 @@ insert

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -54,14 +54,14 @@ target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/insert.hpp

    - + Requirements
      @@ -81,7 +81,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/iota.html b/doc/html/range/reference/algorithms/new/iota.html index b3c8c06..47054f4 100644 --- a/doc/html/range/reference/algorithms/new/iota.html +++ b/doc/html/range/reference/algorithms/new/iota.html @@ -27,7 +27,7 @@ iota

    - + Prototype

    @@ -39,7 +39,7 @@

    - + Description

    @@ -50,14 +50,14 @@ + boost::distance(boost::begin(rng), it)

    - + Definition

    Defined in the header file boost/range/algorithm_ext/iota.hpp

    - + Requirements
      @@ -73,7 +73,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/is_sorted.html b/doc/html/range/reference/algorithms/new/is_sorted.html index 93e9ee9..41d6bdc 100644 --- a/doc/html/range/reference/algorithms/new/is_sorted.html +++ b/doc/html/range/reference/algorithms/new/is_sorted.html @@ -27,7 +27,7 @@ is_sorted

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -58,14 +58,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/is_sorted.hpp

    - + Requirements
      @@ -85,7 +85,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/overwrite.html b/doc/html/range/reference/algorithms/new/overwrite.html index 914a4e8..7fa22b4 100644 --- a/doc/html/range/reference/algorithms/new/overwrite.html +++ b/doc/html/range/reference/algorithms/new/overwrite.html @@ -27,7 +27,7 @@ overwrite

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ into the range to.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/overwrite.hpp

    - + Requirements
      @@ -88,7 +88,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/push_back.html b/doc/html/range/reference/algorithms/new/push_back.html index 58dd060..a348b93 100644 --- a/doc/html/range/reference/algorithms/new/push_back.html +++ b/doc/html/range/reference/algorithms/new/push_back.html @@ -27,7 +27,7 @@ push_back

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ to the back of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_back.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/push_front.html b/doc/html/range/reference/algorithms/new/push_front.html index 8650468..ab4b48b 100644 --- a/doc/html/range/reference/algorithms/new/push_front.html +++ b/doc/html/range/reference/algorithms/new/push_front.html @@ -27,7 +27,7 @@ push_front

    - + Prototype

    @@ -43,7 +43,7 @@

    - + Description

    @@ -52,14 +52,14 @@ to the front of the container target.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/push_front.hpp

    - + Requirements
      @@ -79,7 +79,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/remove_erase.html b/doc/html/range/reference/algorithms/new/remove_erase.html index b28ecfe..e09216b 100644 --- a/doc/html/range/reference/algorithms/new/remove_erase.html +++ b/doc/html/range/reference/algorithms/new/remove_erase.html @@ -27,7 +27,7 @@ remove_erase

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -50,14 +50,14 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
    1. @@ -65,7 +65,7 @@ erase of an iterator range.
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/new/remove_erase_if.html b/doc/html/range/reference/algorithms/new/remove_erase_if.html index f66b732..bf13441 100644 --- a/doc/html/range/reference/algorithms/new/remove_erase_if.html +++ b/doc/html/range/reference/algorithms/new/remove_erase_if.html @@ -27,7 +27,7 @@ remove_erase_if

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -51,14 +51,14 @@ algorithm which merely rearranges elements.

    - + Definition

    Defined in the header file boost/range/algorithm_ext/erase.hpp

    - + Requirements
      @@ -72,7 +72,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html b/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html index b4e1ec3..d8489ad 100644 --- a/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html +++ b/doc/html/range/reference/algorithms/non_mutating/adjacent_find.html @@ -27,7 +27,7 @@ adjacent_find

    - + Prototype

    @@ -76,7 +76,7 @@

    - + Description

    @@ -97,14 +97,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/adjacent_find.hpp

    - + Requirements

    @@ -142,7 +142,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/binary_search.html b/doc/html/range/reference/algorithms/non_mutating/binary_search.html index b48a47e..2429e96 100644 --- a/doc/html/range/reference/algorithms/non_mutating/binary_search.html +++ b/doc/html/range/reference/algorithms/non_mutating/binary_search.html @@ -27,7 +27,7 @@ binary_search

    - + Prototype

    @@ -42,7 +42,7 @@

    - + Description

    @@ -52,14 +52,14 @@ range rng.

    - + Definition

    Defined in the header file boost/range/algorithm/binary_search.hpp

    - + Requirements

    @@ -110,7 +110,7 @@

    - + Precondition:

    @@ -128,7 +128,7 @@ order according to the function object pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/count.html b/doc/html/range/reference/algorithms/non_mutating/count.html index 75b364e..9ce79d3 100644 --- a/doc/html/range/reference/algorithms/non_mutating/count.html +++ b/doc/html/range/reference/algorithms/non_mutating/count.html @@ -27,7 +27,7 @@ count

    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -54,14 +54,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/count.hpp

    - + Requirements
      @@ -84,7 +84,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/count_if.html b/doc/html/range/reference/algorithms/non_mutating/count_if.html index b50203b..09b3f05 100644 --- a/doc/html/range/reference/algorithms/non_mutating/count_if.html +++ b/doc/html/range/reference/algorithms/non_mutating/count_if.html @@ -27,7 +27,7 @@ count_if

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -50,14 +50,14 @@ is true.

    - + Definition

    Defined in the header file boost/range/algorithm/count_if.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/equal.html b/doc/html/range/reference/algorithms/non_mutating/equal.html index d70859b..5b555bb 100644 --- a/doc/html/range/reference/algorithms/non_mutating/equal.html +++ b/doc/html/range/reference/algorithms/non_mutating/equal.html @@ -27,7 +27,7 @@ equal

    - + Prototype

    @@ -52,7 +52,7 @@

    - + Description

    @@ -70,14 +70,14 @@ considered equal in the predicate version if pred(x,y) is true.

    - + Definition

    Defined in the header file boost/range/algorithm/equal.hpp

    - + Requirements

    @@ -138,7 +138,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/equal_range.html b/doc/html/range/reference/algorithms/non_mutating/equal_range.html index 0594865..bc8ceb3 100644 --- a/doc/html/range/reference/algorithms/non_mutating/equal_range.html +++ b/doc/html/range/reference/algorithms/non_mutating/equal_range.html @@ -27,7 +27,7 @@ equal_range

    - + Prototype

    @@ -70,7 +70,7 @@

    - + Description

    @@ -84,14 +84,14 @@ is determined by pred.

    - + Definition

    Defined in the header file boost/range/algorithm/equal_range.hpp

    - + Requirements

    @@ -142,7 +142,7 @@

    - + Precondition:

    @@ -154,7 +154,7 @@ is ordered in ascending order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/find.html b/doc/html/range/reference/algorithms/non_mutating/find.html index 76086a8..0cdb415 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find.html +++ b/doc/html/range/reference/algorithms/non_mutating/find.html @@ -27,7 +27,7 @@ find

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -59,14 +59,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find.hpp

    - + Requirements
      @@ -87,7 +87,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_end.html b/doc/html/range/reference/algorithms/non_mutating/find_end.html index 95cb212..2381696 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_end.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_end.html @@ -27,7 +27,7 @@ find_end

    - + Prototype

    @@ -65,7 +65,7 @@

    - + Description

    @@ -80,14 +80,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_end.hpp

    - + Requirements

    @@ -147,7 +147,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_first_of.html b/doc/html/range/reference/algorithms/non_mutating/find_first_of.html index 2751651..6421a4d 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_first_of.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_first_of.html @@ -27,7 +27,7 @@ find_first_of

    - + Prototype

    @@ -65,7 +65,7 @@

    - + Description

    @@ -85,14 +85,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_first_of.hpp

    - + Requirements

    @@ -146,7 +146,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/find_if.html b/doc/html/range/reference/algorithms/non_mutating/find_if.html index 18d83c4..836b675 100644 --- a/doc/html/range/reference/algorithms/non_mutating/find_if.html +++ b/doc/html/range/reference/algorithms/non_mutating/find_if.html @@ -27,7 +27,7 @@ find_if

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -63,14 +63,14 @@ defines found in the same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/find_if.hpp

    - + Requirements
      @@ -89,7 +89,7 @@
    - + Precondition:

    @@ -97,7 +97,7 @@ rng, *i is in the domain of UnaryPredicate.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/for_each.html b/doc/html/range/reference/algorithms/non_mutating/for_each.html index b7f8384..daa7ec1 100644 --- a/doc/html/range/reference/algorithms/non_mutating/for_each.html +++ b/doc/html/range/reference/algorithms/non_mutating/for_each.html @@ -27,7 +27,7 @@ for_each

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -58,14 +58,14 @@ fun(x).

    - + Definition

    Defined in the header file boost/range/algorithm/for_each.hpp

    - + Requirements
      @@ -89,7 +89,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html b/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html index 25ace1b..704296a 100644 --- a/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html +++ b/doc/html/range/reference/algorithms/non_mutating/lexicographical_compare.html @@ -27,7 +27,7 @@ lexicographical_compare

    - + Prototype

    @@ -52,7 +52,7 @@

    - + Description

    @@ -72,14 +72,14 @@ predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/lexicographical_compare.hpp

    - + Requirements

    @@ -144,7 +144,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/lower_bound.html b/doc/html/range/reference/algorithms/non_mutating/lower_bound.html index b4419b1..b74ddd7 100644 --- a/doc/html/range/reference/algorithms/non_mutating/lower_bound.html +++ b/doc/html/range/reference/algorithms/non_mutating/lower_bound.html @@ -27,7 +27,7 @@ lower_bound

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -71,14 +71,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/lower_bound.hpp

    - + Requirements

    @@ -129,7 +129,7 @@

    - + Precondition:

    @@ -147,7 +147,7 @@ order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/max_element.html b/doc/html/range/reference/algorithms/non_mutating/max_element.html index 7202da9..52f7c53 100644 --- a/doc/html/range/reference/algorithms/non_mutating/max_element.html +++ b/doc/html/range/reference/algorithms/non_mutating/max_element.html @@ -27,7 +27,7 @@ max_element

    - + Prototype

    @@ -83,7 +83,7 @@

    - + Description

    @@ -97,14 +97,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/max_element.hpp

    - + Requirements

    @@ -141,7 +141,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/min_element.html b/doc/html/range/reference/algorithms/non_mutating/min_element.html index 50260c5..26cd301 100644 --- a/doc/html/range/reference/algorithms/non_mutating/min_element.html +++ b/doc/html/range/reference/algorithms/non_mutating/min_element.html @@ -27,7 +27,7 @@ min_element

    - + Prototype

    @@ -83,7 +83,7 @@

    - + Description

    @@ -97,14 +97,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/min_element.hpp

    - + Requirements

    @@ -141,7 +141,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/mismatch.html b/doc/html/range/reference/algorithms/non_mutating/mismatch.html index 30f2acd..cbfad8a 100644 --- a/doc/html/range/reference/algorithms/non_mutating/mismatch.html +++ b/doc/html/range/reference/algorithms/non_mutating/mismatch.html @@ -27,7 +27,7 @@ mismatch

    - + Prototype

    @@ -105,7 +105,7 @@

    - + Description

    @@ -117,14 +117,14 @@ Equality is determined by operator== for non-predicate versions of mismatch, and by satisfying pred in the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/mismatch.hpp

    - + Requirements

    @@ -185,14 +185,14 @@

    - + Precondition:

    distance(rng2) >= distance(rng1)

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/search.html b/doc/html/range/reference/algorithms/non_mutating/search.html index 6e68396..427642b 100644 --- a/doc/html/range/reference/algorithms/non_mutating/search.html +++ b/doc/html/range/reference/algorithms/non_mutating/search.html @@ -27,7 +27,7 @@ search

    - + Prototype

    @@ -95,7 +95,7 @@

    - + Description

    @@ -114,14 +114,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/search.hpp

    - + Requirements

    @@ -182,7 +182,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/search_n.html b/doc/html/range/reference/algorithms/non_mutating/search_n.html index aa1e621..6bc149d 100644 --- a/doc/html/range/reference/algorithms/non_mutating/search_n.html +++ b/doc/html/range/reference/algorithms/non_mutating/search_n.html @@ -27,7 +27,7 @@ search_n

    - + Prototype

    @@ -54,7 +54,7 @@

    - + Description

    @@ -63,14 +63,14 @@ and by a predicate when one is supplied.

    - + Definition

    Defined in the header file boost/range/algorithm/search_n.hpp

    - + Requirements

    @@ -124,7 +124,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/non_mutating/upper_bound.html b/doc/html/range/reference/algorithms/non_mutating/upper_bound.html index 6e75ef7..7c5b03e 100644 --- a/doc/html/range/reference/algorithms/non_mutating/upper_bound.html +++ b/doc/html/range/reference/algorithms/non_mutating/upper_bound.html @@ -27,7 +27,7 @@ upper_bound

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -70,14 +70,14 @@ same manner as the returned iterator described above.

    - + Definition

    Defined in the header file boost/range/algorithm/upper_bound.hpp

    - + Requirements

    @@ -128,7 +128,7 @@

    - + Precondition:

    @@ -146,7 +146,7 @@ order according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/numeric/accumulate.html b/doc/html/range/reference/algorithms/numeric/accumulate.html index e3accc8..a98dc0f 100644 --- a/doc/html/range/reference/algorithms/numeric/accumulate.html +++ b/doc/html/range/reference/algorithms/numeric/accumulate.html @@ -27,7 +27,7 @@ accumulate

    - + Prototype

    @@ -52,7 +52,7 @@

    - + Description

    @@ -63,18 +63,18 @@ The return value is the resultant value of the above algorithm.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -99,7 +99,7 @@
    - + For the second version
    @@ -133,7 +133,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/numeric/adjacent_difference.html b/doc/html/range/reference/algorithms/numeric/adjacent_difference.html index b5b3f49..c704d2a 100644 --- a/doc/html/range/reference/algorithms/numeric/adjacent_difference.html +++ b/doc/html/range/reference/algorithms/numeric/adjacent_difference.html @@ -27,7 +27,7 @@ adjacent_difference

    - + Prototype

    @@ -54,7 +54,7 @@

    - + Description

    @@ -68,18 +68,18 @@ instead of operator-().

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -110,7 +110,7 @@
    - + For the second version
    @@ -145,7 +145,7 @@
    - + Precondition:

    @@ -153,7 +153,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/numeric/inner_product.html b/doc/html/range/reference/algorithms/numeric/inner_product.html index 9567a89..bebd578 100644 --- a/doc/html/range/reference/algorithms/numeric/inner_product.html +++ b/doc/html/range/reference/algorithms/numeric/inner_product.html @@ -27,7 +27,7 @@ inner_product

    - + Prototype

    @@ -53,7 +53,7 @@

    - + Description

    @@ -66,18 +66,18 @@ algorithm please see inner_product.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -112,7 +112,7 @@
    - + For the second version
    @@ -161,14 +161,14 @@
    - + Precondition:

    distance(rng2) >= distance(rng1) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/numeric/partial_sum.html b/doc/html/range/reference/algorithms/numeric/partial_sum.html index 50fa44b..68accc1 100644 --- a/doc/html/range/reference/algorithms/numeric/partial_sum.html +++ b/doc/html/range/reference/algorithms/numeric/partial_sum.html @@ -27,7 +27,7 @@ partial_sum

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -57,18 +57,18 @@ in the same manner as std::partial_sum(boost::begin(rng), boost::end(rng), out_it). See partial_sum.

    - + Definition

    Defined in the header file boost/range/numeric.hpp

    - + Requirements
    - + For the first version
    @@ -98,7 +98,7 @@
    - + For the second version
    @@ -127,7 +127,7 @@
    - + Precondition:

    @@ -135,7 +135,7 @@ + distance(rng)) is a valid range.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/permutation/next_permutation.html b/doc/html/range/reference/algorithms/permutation/next_permutation.html index 78626e7..1f30391 100644 --- a/doc/html/range/reference/algorithms/permutation/next_permutation.html +++ b/doc/html/range/reference/algorithms/permutation/next_permutation.html @@ -27,7 +27,7 @@ next_permutation

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -66,14 +66,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -124,7 +124,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/permutation/prev_permutation.html b/doc/html/range/reference/algorithms/permutation/prev_permutation.html index c87dadb..c43900a 100644 --- a/doc/html/range/reference/algorithms/permutation/prev_permutation.html +++ b/doc/html/range/reference/algorithms/permutation/prev_permutation.html @@ -27,7 +27,7 @@ prev_permutation

    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -66,14 +66,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/permutation.hpp

    - + Requirements

    @@ -124,7 +124,7 @@

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/includes.html b/doc/html/range/reference/algorithms/set/includes.html index 9090779..9baedb3 100644 --- a/doc/html/range/reference/algorithms/set/includes.html +++ b/doc/html/range/reference/algorithms/set/includes.html @@ -27,7 +27,7 @@ includes

    - + Prototype

    @@ -47,7 +47,7 @@

    - + Description

    @@ -59,14 +59,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -144,7 +144,7 @@

    - + Precondition:

    @@ -162,7 +162,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/set_difference.html b/doc/html/range/reference/algorithms/set/set_difference.html index 6aa68d8..7712445 100644 --- a/doc/html/range/reference/algorithms/set/set_difference.html +++ b/doc/html/range/reference/algorithms/set/set_difference.html @@ -27,7 +27,7 @@ set_difference

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -70,14 +70,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -163,7 +163,7 @@

    - + Precondition:

    @@ -181,7 +181,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/set_intersection.html b/doc/html/range/reference/algorithms/set/set_intersection.html index 0c4705e..1a2040d 100644 --- a/doc/html/range/reference/algorithms/set/set_intersection.html +++ b/doc/html/range/reference/algorithms/set/set_intersection.html @@ -27,7 +27,7 @@ set_intersection

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -70,14 +70,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -163,7 +163,7 @@

    - + Precondition:

    @@ -181,7 +181,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/set_symmetric_difference.html b/doc/html/range/reference/algorithms/set/set_symmetric_difference.html index aab6c38..215facc 100644 --- a/doc/html/range/reference/algorithms/set/set_symmetric_difference.html +++ b/doc/html/range/reference/algorithms/set/set_symmetric_difference.html @@ -27,7 +27,7 @@ set_symmetric_difference

    - + Prototype

    @@ -58,7 +58,7 @@

    - + Description

    @@ -74,14 +74,14 @@ the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -167,7 +167,7 @@

    - + Precondition:

    @@ -185,7 +185,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/algorithms/set/set_union.html b/doc/html/range/reference/algorithms/set/set_union.html index f89ab11..5dc5176 100644 --- a/doc/html/range/reference/algorithms/set/set_union.html +++ b/doc/html/range/reference/algorithms/set/set_union.html @@ -27,7 +27,7 @@ set_union

    - + Prototype

    @@ -56,7 +56,7 @@

    - + Description

    @@ -69,14 +69,14 @@ in the predicate versions.

    - + Definition

    Defined in the header file boost/range/algorithm/set_algorithm.hpp

    - + Requirements

    @@ -162,7 +162,7 @@

    - + Precondition:

    @@ -180,7 +180,7 @@ according to pred.

    - + Complexity

    diff --git a/doc/html/range/reference/concept_implementation/semantics.html b/doc/html/range/reference/concept_implementation/semantics.html index 10f57ad..0aed2fa 100644 --- a/doc/html/range/reference/concept_implementation/semantics.html +++ b/doc/html/range/reference/concept_implementation/semantics.html @@ -31,7 +31,7 @@

    Functions
    - + notation
    diff --git a/doc/html/range/reference/concept_implementation/semantics/functions.html b/doc/html/range/reference/concept_implementation/semantics/functions.html index 318dec3..55f8a17 100644 --- a/doc/html/range/reference/concept_implementation/semantics/functions.html +++ b/doc/html/range/reference/concept_implementation/semantics/functions.html @@ -168,27 +168,10 @@

    - The size - of the - range with - complexity O(1). For - RandomAccessRanges this is - achieved via - boost::end(x) - - boost::begin(x). For - other traversal - categories range_calculate_size(x) is - returned. - Note that - unless range_calculate_size(x) has - been implemented - by the - user as - an extension - then the - Argument Dependent - Lookup will - return x.size() + range_calculate_size(x) which by default is boost::end(x) + - boost::begin(x). Users may supply alternative + implementations by implementing range_calculate_size(x) so that it will be found via + ADL

    diff --git a/doc/html/range/reference/ranges.html b/doc/html/range/reference/ranges.html index 7ebd43e..37919c5 100644 --- a/doc/html/range/reference/ranges.html +++ b/doc/html/range/reference/ranges.html @@ -7,7 +7,7 @@ - + @@ -20,13 +20,14 @@

    -PrevUpHomeNext +PrevUpHomeNext

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/doc/html/range/reference/ranges/any_range.html b/doc/html/range/reference/ranges/any_range.html new file mode 100644 index 0000000..3659c9e --- /dev/null +++ b/doc/html/range/reference/ranges/any_range.html @@ -0,0 +1,177 @@ + + + +any_range + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +
    + + Description +
    +

    + any_range is a range that + has the type information erased hence a any_range<int, boost::forward_pass_traversal_tag, int, + std::ptrdiff_t> + can be used to represent a std::vector<int>, a std::list<int> or many other types. +

    +

    + The type + erasure article covers the motivation and goals of type erasure + in this context. Clearly my implementation is building upon a lot of prior + art created by others. Thomas Becker's any_iterator + was a strong influence. Adobe also have an any_iterator + implementation, but this has very tight coupling to other parts of the + library that precluded it from use in Boost.Range. Early development versions + of this Range Adaptor directly used Thomas Becker's any_iterator implementation. + Subsequently I discovered that the heap allocations of this and many other + implementations cause poor speed performance particularly at the tails + of the distribution. To solve this required a new design that incorporated + the embedded buffer optimization. +

    +

    + Despite the underlying any_iterator + being the fastest available implementation, the performance overhead of + any_range is still appreciable + due to the cost of virtual function calls required to implement increment, decrement, + advance, equal etc. Frequently a better design + choice is to convert to a canonical form. +

    +

    + Please see the type_erased + for a Range Adaptor that returns any_range + instances. +

    +
    + + Synopsis +
    +

    + +

    +
    template<
    +    class Value
    +  , class Traversal
    +  , class Reference
    +  , class Difference
    +  , class Buffer = any_iterator_default_buffer
    +>
    +class any_range
    +    : public iterator_range<
    +        range_detail::any_iterator<
    +            Value
    +          , Traversal
    +          , Reference
    +          , Difference
    +          , Buffer
    +        >
    +    >
    +{
    +    typedef range_detail::any_iterator<
    +        Value
    +      , Traversal
    +      , Reference
    +      , Difference
    +      , Buffer
    +    > any_iterator_type;
    +
    +    typedef iterator_range<any_iterator_type> base_type;
    +
    +    struct enabler {};
    +    struct disabler {};
    +public:
    +    typedef any_iterator_type iterator;
    +    typedef any_iterator_type const_iterator;
    +
    +    any_range()
    +    {
    +    }
    +
    +    any_range(const any_range& other)
    +        : base_type(other)
    +    {
    +    }
    +
    +    template<class WrappedRange>
    +    any_range(WrappedRange& wrapped_range)
    +    : base_type(boost::begin(wrapped_range),
    +                boost::end(wrapped_range))
    +    {
    +    }
    +
    +    template<class WrappedRange>
    +    any_range(const WrappedRange& wrapped_range)
    +    : base_type(boost::begin(wrapped_range),
    +                boost::end(wrapped_range))
    +    {
    +    }
    +
    +    template<
    +        class OtherValue
    +      , class OtherTraversal
    +      , class OtherReference
    +      , class OtherDifference
    +    >
    +    any_range(const any_range<
    +                        OtherValue
    +                      , OtherTraversal
    +                      , OtherReference
    +                      , OtherDifference
    +                      , Buffer
    +                    >& other)
    +    : base_type(boost::begin(other), boost::end(other))
    +    {
    +    }
    +
    +    template<class Iterator>
    +    any_range(Iterator first, Iterator last)
    +        : base_type(first, last)
    +    {
    +    }
    +};
    +
    +

    +

    +
    + + Definition +
    +

    + Defined in header file boost/range/any_range.hpp +

    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/doc/html/range/reference/ranges/counting_range.html b/doc/html/range/reference/ranges/counting_range.html index 01355b0..21a8a16 100644 --- a/doc/html/range/reference/ranges/counting_range.html +++ b/doc/html/range/reference/ranges/counting_range.html @@ -6,7 +6,7 @@ - + @@ -20,14 +20,14 @@
    -PrevUpHomeNext +PrevUpHomeNext
    - + Prototype

    @@ -48,7 +48,7 @@

    - + Description

    @@ -58,14 +58,14 @@ (from Boost.Iterator).

    - + Definition

    Defined in header file boost/range/counting_range.hpp

    - + Requirements
    1. @@ -84,7 +84,7 @@
      -PrevUpHomeNext +PrevUpHomeNext
      diff --git a/doc/html/range/reference/ranges/irange.html b/doc/html/range/reference/ranges/irange.html index 291a416..6cc143c 100644 --- a/doc/html/range/reference/ranges/irange.html +++ b/doc/html/range/reference/ranges/irange.html @@ -27,7 +27,7 @@ irange
    - + Prototype

    @@ -44,7 +44,7 @@

    - + Description

    @@ -58,14 +58,14 @@ parameters denoted a half-open range.

    - + Definition

    Defined in the header file boost/range/irange.hpp

    - + Requirements
      @@ -80,7 +80,7 @@
    - + Complexity

    diff --git a/doc/html/range/reference/ranges/istream_range.html b/doc/html/range/reference/ranges/istream_range.html index 3e704f2..8b11dde 100644 --- a/doc/html/range/reference/ranges/istream_range.html +++ b/doc/html/range/reference/ranges/istream_range.html @@ -27,7 +27,7 @@ istream_range

    - + Prototype

    @@ -40,7 +40,7 @@

    - + Description

    @@ -49,7 +49,7 @@ wrapping a std::istream_iterator.

    - + Definition

    diff --git a/doc/html/range/reference/utilities/iterator_range.html b/doc/html/range/reference/utilities/iterator_range.html index b2b1923..bbe4521 100644 --- a/doc/html/range/reference/utilities/iterator_range.html +++ b/doc/html/range/reference/utilities/iterator_range.html @@ -48,7 +48,7 @@ type.

    - + Synopsis

    @@ -188,7 +188,7 @@ iterators from the same container.

    - + Details member functions
    @@ -207,7 +207,7 @@ == r.end();

    - + Details functions
    diff --git a/doc/html/range/reference/utilities/join.html b/doc/html/range/reference/utilities/join.html index 8fc0d82..6b7d849 100644 --- a/doc/html/range/reference/utilities/join.html +++ b/doc/html/range/reference/utilities/join.html @@ -39,7 +39,7 @@ check if the end of a range has been reached internally during traversal.

    - + Synposis

    @@ -108,7 +108,7 @@

    - + Example

    diff --git a/doc/html/range/reference/utilities/sub_range.html b/doc/html/range/reference/utilities/sub_range.html index e82e7f5..c35e707 100644 --- a/doc/html/range/reference/utilities/sub_range.html +++ b/doc/html/range/reference/utilities/sub_range.html @@ -35,7 +35,7 @@ is.

    - + Synopsis

    diff --git a/doc/reference/adaptors.qbk b/doc/reference/adaptors.qbk index 260fc39..91401c0 100644 --- a/doc/reference/adaptors.qbk +++ b/doc/reference/adaptors.qbk @@ -177,6 +177,7 @@ rng | boost::adaptors::adaptor_generator [include adaptors/reversed.qbk] [include adaptors/sliced.qbk] [include adaptors/strided.qbk] +[include adaptors/type_erased.qbk] [include adaptors/tokenized.qbk] [include adaptors/transformed.qbk] [include adaptors/uniqued.qbk] diff --git a/doc/reference/adaptors/strided.qbk b/doc/reference/adaptors/strided.qbk index 0f57222..e219a83 100644 --- a/doc/reference/adaptors/strided.qbk +++ b/doc/reference/adaptors/strided.qbk @@ -11,7 +11,7 @@ [[Function] [`boost::adaptors::stride(rng, n)`]] ] -* [*Precondition:] `0 <= n` and `boost::size(rng)` is a valid expression. +* [*Precondition:] `0 <= n`. * [*Returns:] A new range based on `rng` where traversal is performed in steps of `n`. * [*Range Category:] __single_pass_range__ * [*Returned Range Category:] The range category of `rng`. diff --git a/doc/reference/adaptors/type_erased.qbk b/doc/reference/adaptors/type_erased.qbk new file mode 100644 index 0000000..a24bee7 --- /dev/null +++ b/doc/reference/adaptors/type_erased.qbk @@ -0,0 +1,151 @@ +[/ + Copyright 2010 Neil Groves + 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) +/] +[section:type_erased type_erased] + +[table + [[Syntax] [Code]] + [[Pipe] [`rng | boost::adaptors::type_erased()`]] + [[Function] [`boost::adaptors::type_erase(rng, boost::adaptors::type_erased)`]] +] + +Please note that it is frequently unnecessary to use the `type_erased` adaptor. It is often better to use the implicit conversion to `any_range`. + +Let `Rng` be the type of `rng`. + +* [*Template parameters:] + * `Value` is the `value_type` for the `any_range`. If this is set to boost::use_default, `Value` will be calculated from the + range type when the adaptor is applied. + * `Traversal` is the tag used to identify the traversal of the resultant range. Frequently it is desireable to set a traversal category lower than the source container or range to maximize the number of ranges that can convert to the `any_range`. If this is left as boost::use_default then `Traversal` will be `typename boost::iterator_traversal::type>::type` + * `Reference` is the `reference` for the `any_range`. `boost::use_default` will equate to `typename range_reference::type`. + * `Difference` is the `difference_type` for the any_range. `boost::use_default` will equate to `typename boost::range_difference::type` + * `Buffer` is the storage used to allocate the underlying iterator wrappers. This can typically be ignored, but is available as a template parameter for customization. Buffer must be a model of the `AnyIteratorBufferConcept`. +* [*Precondition:] `Traversal` is one of `{ boost::use_default, boost::single_pass_traversal_tag, boost::forward_traversal_tag, boost::bidirectional_traversal_tag, boost::random_access_traversal_tag }` +* [*Returns:] The returned value is the same as `typename any_range_type_generator< Rng, Value, Traversal, Reference, Difference, Buffer >` that represents `rng` in a type-erased manner. +* [*Range Category:] __single_pass_range__ +* [*Returned Range Category:] if `Traversal` was specified as `boost::use_default` then `typename boost::iterator_traversal::type>::type`, otherwise `Traversal`. + +[heading AnyIteratorBufferConcept] +`` +class AnyIteratorBufferConcept +{ +public: + AnyIteratorBufferConcept(); + ~AnyIteratorBufferConcept(); + + // bytes is the requested size to allocate. This function + // must return a pointer to an adequate area of memory. + // throws: bad_alloc + // + // The buffer will only ever have zero or one + // outstanding memory allocations. + void* allocate(std::size_t bytes); + + // deallocate this buffer + void deallocate(); +}; +`` + +[section:type_erased_example type-erased example] +`` +#include +#include +#include +#include +#include +#include +#include +#include + +// The client interface from an OO perspective merely requires a sequence +// of integers that can be forward traversed +typedef boost::any_range< + int + , boost::forward_traversal_tag + , int + , std::ptrdiff_t +> integer_range; + +namespace server +{ + void display_integers(const integer_range& rng) + { + boost::copy(rng, + std::ostream_iterator(std::cout, ",")); + + std::cout << std::endl; + } +} + +namespace client +{ + void run() + { + using namespace boost::assign; + using namespace boost::adaptors; + + // Under most conditions one would simply use an appropriate + // any_range as a function parameter. The type_erased adaptor + // is often superfluous. However because the type_erased + // adaptor is applied to a range, we can use default template + // arguments that are generated in conjunction with the + // range type to which we are applying the adaptor. + + std::vector input; + input += 1,2,3,4,5; + + // Note that this call is to a non-template function + server::display_integers(input); + + std::list input2; + input2 += 6,7,8,9,10; + + // Note that this call is to the same non-tempate function + server::display_integers(input2); + + input2.clear(); + input2 += 11,12,13,14,15; + + // Calling using the adaptor looks like this: + // Notice that here I have a type_erased that would be a + // bidirectional_traversal_tag, but this is convertible + // to the forward_traversal_tag equivalent hence this + // works. + server::display_integers(input2 | type_erased<>()); + + // However we may simply wish to define an adaptor that + // takes a range and makes it into an appropriate + // forward_traversal any_range... + typedef boost::adaptors::type_erased< + boost::use_default + , boost::forward_traversal_tag + > type_erased_forward; + + // This adaptor can turn other containers with different + // value_types and reference_types into the appropriate + // any_range. + + server::display_integers(input2 | type_erased_forward()); + } +} + +int main(int argc, const char* argv[]) +{ + client::run(); + return 0; +} +`` +[endsect] + +This would produce the output: +`` +1,2,3,4,5 +6,7,8,9,10 +11,12,13,14,15 +11,12,13,14,15 +`` +[endsect] + + diff --git a/doc/reference/ranges.qbk b/doc/reference/ranges.qbk index 14299c4..5b853d5 100644 --- a/doc/reference/ranges.qbk +++ b/doc/reference/ranges.qbk @@ -5,6 +5,7 @@ /] [section:ranges Provided Ranges] +[include ranges/any_range.qbk] [include ranges/counting_range.qbk] [include ranges/istream_range.qbk] [include ranges/irange.qbk] diff --git a/doc/reference/ranges/any_range.qbk b/doc/reference/ranges/any_range.qbk new file mode 100644 index 0000000..6ff224e --- /dev/null +++ b/doc/reference/ranges/any_range.qbk @@ -0,0 +1,115 @@ +[/ + Copyright 2010 Neil Groves + 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) +/] +[section:any_range any_range] + +[heading Description] + +`any_range` is a range that has the type information erased hence a `any_range` +can be used to represent a `std::vector`, a `std::list` or many other types. + +The __type_erasure_article__ covers the motivation and goals of type erasure in this context. Clearly +my implementation is building upon a lot of prior art created by others. Thomas Becker's `any_iterator` was a strong +influence. Adobe also have an `any_iterator` implementation, but this has very tight coupling to other parts of the +library that precluded it from use in Boost.Range. +Early development versions of this Range Adaptor directly used Thomas Becker's any_iterator implementation. +Subsequently I discovered that the heap allocations of this and many other implementations cause poor +speed performance particularly at the tails of the distribution. To solve this required a new design that +incorporated the embedded buffer optimization. + +Despite the underlying `any_iterator` being the fastest available implementation, the performance overhead of `any_range` is still appreciable due to the cost of virtual function calls required to implement `increment`, `decrement`, `advance`, `equal` etc. Frequently a better design choice is to convert to a canonical form. + +Please see the __range_adaptors_type_erased__ for a Range Adaptor that returns `any_range` instances. + +[heading Synopsis] + +`` +template< + class Value + , class Traversal + , class Reference + , class Difference + , class Buffer = any_iterator_default_buffer +> +class any_range + : public iterator_range< + range_detail::any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > + > +{ + typedef range_detail::any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > any_iterator_type; + + typedef iterator_range base_type; + + struct enabler {}; + struct disabler {}; +public: + typedef any_iterator_type iterator; + typedef any_iterator_type const_iterator; + + any_range() + { + } + + any_range(const any_range& other) + : base_type(other) + { + } + + template + any_range(WrappedRange& wrapped_range) + : base_type(boost::begin(wrapped_range), + boost::end(wrapped_range)) + { + } + + template + any_range(const WrappedRange& wrapped_range) + : base_type(boost::begin(wrapped_range), + boost::end(wrapped_range)) + { + } + + template< + class OtherValue + , class OtherTraversal + , class OtherReference + , class OtherDifference + > + any_range(const any_range< + OtherValue + , OtherTraversal + , OtherReference + , OtherDifference + , Buffer + >& other) + : base_type(boost::begin(other), boost::end(other)) + { + } + + template + any_range(Iterator first, Iterator last) + : base_type(first, last) + { + } +}; +`` + +[heading Definition] + +Defined in header file `boost/range/any_range.hpp` + +[endsect] diff --git a/doc/reference/semantics.qbk b/doc/reference/semantics.qbk index 6276e9d..335ab90 100644 --- a/doc/reference/semantics.qbk +++ b/doc/reference/semantics.qbk @@ -21,7 +21,7 @@ [table [[Expression] [Return type] [Complexity]] [ - [`range_iterator::type`] + [`range_iterator::type`] [`` T::iterator P::first_type @@ -129,7 +129,7 @@ [ [`size(x)`] [`range_difference::type`] - [`The size of the range with complexity O(1). For RandomAccessRanges this is achieved via boost::end(x) - boost::begin(x). For other traversal categories range_calculate_size(x) is returned. Note that unless range_calculate_size(x) has been implemented by the user as an extension then the Argument Dependent Lookup will return x.size()`] + [`range_calculate_size(x)` which by default is `boost::end(x) - boost::begin(x)`. Users may supply alternative implementations by implementing `range_calculate_size(x)` so that it will be found via ADL] [constant time] ] [ diff --git a/include/boost/range/adaptor/sliced.hpp b/include/boost/range/adaptor/sliced.hpp index 7772bb5..14ad986 100755 --- a/include/boost/range/adaptor/sliced.hpp +++ b/include/boost/range/adaptor/sliced.hpp @@ -76,6 +76,7 @@ namespace boost } } // namespace adaptors + using adaptors::sliced_range; } // namespace boost #endif diff --git a/include/boost/range/adaptor/strided.hpp b/include/boost/range/adaptor/strided.hpp index 9bbd8ca..abfad5e 100755 --- a/include/boost/range/adaptor/strided.hpp +++ b/include/boost/range/adaptor/strided.hpp @@ -16,156 +16,287 @@ #include #include -#include - namespace boost { namespace range_detail { - - template + // strided_iterator for wrapping a forward traversal iterator + template class strided_iterator : public iterator_adaptor< - strided_iterator + strided_iterator , BaseIterator + , use_default + , boost::forward_traversal_tag > { - friend class iterator_core_access; + friend class ::boost::iterator_core_access; - typedef iterator_adaptor, BaseIterator> super_t; + typedef iterator_adaptor< + strided_iterator + , BaseIterator + , use_default + , boost::forward_traversal_tag + > super_t; public: typedef BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type difference_type; + typedef BaseIterator base_iterator; strided_iterator() - : m_stride(), m_offset(), m_max_offset() + : m_last() + , m_stride() { } - explicit strided_iterator(BaseIterator base_it, - difference_type stride, - difference_type offset, - difference_type max_offset) - : super_t(base_it) + strided_iterator(base_iterator first, base_iterator it, base_iterator last, difference_type stride) + : super_t(it) + , m_last(last) , m_stride(stride) - , m_offset(offset) - , m_max_offset(max_offset) { } template - strided_iterator(const strided_iterator& other, - BOOST_DEDUCED_TYPENAME enable_if_convertible::type* = 0) + strided_iterator(const strided_iterator& other, + BOOST_DEDUCED_TYPENAME enable_if_convertible::type* = 0) : super_t(other) - , m_stride(other.m_stride) - , m_offset(other.m_offset) - , m_max_offset(other.m_max_offset) + , m_last(other.base_end()) + , m_stride(other.get_stride()) { } - strided_iterator& - operator=(const strided_iterator& other) - { - super_t::operator=(other); - m_stride = other.m_stride; - m_offset = other.m_offset; - m_max_offset = other.m_max_offset; - return *this; - } + base_iterator base_end() const { return m_last; } + difference_type get_stride() const { return m_stride; } + private: void increment() { - m_offset += m_stride; - if (m_offset <= m_max_offset) - std::advance(this->base_reference(), m_stride); + base_iterator& it = this->base_reference(); + for (difference_type i = 0; (it != m_last) && (i < m_stride); ++i) + ++it; + } + + base_iterator m_last; + difference_type m_stride; + }; + + // strided_iterator for wrapping a bidirectional iterator + template + class strided_iterator + : public iterator_adaptor< + strided_iterator + , BaseIterator + , use_default + , bidirectional_traversal_tag + > + { + friend class ::boost::iterator_core_access; + + typedef iterator_adaptor< + strided_iterator + , BaseIterator + , use_default + , bidirectional_traversal_tag + > super_t; + public: + typedef BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type difference_type; + typedef BaseIterator base_iterator; + + strided_iterator() + : m_first() + , m_last() + , m_stride() + { + } + + strided_iterator(base_iterator first, base_iterator it, base_iterator last, difference_type stride) + : super_t(it) + , m_first(first) + , m_last(last) + , m_stride(stride) + { + } + + template + strided_iterator(const strided_iterator& other, + BOOST_DEDUCED_TYPENAME enable_if_convertible::type* = 0) + : super_t(other.base()) + , m_first(other.base_begin()) + , m_last(other.base_end()) + , m_stride(other.get_stride()) + { + } + + base_iterator base_begin() const { return m_first; } + base_iterator base_end() const { return m_last; } + difference_type get_stride() const { return m_stride; } + + private: + void increment() + { + base_iterator& it = this->base_reference(); + for (difference_type i = 0; (it != m_last) && (i < m_stride); ++i) + ++it; } void decrement() { - m_offset -= m_stride; - if (m_offset >= 0) - std::advance(this->base_reference(), -m_stride); + base_iterator& it = this->base_reference(); + for (difference_type i = 0; (it != m_first) && (i < m_stride); ++i) + --it; } - void advance(difference_type n) - { - n *= m_stride; - m_offset += n; + base_iterator m_first; + base_iterator m_last; + difference_type m_stride; + }; - if (m_offset >= 0 && m_offset <= m_max_offset) - std::advance(this->base_reference(), n); + // strided_iterator implementation for wrapping a random access iterator + template + class strided_iterator + : public iterator_adaptor< + strided_iterator + , BaseIterator + , use_default + , random_access_traversal_tag + > + { + friend class ::boost::iterator_core_access; + + typedef iterator_adaptor< + strided_iterator + , BaseIterator + , use_default + , random_access_traversal_tag + > super_t; + public: + typedef BOOST_DEDUCED_TYPENAME super_t::difference_type difference_type; + typedef BaseIterator base_iterator; + + strided_iterator() + : m_first() + , m_last() + , m_stride() + { + } + + strided_iterator(BaseIterator first, BaseIterator it, BaseIterator last, difference_type stride) + : super_t(it) + , m_first(first) + , m_last(last) + , m_stride(stride) + { } template - bool equal(const strided_iterator& other, - BOOST_DEDUCED_TYPENAME enable_if_convertible::type* = 0) const + strided_iterator(const strided_iterator& other, + BOOST_DEDUCED_TYPENAME enable_if_convertible::type* = 0) + : super_t(other.base()) + , m_first(other.base_begin()) + , m_last(other.base_end()) + , m_stride(other.get_stride()) { - return m_offset == other.m_offset; } - difference_type - distance_to(const strided_iterator& other) const + base_iterator base_begin() const { return m_first; } + base_iterator base_end() const { return m_last; } + difference_type get_stride() const { return m_stride; } + + private: + void increment() { - return (other.m_offset - m_offset) / m_stride; + base_iterator& it = this->base_reference(); + if ((m_last - it) > m_stride) + it += m_stride; + else + it = m_last; + } + + void decrement() + { + base_iterator& it = this->base_reference(); + if ((it - m_first) > m_stride) + it -= m_stride; + else + it = m_first; + } + + void advance(difference_type offset) + { + base_iterator& it = this->base_reference(); + offset *= m_stride; + if (offset >= 0) + { + if ((m_last - it) > offset) + it += offset; + else + it = m_last; + } + else + { + if ((m_first - it) > offset) + it += offset; + else + it = m_first; + } + } + + template + difference_type distance_to(const strided_iterator& other, + BOOST_DEDUCED_TYPENAME enable_if_convertible::type* = 0) const + { + if (other.base() >= this->base()) + return (other.base() - this->base() + (m_stride - 1)) / m_stride; + return (other.base() - this->base() - (m_stride - 1)) / m_stride; + } + + bool equal(const strided_iterator& other) const + { + return other.base() == this->base(); } private: + base_iterator m_first; + base_iterator m_last; difference_type m_stride; - difference_type m_offset; - difference_type m_max_offset; }; template inline - strided_iterator - make_strided_iterator( - const BaseIterator& first, - Difference stride, - typename std::iterator_traits::difference_type offset, - typename std::iterator_traits::difference_type max_offset - ) + strided_iterator::type> + make_strided_iterator(BaseIterator first, BaseIterator it, + BaseIterator last, Difference stride) { BOOST_ASSERT( stride >= 0 ); - BOOST_ASSERT( (stride == 0) || (offset % stride == 0) ); - BOOST_ASSERT( (stride == 0) || (max_offset % stride == 0) ); - BOOST_ASSERT( offset <= max_offset ); - return strided_iterator(first, stride, offset, max_offset); + typedef BOOST_DEDUCED_TYPENAME iterator_traversal::type traversal_tag; + return strided_iterator(first, it, last, stride); } - template< class Rng > + template< class Rng + , class Category = BOOST_DEDUCED_TYPENAME iterator_traversal< + BOOST_DEDUCED_TYPENAME range_iterator::type + >::type + > class strided_range - : public iterator_range::type> > + : public iterator_range< + range_detail::strided_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + Category + > + > { - typedef range_detail::strided_iterator::type> iter_type; + typedef range_detail::strided_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + Category + > iter_type; typedef iterator_range super_t; public: template strided_range(Difference stride, Rng& rng) - : super_t(make_super(stride, rng)) + : super_t(make_strided_iterator(boost::begin(rng), boost::begin(rng), boost::end(rng), stride), + make_strided_iterator(boost::begin(rng), boost::end(rng), boost::end(rng), stride)) { BOOST_ASSERT( stride >= 0 ); } - - private: - template - static super_t make_super(const Difference stride, Rng& rng) - { - const Difference count = boost::size(rng); - const Difference max_count = max_offset(count, stride); - return super_t(make_strided_iterator(boost::begin(rng), stride, 0, max_count), - make_strided_iterator(boost::end(rng), stride, max_count, max_count)); - } - - template - static Difference max_offset(Difference sz, const Stride stride) - { - if (stride > 0) - { - sz += stride - 1; - sz /= stride; - sz *= stride; - } - return sz; - } }; template diff --git a/include/boost/range/adaptor/type_erased.hpp b/include/boost/range/adaptor/type_erased.hpp index 85bff73..80bc712 100644 --- a/include/boost/range/adaptor/type_erased.hpp +++ b/include/boost/range/adaptor/type_erased.hpp @@ -1,6 +1,6 @@ // Boost.Range library // -// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. Use, modification and +// Copyright Neil Groves 2010. Use, modification and // distribution is subject to 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) @@ -10,79 +10,173 @@ #ifndef BOOST_RANGE_ADAPTOR_TYPE_ERASED_HPP_INCLUDED #define BOOST_RANGE_ADAPTOR_TYPE_ERASED_HPP_INCLUDED -#include -#include -#include +#include +#include +#include +#include +#include namespace boost { - namespace range_detail - { - template< - class Value, - class CategoryOrTraversal, - class Reference, - class Difference - > - class any_range - : public iterator_range< - IteratorTypeErasure::any_iterator< - Value, CategoryOrTraversal, Reference, Difference> > - { - typedef typename IteratorTypeErasure::any_iterator< - Value, CategoryOrTraversal, Reference, Difference> iterator_t; - - typedef iterator_range base_t; - public: - template - explicit any_range(Range& r) : base_t(r) {} - - template - explicit any_range(const Range& r) : base_t(r) {} - }; - - template - class any_range_generator - { - public: - typedef any_range< - BOOST_DEDUCED_TYPENAME range_value::type, - BOOST_DEDUCED_TYPENAME iterator_traversal< - BOOST_DEDUCED_TYPENAME range_iterator::type - >::type, - BOOST_DEDUCED_TYPENAME range_reference::type, - BOOST_DEDUCED_TYPENAME range_difference::type - > type; - }; - - class type_erased_tag {}; - - - } // namespace range_detail - - using range_detail::any_range; - namespace adaptors { - namespace + template< + class Value = use_default + , class Traversal = use_default + , class Reference = use_default + , class Difference = use_default + , class Buffer = use_default + > + struct type_erased { - const range_detail::type_erased_tag type_erased = range_detail::type_erased_tag(); + }; + + template< + class SinglePassRange + , class Value + , class Traversal + , class Reference + , class Difference + , class Buffer + > + typename any_range_type_generator< + SinglePassRange + , Value + , Traversal + , Reference + , Difference + , Buffer + >::type + operator|(SinglePassRange& rng, + type_erased< + Value + , Traversal + , Reference + , Difference + , Buffer + >) + { + typedef typename any_range_type_generator< + SinglePassRange + , Value + , Traversal + , Reference + , Difference + , Buffer + >::type range_type; + return range_type(boost::begin(rng), boost::end(rng)); } - template - typename range_detail::any_range_generator::type - operator|(SinglePassRange& rng, range_detail::type_erased_tag) + template< + class SinglePassRange + , class Value + , class Traversal + , class Reference + , class Difference + , class Buffer + > + typename any_range_type_generator< + const SinglePassRange + , Value + , Traversal + , Reference + , Difference + , Buffer + >::type + operator|(const SinglePassRange& rng, + type_erased< + Value + , Traversal + , Reference + , Difference + , Buffer + >) { - typedef typename range_detail::any_range_generator::type range_t; - return range_t(rng); + typedef typename any_range_type_generator< + const SinglePassRange + , Value + , Traversal + , Reference + , Difference + , Buffer + >::type range_type; + return range_type(boost::begin(rng), boost::end(rng)); } - template - typename range_detail::any_range_generator::type - operator|(const SinglePassRange& rng, range_detail::type_erased_tag) + template< + class SinglePassRange + , class Value + , class Traversal + , class Reference + , class Difference + , class Buffer + > + typename any_range_type_generator< + SinglePassRange + , Value + , Traversal + , Reference + , Difference + , Buffer + >::type + type_erase(SinglePassRange& rng + , type_erased< + Value + , Traversal + , Reference + , Difference + , Buffer + > = type_erased<>() + ) { - typedef typename range_detail::any_range_generator::type range_t; - return range_t(rng); + typedef typename any_range_type_generator< + SinglePassRange + , Value + , Traversal + , Reference + , Difference + , Buffer + >::type range_type; + + return range_type(boost::begin(rng), boost::end(rng)); + } + + template< + class SinglePassRange + , class Value + , class Traversal + , class Reference + , class Difference + , class Buffer + > + typename any_range_type_generator< + const SinglePassRange + , Value + , Traversal + , Reference + , Difference + , Buffer + >::type + type_erase(const SinglePassRange& rng + , type_erased< + Value + , Traversal + , Reference + , Difference + , Buffer + > = type_erased<>() + ) + { + typedef typename any_range_type_generator< + const SinglePassRange + , Value + , Traversal + , Reference + , Difference + , Buffer + >::type range_type; + + return range_type(boost::begin(rng), boost::end(rng)); } } } // namespace boost diff --git a/include/boost/range/any_range.hpp b/include/boost/range/any_range.hpp new file mode 100644 index 0000000..2155b2c --- /dev/null +++ b/include/boost/range/any_range.hpp @@ -0,0 +1,204 @@ +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#ifndef BOOST_RANGE_ANY_RANGE_HPP_INCLUDED +#define BOOST_RANGE_ANY_RANGE_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace range_detail + { + // If T is use_default, return the result of Default, otherwise + // return T. + // + // This is an implementation artifact used to pick intelligent default + // values when the user specified boost::use_default as a template + // parameter. + template< + class T, + class Default + > + struct any_range_default_help + : mpl::eval_if< + is_same + , Default + , mpl::identity + > + { + }; + + template< + class WrappedRange + , class Value + , class Reference + > + struct any_range_value_type + { +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY + typedef typename any_range_default_help< + Value + , mpl::eval_if< + is_same + , range_value< + typename remove_const + ::type> + , remove_reference + > + >::type type; +# else + typedef typename any_range_default_help< + Value + , range_value< + typename remove_const + ::type> + >::type type; +# endif + }; + + template< + class Value + , class Traversal + , class Reference + , class Difference + , class Buffer = use_default + > + class any_range + : public iterator_range< + any_iterator< + Value + , Traversal + , Reference + , Difference + , typename any_range_default_help< + Buffer + , mpl::identity + >::type + > + > + { + typedef iterator_range< + any_iterator< + Value + , Traversal + , Reference + , Difference + , typename any_range_default_help< + Buffer + , mpl::identity + >::type + > + > base_type; + + struct enabler {}; + struct disabler {}; + public: + any_range() + { + } + + any_range(const any_range& other) + : base_type(other) + { + } + + template + any_range(WrappedRange& wrapped_range) + : base_type(boost::begin(wrapped_range), + boost::end(wrapped_range)) + { + } + + template + any_range(const WrappedRange& wrapped_range) + : base_type(boost::begin(wrapped_range), + boost::end(wrapped_range)) + { + } + + template< + class OtherValue + , class OtherTraversal + , class OtherReference + , class OtherDifference + > + any_range(const any_range< + OtherValue + , OtherTraversal + , OtherReference + , OtherDifference + , Buffer + >& other) + : base_type(boost::begin(other), boost::end(other)) + { + } + + template + any_range(Iterator first, Iterator last) + : base_type(first, last) + { + } + }; + + template< + class WrappedRange + , class Value = use_default + , class Traversal = use_default + , class Reference = use_default + , class Difference = use_default + , class Buffer = use_default + > + struct any_range_type_generator + { + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + typedef any_range< + typename any_range_value_type< + WrappedRange + , Value + , typename any_range_default_help< + Reference + , range_reference + >::type + >::type + , typename any_range_default_help< + Traversal + , iterator_traversal< + typename range_iterator::type + > + >::type + , typename any_range_default_help< + Reference + , range_reference + >::type + , typename any_range_default_help< + Difference + , range_difference + >::type + , typename any_range_default_help< + Buffer + , mpl::identity + >::type + > type; + }; + } // namespace range_detail + + using range_detail::any_range; + using range_detail::any_range_type_generator; +} // namespace boost + +#endif // include guard diff --git a/include/boost/range/begin.hpp b/include/boost/range/begin.hpp index a4a5e10..c668488 100644 --- a/include/boost/range/begin.hpp +++ b/include/boost/range/begin.hpp @@ -91,6 +91,11 @@ namespace range_detail } // namespace 'range_detail' #endif +// Use a ADL namespace barrier to avoid ambiguity with other unqualified +// calls. This is particularly important with C++0x encouraging +// unqualified calls to begin/end. +namespace range_adl_barrier +{ template< class T > inline BOOST_DEDUCED_TYPENAME range_iterator::type begin( T& r ) @@ -114,19 +119,25 @@ inline BOOST_DEDUCED_TYPENAME range_iterator::type begin( const T& r ) return range_begin( r ); } + } // namespace range_adl_barrier } // namespace boost #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING namespace boost { - template< class T > - inline BOOST_DEDUCED_TYPENAME range_iterator::type - const_begin( const T& r ) + namespace range_adl_barrier { - return boost::begin( r ); - } -} + template< class T > + inline BOOST_DEDUCED_TYPENAME range_iterator::type + const_begin( const T& r ) + { + return boost::range_adl_barrier::begin( r ); + } + } // namespace range_adl_barrier + + using namespace range_adl_barrier; +} // namespace boost #endif diff --git a/include/boost/range/concepts.hpp b/include/boost/range/concepts.hpp index d9f9bfc..5965293 100644 --- a/include/boost/range/concepts.hpp +++ b/include/boost/range/concepts.hpp @@ -148,13 +148,16 @@ namespace boost { Iterator i2(++i); boost::ignore_unused_variable_warning(i2); - Iterator i3(i++); - boost::ignore_unused_variable_warning(i3); + // deliberately we are loose with the postfix version for the single pass + // iterator due to the commonly poor adherence to the specification means that + // many algorithms would be unusable, whereas actually without the check they + // work + (void)(i++); BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::reference r1(*i); boost::ignore_unused_variable_warning(r1); - BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::reference r2(*i++); + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::reference r2(*(++i)); boost::ignore_unused_variable_warning(r2); } private: @@ -178,6 +181,20 @@ namespace boost { BOOST_DEDUCED_TYPENAME ForwardIteratorConcept::traversal_category, forward_traversal_tag >)); + + BOOST_CONCEPT_USAGE(ForwardIteratorConcept) + { + // See the above note in the SinglePassIteratorConcept about the handling of the + // postfix increment. Since with forward and better iterators there is no need + // for a proxy, we can sensibly require that the dereference result + // is convertible to reference. + Iterator i2(i++); + boost::ignore_unused_variable_warning(i2); + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::reference r(*(i++)); + boost::ignore_unused_variable_warning(r); + } + private: + Iterator i; #endif }; diff --git a/include/boost/range/detail/any_iterator.hpp b/include/boost/range/detail/any_iterator.hpp new file mode 100644 index 0000000..107dfd6 --- /dev/null +++ b/include/boost/range/detail/any_iterator.hpp @@ -0,0 +1,587 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// +#ifndef BOOST_RANGE_DETAIL_ANY_ITERATOR_HPP_INCLUDED +#define BOOST_RANGE_DETAIL_ANY_ITERATOR_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace range_detail + { + // metafunction to determine if T is a const reference + template + struct is_const_reference + { + typedef typename mpl::and_< + typename is_reference::type, + typename is_const< + typename remove_reference::type + >::type + >::type type; + }; + + // metafunction to determine if T is a mutable reference + template + struct is_mutable_reference + { + typedef typename mpl::and_< + typename is_reference::type, + typename mpl::not_< + typename is_const< + typename remove_reference::type + >::type + >::type + >::type type; + }; + + // metafunction to evaluate if a source 'reference' can be + // converted to a target 'reference' as a value. + // + // This is true, when the target reference type is actually + // not a reference, and the source reference is convertible + // to the target type. + template + struct is_convertible_to_value_as_reference + { + typedef typename mpl::and_< + typename mpl::not_< + typename is_reference::type + >::type + , typename is_convertible< + SourceReference + , TargetReference + >::type + >::type type; + }; + + template< + class Value + , class Traversal + , class Reference + , class Difference + , class Buffer = any_iterator_default_buffer + > + class any_iterator; + + // metafunction to determine if SomeIterator is an + // any_iterator. + // + // This is the general implementation which evaluates to false. + template + struct is_any_iterator + : mpl::bool_ + { + }; + + // specialization of is_any_iterator to return true for + // any_iterator classes regardless of template parameters. + template< + class Value + , class Traversal + , class Reference + , class Difference + , class Buffer + > + struct is_any_iterator< + any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > + > + : mpl::bool_ + { + }; + } // namespace range_detail + + namespace detail + { + // Rationale: + // These are specialized since the iterator_facade versions lack + // the requisite typedefs to allow wrapping to determine the types + // if a user copy constructs from a postfix increment. + + template< + class Value + , class Traversal + , class Reference + , class Difference + , class Buffer + > + class postfix_increment_proxy< + range_detail::any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > + > + { + typedef range_detail::any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > any_iterator_type; + + public: + typedef Value value_type; + typedef typename std::iterator_traits::iterator_category iterator_category; + typedef Difference difference_type; + typedef typename iterator_pointer::type pointer; + typedef Reference reference; + + explicit postfix_increment_proxy(any_iterator_type const& x) + : stored_value(*x) + {} + + value_type& + operator*() const + { + return this->stored_value; + } + private: + mutable value_type stored_value; + }; + + template< + class Value + , class Traversal + , class Reference + , class Difference + , class Buffer + > + class writable_postfix_increment_proxy< + range_detail::any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > + > + { + typedef range_detail::any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > any_iterator_type; + public: + typedef Value value_type; + typedef typename std::iterator_traits::iterator_category iterator_category; + typedef Difference difference_type; + typedef typename iterator_pointer::type pointer; + typedef Reference reference; + + explicit writable_postfix_increment_proxy(any_iterator_type const& x) + : stored_value(*x) + , stored_iterator(x) + {} + + // Dereferencing must return a proxy so that both *r++ = o and + // value_type(*r++) can work. In this case, *r is the same as + // *r++, and the conversion operator below is used to ensure + // readability. + writable_postfix_increment_proxy const& + operator*() const + { + return *this; + } + + // Provides readability of *r++ + operator value_type&() const + { + return stored_value; + } + + // Provides writability of *r++ + template + T const& operator=(T const& x) const + { + *this->stored_iterator = x; + return x; + } + + // This overload just in case only non-const objects are writable + template + T& operator=(T& x) const + { + *this->stored_iterator = x; + return x; + } + + // Provides X(r++) + operator any_iterator_type const&() const + { + return stored_iterator; + } + + private: + mutable value_type stored_value; + any_iterator_type stored_iterator; + }; + + + } + + namespace range_detail + { + template< + class Value + , class Traversal + , class Reference + , class Difference + , class Buffer + > + class any_iterator + : public iterator_facade< + any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > + , Value + , Traversal + , Reference + , Difference + > + { + template< + class OtherValue + , class OtherTraversal + , class OtherReference + , class OtherDifference + , class OtherBuffer + > + friend class any_iterator; + + struct enabler {}; + struct disabler {}; + + typedef typename any_iterator_interface_type_generator< + Traversal + , Reference + , Difference + , Buffer + >::type abstract_base_type; + + typedef iterator_facade< + any_iterator< + Value + , Traversal + , Reference + , Difference + , Buffer + > + , Value + , Traversal + , Reference + , Difference + > base_type; + + typedef Buffer buffer_type; + + public: + typedef typename base_type::value_type value_type; + typedef typename base_type::reference reference; + typedef typename base_type::difference_type difference_type; + + // Default constructor + any_iterator() + : m_impl(0) {} + + // Simple copy construction without conversion + any_iterator(const any_iterator& other) + : base_type(other) + , m_impl(other.m_impl + ? other.m_impl->clone(m_buffer) + : 0) + { + } + + // Simple assignment operator without conversion + any_iterator& operator=(const any_iterator& other) + { + if (this != &other) + { + if (m_impl) + m_impl->~abstract_base_type(); + m_buffer.deallocate(); + m_impl = 0; + if (other.m_impl) + m_impl = other.m_impl->clone(m_buffer); + } + return *this; + } + + // Implicit conversion from another any_iterator where the + // conversion is from a non-const reference to a const reference + template< + class OtherValue + , class OtherTraversal + , class OtherReference + , class OtherDifference + > + any_iterator(const any_iterator< + OtherValue, + OtherTraversal, + OtherReference, + OtherDifference, + Buffer + >& other, + typename enable_if< + typename mpl::and_< + typename is_mutable_reference::type, + typename is_const_reference::type + >::type, + enabler + >::type* = 0 + ) + : m_impl(other.m_impl + ? other.m_impl->clone_const_ref(m_buffer) + : 0 + ) + { + } + + // Implicit conversion from another any_iterator where the + // reference types of the source and the target are references + // that are either both const, or both non-const. + template< + class OtherValue + , class OtherTraversal + , class OtherReference + , class OtherDifference + > + any_iterator(const any_iterator< + OtherValue + , OtherTraversal + , OtherReference + , OtherDifference + , Buffer + >& other, + typename enable_if< + typename mpl::or_< + typename mpl::and_< + typename is_mutable_reference::type, + typename is_mutable_reference::type + >::type, + typename mpl::and_< + typename is_const_reference::type, + typename is_const_reference::type + >::type + >::type, + enabler + >::type* = 0 + ) + : m_impl(other.m_impl + ? other.m_impl->clone(m_buffer) + : 0 + ) + { + } + + // Implicit conversion to an any_iterator that uses a value for + // the reference type. + template< + class OtherValue + , class OtherTraversal + , class OtherReference + , class OtherDifference + > + any_iterator(const any_iterator< + OtherValue + , OtherTraversal + , OtherReference + , OtherDifference + , Buffer + >& other, + typename enable_if< + typename is_convertible_to_value_as_reference< + OtherReference + , Reference + >::type, + enabler + >::type* = 0 + ) + : m_impl(other.m_impl + ? other.m_impl->clone_reference_as_value(m_buffer) + : 0 + ) + { + } + + any_iterator clone() const + { + any_iterator result; + if (m_impl) + result.m_impl = m_impl->clone(result.m_buffer); + return result; + } + + any_iterator< + Value + , Traversal + , typename abstract_base_type::const_reference + , Difference + , Buffer + > + clone_const_ref() const + { + typedef any_iterator< + Value + , Traversal + , typename abstract_base_type::const_reference + , Difference + , Buffer + > result_type; + + result_type result; + + if (m_impl) + result.m_impl = m_impl->clone_const_ref(result.m_buffer); + + return result; + } + + // implicit conversion and construction from type-erasure-compatible + // iterators + template + explicit any_iterator( + const WrappedIterator& wrapped_iterator, + typename disable_if< + typename is_any_iterator::type + , disabler + >::type* = 0 + ) + { + typedef typename any_iterator_wrapper_type_generator< + WrappedIterator + , Traversal + , Reference + , Difference + , Buffer + >::type wrapper_type; + + void* ptr = m_buffer.allocate(sizeof(wrapper_type)); + m_impl = new(ptr) wrapper_type(wrapped_iterator); + } + + ~any_iterator() + { + // manually run the destructor, the deallocation is automatically + // handled by the any_iterator_small_buffer base class. + if (m_impl) + m_impl->~abstract_base_type(); + } + + private: + friend class ::boost::iterator_core_access; + + Reference dereference() const + { + BOOST_ASSERT( m_impl ); + return m_impl->dereference(); + } + + bool equal(const any_iterator& other) const + { + return (m_impl == other.m_impl) + || (m_impl && other.m_impl && m_impl->equal(*other.m_impl)); + } + + void increment() + { + BOOST_ASSERT( m_impl ); + m_impl->increment(); + } + + void decrement() + { + BOOST_ASSERT( m_impl ); + m_impl->decrement(); + } + + Difference distance_to(const any_iterator& other) const + { + return m_impl && other.m_impl + ? m_impl->distance_to(*other.m_impl) + : 0; + } + + void advance(Difference offset) + { + BOOST_ASSERT( m_impl ); + m_impl->advance(offset); + } + + any_iterator& swap(any_iterator& other) + { + BOOST_ASSERT( this != &other ); + // grab a temporary copy of the other iterator + any_iterator tmp(other); + + // deallocate the other iterator, taking care to obey the + // class-invariants in-case of exceptions later + if (other.m_impl) + { + other.m_impl->~abstract_base_type(); + other.m_buffer.deallocate(); + other.m_impl = 0; + } + + // If this is a non-null iterator then we need to put + // a clone of this iterators impementation into the other + // iterator. + // We can't just swap because of the small buffer optimization. + if (m_impl) + { + other.m_impl = m_impl->clone(other.m_buffer); + m_impl->~abstract_base_type(); + m_buffer.deallocate(); + m_impl = 0; + } + + // assign to this instance a clone of the temporarily held + // tmp which represents the input other parameter at the + // start of execution of this function. + if (tmp.m_impl) + m_impl = tmp.m_impl->clone(m_buffer); + + return *this; + } + + buffer_type m_buffer; + abstract_base_type* m_impl; + }; + + } // namespace range_detail +} // namespace boost + +#endif // include guard diff --git a/include/boost/range/detail/any_iterator_buffer.hpp b/include/boost/range/detail/any_iterator_buffer.hpp new file mode 100644 index 0000000..26c1420 --- /dev/null +++ b/include/boost/range/detail/any_iterator_buffer.hpp @@ -0,0 +1,117 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// +#ifndef BOOST_RANGE_DETAIL_ANY_ITERATOR_BUFFER_HPP_INCLUDED +#define BOOST_RANGE_DETAIL_ANY_ITERATOR_BUFFER_HPP_INCLUDED + +#include +#include +#include +#include + +namespace boost +{ + template + class any_iterator_buffer + : noncopyable + { + BOOST_STATIC_ASSERT(( StackBufferSize > 0 )); + public: + any_iterator_buffer() + : m_ptr() + { + } + + ~any_iterator_buffer() + { + delete [] m_ptr; + } + + void* allocate(std::size_t bytes) + { + BOOST_ASSERT( !m_ptr ); + if (bytes <= StackBufferSize) + return m_buffer.data(); + + m_ptr = new char[bytes]; + return m_ptr; + } + + void deallocate() + { + delete [] m_ptr; + m_ptr = 0; + } + + private: + // Rationale: + // Do not use inheritance from noncopyable because this causes + // the concepts to erroneous detect the derived any_iterator + // as noncopyable. + any_iterator_buffer(const any_iterator_buffer&); + void operator=(const any_iterator_buffer&); + + char* m_ptr; + boost::array m_buffer; + }; + + class any_iterator_heap_only_buffer + : noncopyable + { + public: + any_iterator_heap_only_buffer() + : m_ptr() + { + } + + ~any_iterator_heap_only_buffer() + { + delete [] m_ptr; + } + + void* allocate(std::size_t bytes) + { + BOOST_ASSERT( !m_ptr ); + m_ptr = new char[bytes]; + return m_ptr; + } + + void deallocate() + { + delete [] m_ptr; + m_ptr = 0; + } + + private: + char* m_ptr; + }; + + template + class any_iterator_stack_only_buffer + { + BOOST_STATIC_ASSERT(( StackBufferSize > 0 )); + public: + void* allocate(std::size_t bytes) + { + BOOST_ASSERT( bytes <= m_buffer.size() ); + return m_buffer.data(); + } + + void deallocate() + { + } + + private: + boost::array m_buffer; + }; + + typedef any_iterator_buffer<64> any_iterator_default_buffer; +} // namespace boost + +#endif // include guard diff --git a/include/boost/range/detail/any_iterator_interface.hpp b/include/boost/range/detail/any_iterator_interface.hpp new file mode 100644 index 0000000..d8f4de7 --- /dev/null +++ b/include/boost/range/detail/any_iterator_interface.hpp @@ -0,0 +1,258 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// +#ifndef BOOST_RANGE_DETAIL_ANY_ITERATOR_INTERFACE_HPP_INCLUDED +#define BOOST_RANGE_DETAIL_ANY_ITERATOR_INTERFACE_HPP_INCLUDED + +#include +#include +#include + +namespace boost +{ + namespace range_detail + { + template + struct const_reference_type_generator + { + typedef typename mpl::if_< + typename is_reference::type, + typename add_reference< + typename add_const< + typename remove_reference::type + >::type + >::type, + T + >::type type; + }; + + template< + class Reference + , class Buffer + > + struct any_incrementable_iterator_interface + { + typedef Reference reference; + typedef typename const_reference_type_generator< + Reference + >::type const_reference; + typedef typename remove_const< + typename remove_reference::type + >::type reference_as_value_type; + + typedef Buffer buffer_type; + + virtual ~any_incrementable_iterator_interface() {} + + virtual any_incrementable_iterator_interface* + clone(buffer_type& buffer) const = 0; + + virtual any_incrementable_iterator_interface* + clone_const_ref(buffer_type& buffer) const = 0; + + virtual any_incrementable_iterator_interface* + clone_reference_as_value(buffer_type& buffer) const = 0; + + virtual void increment() = 0; + }; + + template< + class Reference + , class Buffer + > + struct any_single_pass_iterator_interface + : any_incrementable_iterator_interface + { + typedef typename any_incrementable_iterator_interface::reference reference; + typedef typename any_incrementable_iterator_interface::const_reference const_reference; + typedef typename any_incrementable_iterator_interface::buffer_type buffer_type; + typedef typename any_incrementable_iterator_interface::reference_as_value_type reference_as_value_type; + + virtual any_single_pass_iterator_interface* + clone(buffer_type& buffer) const = 0; + + virtual any_single_pass_iterator_interface* + clone_const_ref(buffer_type& buffer) const = 0; + + virtual any_single_pass_iterator_interface* + clone_reference_as_value(buffer_type& buffer) const = 0; + + virtual Reference dereference() const = 0; + + virtual bool equal(const any_single_pass_iterator_interface& other) const = 0; + }; + + template< + class Reference + , class Buffer + > + struct any_forward_iterator_interface + : any_single_pass_iterator_interface + { + typedef typename any_single_pass_iterator_interface::reference reference; + typedef typename any_single_pass_iterator_interface::const_reference const_reference; + typedef typename any_single_pass_iterator_interface::buffer_type buffer_type; + typedef typename any_single_pass_iterator_interface::reference_as_value_type reference_as_value_type; + + virtual any_forward_iterator_interface* + clone(buffer_type& buffer) const = 0; + + virtual any_forward_iterator_interface* + clone_const_ref(buffer_type& buffer) const = 0; + + virtual any_forward_iterator_interface* + clone_reference_as_value(buffer_type& buffer) const = 0; + }; + + template< + class Reference + , class Buffer + > + struct any_bidirectional_iterator_interface + : any_forward_iterator_interface + { + typedef typename any_forward_iterator_interface::reference reference; + typedef typename any_forward_iterator_interface::const_reference const_reference; + typedef typename any_forward_iterator_interface::buffer_type buffer_type; + typedef typename any_forward_iterator_interface::reference_as_value_type reference_as_value_type; + + virtual any_bidirectional_iterator_interface* + clone(buffer_type& buffer) const = 0; + + virtual any_bidirectional_iterator_interface* + clone_const_ref(buffer_type& buffer) const = 0; + + virtual any_bidirectional_iterator_interface* + clone_reference_as_value(buffer_type& buffer) const = 0; + + virtual void decrement() = 0; + }; + + template< + class Reference + , class Difference + , class Buffer + > + struct any_random_access_iterator_interface + : any_bidirectional_iterator_interface< + Reference + , Buffer + > + { + typedef typename any_bidirectional_iterator_interface::reference reference; + typedef typename any_bidirectional_iterator_interface::const_reference const_reference; + typedef typename any_bidirectional_iterator_interface::buffer_type buffer_type; + typedef typename any_bidirectional_iterator_interface::reference_as_value_type reference_as_value_type; + typedef Difference difference_type; + + virtual any_random_access_iterator_interface* + clone(buffer_type& buffer) const = 0; + + virtual any_random_access_iterator_interface* + clone_const_ref(buffer_type& buffer) const = 0; + + virtual any_random_access_iterator_interface* + clone_reference_as_value(buffer_type& buffer) const = 0; + + virtual void advance(Difference offset) = 0; + + virtual Difference distance_to(const any_random_access_iterator_interface& other) const = 0; + }; + + template< + class Traversal + , class Reference + , class Difference + , class Buffer + > + struct any_iterator_interface_type_generator; + + template< + class Reference + , class Difference + , class Buffer + > + struct any_iterator_interface_type_generator< + incrementable_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_incrementable_iterator_interface type; + }; + + template< + class Reference + , class Difference + , class Buffer + > + struct any_iterator_interface_type_generator< + single_pass_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_single_pass_iterator_interface type; + }; + + template< + class Reference + , class Difference + , class Buffer + > + struct any_iterator_interface_type_generator< + forward_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_forward_iterator_interface type; + }; + + template< + class Reference + , class Difference + , class Buffer + > + struct any_iterator_interface_type_generator< + bidirectional_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_bidirectional_iterator_interface type; + }; + + template< + class Reference + , class Difference + , class Buffer + > + struct any_iterator_interface_type_generator< + random_access_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_random_access_iterator_interface< + Reference + , Difference + , Buffer + > type; + }; + + } // namespace range_detail +} // namespace boost + +#endif // include guard diff --git a/include/boost/range/detail/any_iterator_wrapper.hpp b/include/boost/range/detail/any_iterator_wrapper.hpp new file mode 100644 index 0000000..b5313a7 --- /dev/null +++ b/include/boost/range/detail/any_iterator_wrapper.hpp @@ -0,0 +1,590 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// +#ifndef BOOST_RANGE_DETAIL_ANY_ITERATOR_WRAPPER_HPP_INCLUDED +#define BOOST_RANGE_DETAIL_ANY_ITERATOR_WRAPPER_HPP_INCLUDED + +#include +#include + +namespace boost +{ + namespace range_detail + { + template< + class WrappedIterator + , class Reference + , class Buffer + > + class any_incrementable_iterator_wrapper + : public any_incrementable_iterator_interface< + Reference + , Buffer + > + { + BOOST_RANGE_CONCEPT_ASSERT(( IncrementableIteratorConcept )); + public: + typedef WrappedIterator wrapped_type; + + BOOST_STATIC_ASSERT(( is_convertible< + typename iterator_reference::type + , Reference + >::value )); + + any_incrementable_iterator_wrapper() + : m_it() + {} + + explicit any_incrementable_iterator_wrapper(wrapped_type it) + : m_it(it) + {} + + // any_incrementable_iterator implementation + virtual any_incrementable_iterator_wrapper* clone( + typename any_incrementable_iterator_wrapper::buffer_type& buffer + ) const + { + return new (buffer.allocate(sizeof(*this))) + any_incrementable_iterator_wrapper(m_it); + } + + virtual any_incrementable_iterator_wrapper< + WrappedIterator + , typename any_incrementable_iterator_wrapper::const_reference + , Buffer + >* clone_const_ref( + typename any_incrementable_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_incrementable_iterator_wrapper< + WrappedIterator + , typename any_incrementable_iterator_wrapper::const_reference + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual any_incrementable_iterator_wrapper< + WrappedIterator + , typename any_incrementable_iterator_wrapper::reference_as_value_type + , Buffer + >* clone_reference_as_value( + typename any_incrementable_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_incrementable_iterator_wrapper< + WrappedIterator + , typename any_incrementable_iterator_wrapper::reference_as_value_type + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual void increment() + { + ++m_it; + } + + private: + wrapped_type m_it; + }; + + template< + class WrappedIterator + , class Reference + , class Buffer + > + class any_single_pass_iterator_wrapper + : public any_single_pass_iterator_interface< + Reference + , Buffer + > + { + struct disabler {}; + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassIteratorConcept )); + public: + + any_single_pass_iterator_wrapper() + : m_it() + {} + + explicit any_single_pass_iterator_wrapper(const WrappedIterator& it) + : m_it(it) + {} + // any_single_pass_iterator_interface implementation + virtual any_single_pass_iterator_wrapper* clone( + typename any_single_pass_iterator_wrapper::buffer_type& buffer + ) const + { + return new (buffer.allocate(sizeof(*this))) + any_single_pass_iterator_wrapper(m_it); + } + + virtual any_single_pass_iterator_wrapper< + WrappedIterator + , typename any_single_pass_iterator_wrapper::const_reference + , Buffer + >* clone_const_ref( + typename any_single_pass_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_single_pass_iterator_wrapper< + WrappedIterator + , typename any_single_pass_iterator_wrapper::const_reference + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual any_single_pass_iterator_wrapper< + WrappedIterator + , typename any_single_pass_iterator_wrapper::reference_as_value_type + , Buffer + >* clone_reference_as_value( + typename any_single_pass_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_single_pass_iterator_wrapper< + WrappedIterator + , typename any_single_pass_iterator_wrapper::reference_as_value_type + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual void increment() + { + ++m_it; + } + + virtual bool equal(const any_single_pass_iterator_interface& other) const + { + return m_it == boost::polymorphic_downcast(&other)->m_it; + } + + virtual Reference dereference() const + { + return *m_it; + } + + private: + WrappedIterator m_it; + }; + + template< + class WrappedIterator + , class Reference + , class Buffer + > + class any_forward_iterator_wrapper + : public any_forward_iterator_interface< + Reference + , Buffer + > + { + BOOST_RANGE_CONCEPT_ASSERT(( ForwardIteratorConcept )); + public: + any_forward_iterator_wrapper() + : m_it() + {} + + explicit any_forward_iterator_wrapper(const WrappedIterator& it) + : m_it(it) + {} + + // any_forward_iterator_interface implementation + virtual any_forward_iterator_wrapper* clone( + typename any_forward_iterator_wrapper::buffer_type& buffer + ) const + { + return new (buffer.allocate(sizeof(*this))) + any_forward_iterator_wrapper(m_it); + } + + virtual any_forward_iterator_wrapper< + WrappedIterator + , typename any_forward_iterator_wrapper::const_reference + , Buffer + >* clone_const_ref( + typename any_forward_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_forward_iterator_wrapper< + WrappedIterator + , typename any_forward_iterator_wrapper::const_reference + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual any_forward_iterator_wrapper< + WrappedIterator + , typename any_forward_iterator_wrapper::reference_as_value_type + , Buffer + >* clone_reference_as_value( + typename any_forward_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_forward_iterator_wrapper< + WrappedIterator + , typename any_forward_iterator_wrapper::reference_as_value_type + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual void increment() + { + ++m_it; + } + + virtual bool equal(const any_single_pass_iterator_interface& other) const + { + return m_it == boost::polymorphic_downcast(&other)->m_it; + } + + virtual Reference dereference() const + { + return *m_it; + } + private: + WrappedIterator m_it; + }; + + template< + class WrappedIterator + , class Reference + , class Buffer + > + class any_bidirectional_iterator_wrapper + : public any_bidirectional_iterator_interface< + Reference + , Buffer + > + { + BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalIteratorConcept )); + public: + any_bidirectional_iterator_wrapper() + : m_it() + { + } + + explicit any_bidirectional_iterator_wrapper(const WrappedIterator& it) + : m_it(it) + { + } + + virtual any_bidirectional_iterator_wrapper* clone( + typename any_bidirectional_iterator_wrapper::buffer_type& buffer + ) const + { + return new (buffer.allocate(sizeof(*this))) + any_bidirectional_iterator_wrapper(*this); + } + + virtual any_bidirectional_iterator_wrapper< + WrappedIterator + , typename any_bidirectional_iterator_wrapper::const_reference + , Buffer + >* clone_const_ref( + typename any_bidirectional_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_bidirectional_iterator_wrapper< + WrappedIterator + , typename any_bidirectional_iterator_wrapper::const_reference + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual any_bidirectional_iterator_wrapper< + WrappedIterator + , typename any_bidirectional_iterator_wrapper::reference_as_value_type + , Buffer + >* clone_reference_as_value( + typename any_bidirectional_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_bidirectional_iterator_wrapper< + WrappedIterator + , typename any_bidirectional_iterator_wrapper::reference_as_value_type + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual void increment() + { + ++m_it; + } + + virtual void decrement() + { + --m_it; + } + + virtual bool equal(const any_single_pass_iterator_interface& other) const + { + return m_it == boost::polymorphic_downcast(&other)->m_it; + } + + virtual Reference dereference() const + { + return *m_it; + } + + private: + WrappedIterator m_it; + }; + + template< + class WrappedIterator + , class Reference + , class Difference + , class Buffer + > + class any_random_access_iterator_wrapper + : public any_random_access_iterator_interface< + Reference + , Difference + , Buffer + > + { + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessIteratorConcept )); + public: + typedef Difference difference_type; + + any_random_access_iterator_wrapper() + : m_it() + { + } + + explicit any_random_access_iterator_wrapper(const WrappedIterator& other) + : m_it(other) + { + } + + virtual any_random_access_iterator_wrapper* clone( + typename any_random_access_iterator_wrapper::buffer_type& buffer + ) const + { + return new (buffer.allocate(sizeof(*this))) + any_random_access_iterator_wrapper(*this); + } + + virtual any_random_access_iterator_wrapper< + WrappedIterator + , typename any_random_access_iterator_wrapper::const_reference + , Difference + , Buffer + >* clone_const_ref( + typename any_random_access_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_random_access_iterator_wrapper< + WrappedIterator + , typename any_random_access_iterator_wrapper::const_reference + , Difference + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual any_random_access_iterator_wrapper< + WrappedIterator + , typename any_random_access_iterator_wrapper::reference_as_value_type + , Difference + , Buffer + >* clone_reference_as_value( + typename any_random_access_iterator_wrapper::buffer_type& buffer + ) const + { + typedef any_random_access_iterator_wrapper< + WrappedIterator + , typename any_random_access_iterator_wrapper::reference_as_value_type + , Difference + , Buffer + > result_type; + + return new (buffer.allocate(sizeof(result_type))) + result_type(m_it); + } + + virtual void increment() + { + ++m_it; + } + + virtual bool equal(const any_single_pass_iterator_interface& other) const + { + return m_it == boost::polymorphic_downcast(&other)->m_it; + } + + virtual void decrement() + { + --m_it; + } + + virtual void advance(Difference offset) + { + m_it += offset; + } + + virtual Reference dereference() const + { + return *m_it; + } + + virtual Difference distance_to(const any_random_access_iterator_interface& other) const + { + return boost::polymorphic_downcast(&other)->m_it - m_it; + } + + private: + WrappedIterator m_it; + }; + + template< + class WrappedIterator + , class Traversal + , class Reference + , class Difference + , class Buffer + > + struct any_iterator_wrapper_type_generator; + + template< + class WrappedIterator + , class Reference + , class Difference + , class Buffer + > + struct any_iterator_wrapper_type_generator< + WrappedIterator + , incrementable_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_incrementable_iterator_wrapper< + WrappedIterator + , Reference + , Buffer + > type; + }; + + template< + class WrappedIterator + , class Reference + , class Difference + , class Buffer + > + struct any_iterator_wrapper_type_generator< + WrappedIterator + , single_pass_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_single_pass_iterator_wrapper< + WrappedIterator + , Reference + , Buffer + > type; + }; + + template< + class WrappedIterator + , class Reference + , class Difference + , class Buffer + > + struct any_iterator_wrapper_type_generator< + WrappedIterator + , forward_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_forward_iterator_wrapper< + WrappedIterator + , Reference + , Buffer + > type; + }; + + template< + class WrappedIterator + , class Reference + , class Difference + , class Buffer + > + struct any_iterator_wrapper_type_generator< + WrappedIterator + , bidirectional_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_bidirectional_iterator_wrapper< + WrappedIterator + , Reference + , Buffer + > type; + }; + + template< + class WrappedIterator + , class Reference + , class Difference + , class Buffer + > + struct any_iterator_wrapper_type_generator< + WrappedIterator + , random_access_traversal_tag + , Reference + , Difference + , Buffer + > + { + typedef any_random_access_iterator_wrapper< + WrappedIterator + , Reference + , Difference + , Buffer + > type; + }; + + } // namespace range_detail +} // namespace boost + +#endif // include guard diff --git a/include/boost/range/detail/begin.hpp b/include/boost/range/detail/begin.hpp old mode 100755 new mode 100644 index 06c2561..f3da732 --- a/include/boost/range/detail/begin.hpp +++ b/include/boost/range/detail/begin.hpp @@ -19,9 +19,9 @@ # include #endif -namespace boost +namespace boost { - + namespace range_detail { template< typename T > @@ -30,7 +30,7 @@ namespace boost ////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////// - + template<> struct range_begin { @@ -40,11 +40,11 @@ namespace boost return c.begin(); }; }; - + ////////////////////////////////////////////////////////////////////// // pair ////////////////////////////////////////////////////////////////////// - + template<> struct range_begin { @@ -54,11 +54,11 @@ namespace boost return p.first; } }; - + ////////////////////////////////////////////////////////////////////// // array ////////////////////////////////////////////////////////////////////// - + template<> struct range_begin { @@ -78,14 +78,16 @@ namespace boost }; } // namespace 'range_detail' - - template< typename C > - inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type - begin( C& c ) + + namespace range_adl_barrier { - return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); + template< typename C > + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type + begin( C& c ) + { + return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); + } } - } // namespace 'boost' diff --git a/include/boost/range/detail/end.hpp b/include/boost/range/detail/end.hpp old mode 100755 new mode 100644 index d6a7368..8b5f35d --- a/include/boost/range/detail/end.hpp +++ b/include/boost/range/detail/end.hpp @@ -24,7 +24,7 @@ # include # endif -namespace boost +namespace boost { namespace range_detail { @@ -34,39 +34,39 @@ namespace boost ////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////// - + template<> struct range_end { template< typename C > - static BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type fun( C& c ) { return c.end(); }; }; - + ////////////////////////////////////////////////////////////////////// // pair ////////////////////////////////////////////////////////////////////// - + template<> struct range_end { template< typename P > - static BOOST_RANGE_DEDUCED_TYPENAME range_iterator

    ::type + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator

    ::type fun( const P& p ) { return p.second; } }; - + ////////////////////////////////////////////////////////////////////// // array ////////////////////////////////////////////////////////////////////// - + template<> - struct range_end + struct range_end { #if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) template< typename T, std::size_t sz > @@ -82,16 +82,19 @@ namespace boost } #endif }; - + } // namespace 'range_detail' - - template< typename C > - inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type - end( C& c ) + + namespace range_adl_barrier { - return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); - } - + template< typename C > + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type + end( C& c ) + { + return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); + } + } // namespace range_adl_barrier + } // namespace 'boost' # endif // VC6 diff --git a/include/boost/range/detail/safe_bool.hpp b/include/boost/range/detail/safe_bool.hpp new file mode 100644 index 0000000..182e510 --- /dev/null +++ b/include/boost/range/detail/safe_bool.hpp @@ -0,0 +1,72 @@ +// This header intentionally has no include guards. +// +// Copyright (c) 2010 Neil Groves +// 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 +// +// This code utilises the experience gained during the evolution of +// +#ifndef BOOST_RANGE_SAFE_BOOL_INCLUDED_HPP +#define BOOST_RANGE_SAFE_BOOL_INCLUDED_HPP + +#include +#include + +namespace boost +{ + namespace range_detail + { + +template +class safe_bool +{ +public: + typedef safe_bool this_type; + +#if (defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570)) || defined(__CINT_) + typedef bool unspecified_bool_type; + static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr) + { + return x; + } +#elif defined(_MANAGED) + static void unspecified_bool(this_type***) + { + } + typedef void(*unspecified_bool_type)(this_type***); + static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr) + { + return x ? unspecified_bool : 0; + } +#elif \ + ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ + ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ + ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) + + typedef bool (this_type::*unspecified_bool_type)() const; + + static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr) + { + return x ? &this_type::detail_safe_bool_member_fn : 0; + } +private: + bool detail_safe_bool_member_fn() const { return false; } +#else + typedef DataMemberPtr unspecified_bool_type; + static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr p) + { + return x ? p : 0; + } +#endif +private: + safe_bool(); + safe_bool(const safe_bool&); + void operator=(const safe_bool&); + ~safe_bool(); +}; + + } // namespace range_detail +} // namespace boost + +#endif // include guard diff --git a/include/boost/range/end.hpp b/include/boost/range/end.hpp index 3063c02..d5e6526 100644 --- a/include/boost/range/end.hpp +++ b/include/boost/range/end.hpp @@ -88,6 +88,9 @@ namespace range_detail } // namespace 'range_detail' #endif +namespace range_adl_barrier +{ + template< class T > inline BOOST_DEDUCED_TYPENAME range_iterator::type end( T& r ) { @@ -110,22 +113,24 @@ inline BOOST_DEDUCED_TYPENAME range_iterator::type end( const T& r ) return range_end( r ); } + } // namespace range_adl_barrier } // namespace 'boost' - - #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - namespace boost { - template< class T > - inline BOOST_DEDUCED_TYPENAME range_iterator::type - const_end( const T& r ) + namespace range_adl_barrier { - return boost::end( r ); - } -} + template< class T > + inline BOOST_DEDUCED_TYPENAME range_iterator::type + const_end( const T& r ) + { + return boost::range_adl_barrier::end( r ); + } + } // namespace range_adl_barrier + using namespace range_adl_barrier; +} // namespace boost #endif diff --git a/include/boost/range/iterator_range_core.hpp b/include/boost/range/iterator_range_core.hpp index ab1e80e..7664c2e 100755 --- a/include/boost/range/iterator_range_core.hpp +++ b/include/boost/range/iterator_range_core.hpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -81,7 +82,6 @@ namespace boost struct range_tag { }; struct const_range_tag { }; - } // iterator range template class -----------------------------------------// @@ -106,13 +106,14 @@ namespace boost template class iterator_range { + typedef range_detail::safe_bool< IteratorT iterator_range::* > safe_bool_t; protected: // Used by sub_range //! implementation class typedef iterator_range_detail::iterator_range_impl impl; public: - //! this type typedef iterator_range type; + typedef BOOST_DEDUCED_TYPENAME safe_bool_t::unspecified_bool_type unspecified_bool_type; //BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(value_type); //! Encapsulated value type @@ -238,18 +239,15 @@ namespace boost return m_Begin == m_End; } -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - operator bool() const - { - return !empty(); - } -#else - typedef iterator (iterator_range::*unspecified_bool_type) () const; operator unspecified_bool_type() const { - return empty() ? 0: &iterator_range::end; + return safe_bool_t::to_unspecified_bool(m_Begin != m_End, &iterator_range::m_Begin); + } + + bool operator!() const + { + return empty(); } -#endif bool equal( const iterator_range& r ) const { diff --git a/include/boost/range/size.hpp b/include/boost/range/size.hpp index 2636905..4b4eebe 100644 --- a/include/boost/range/size.hpp +++ b/include/boost/range/size.hpp @@ -15,7 +15,7 @@ # pragma once #endif -#include +#include #include #include #include @@ -25,44 +25,25 @@ namespace boost { namespace range_detail { - template< class SinglePassRange > + template inline BOOST_DEDUCED_TYPENAME range_difference::type - size_impl(const SinglePassRange& rng, boost::single_pass_traversal_tag) - { - typedef BOOST_DEDUCED_TYPENAME range_difference::type diff_t; - - // A compilation error here will often indicate that an algorithm - // is attempting to use boost::size(rng) for a range that is not a - // model of the RandomAccessRange Concept and does not have a - // member size() function. - // The solution to this issue is to add a range_calculate_size() - // function for the range type that will be found via ADL. - return static_cast(rng.size()); - } - - template< class SinglePassRange > - inline BOOST_DEDUCED_TYPENAME range_difference::type - size_impl(const SinglePassRange& rng, boost::random_access_traversal_tag) + range_calculate_size(const SinglePassRange& rng) { BOOST_ASSERT( (boost::end(rng) - boost::begin(rng)) >= 0 && "reachability invariant broken!" ); return boost::end(rng) - boost::begin(rng); } - } // namespace range_detail - - template - inline BOOST_DEDUCED_TYPENAME range_difference::type - range_calculate_size(const SinglePassRange& rng) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - typedef BOOST_DEDUCED_TYPENAME iterator_traversal::type traversal_tag; - return range_detail::size_impl(rng, traversal_tag()); } template inline BOOST_DEDUCED_TYPENAME range_difference::type size(const SinglePassRange& rng) { +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ + !BOOST_WORKAROUND(__GNUC__, < 3) \ + /**/ + using namespace range_detail; +#endif return range_calculate_size(rng); } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index b52d869..e0087fb 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -59,6 +59,8 @@ test-suite range : [ range-test adaptor_test/sliced_example ] [ range-test adaptor_test/strided_example ] [ range-test adaptor_test/transformed_example ] + [ range-test adaptor_test/type_erased ] + [ range-test adaptor_test/type_erased_example ] [ range-test adaptor_test/uniqued_example ] [ range-test algorithm_test/adjacent_find ] [ range-test algorithm_test/binary_search ] @@ -131,11 +133,13 @@ test-suite range : [ range-test algorithm_example ] [ range-test array ] # [ range-test atl : $(VC71_ROOT)/atlmfc/include ] + [ range-test begin ] [ range-test combine ] [ range-test compat2 ] [ range-test compat3 ] [ range-test const_ranges ] [ range-test counting_range ] + [ range-test end ] [ range-test extension_mechanism ] [ range-test extension_size ] [ range-test has_range_iterator ] diff --git a/test/adaptor_test/strided.cpp b/test/adaptor_test/strided.cpp index 04f1f21..91beb81 100644 --- a/test/adaptor_test/strided.cpp +++ b/test/adaptor_test/strided.cpp @@ -128,10 +128,10 @@ namespace boost typedef boost::strided_range strided_range_t; strided_range_t rng( boost::adaptors::stride(c, 0) ); - typedef typename boost::range_iterator::type iter_t; + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; - iter_t first(boost::begin(c), 0, 0, boost::size(c)); - iter_t last(boost::end(c), 0, boost::size(c), boost::size(c)); + iter_t first(boost::begin(c), boost::begin(c), boost::end(c), 0); + iter_t last(boost::begin(c), boost::end(c), boost::end(c), 0); iter_t it = first; for (int i = 0; i < 10; ++i, ++it) @@ -206,16 +206,6 @@ namespace boost ++(this->base_reference()); } - bool equal(const strided_mock_iterator& other) const - { - return this->base() == other.base(); - } - - BOOST_DEDUCED_TYPENAME super_t::reference dereference() const - { - return *(this->base()); - } - friend class boost::iterator_core_access; }; diff --git a/test/adaptor_test/type_erased.cpp b/test/adaptor_test/type_erased.cpp new file mode 100644 index 0000000..fd3ee5f --- /dev/null +++ b/test/adaptor_test/type_erased.cpp @@ -0,0 +1,481 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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 + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace boost_range_adaptor_type_erased_test +{ + class MockType + { + public: + MockType() + : m_x(0) + { + } + + MockType(int x) + : m_x(x) + { + } + + int get() const { return m_x; } + + inline bool operator==(const MockType& other) const + { + return m_x == other.m_x; + } + + inline bool operator!=(const MockType& other) const + { + return m_x != other.m_x; + } + + private: + int m_x; + }; + + inline std::ostream& operator<<(std::ostream& out, const MockType& obj) + { + out << obj.get(); + return out; + } + + template + void test_type_erased_impl(Container& c) + { + using namespace boost::adaptors; + typedef typename boost::range_value::type value_type; + typedef typename boost::adaptors::type_erased<> type_erased_t; + + + std::vector output; + + boost::push_back(output, boost::adaptors::type_erase(c, type_erased_t())); + + BOOST_CHECK_EQUAL_COLLECTIONS( output.begin(), output.end(), + c.begin(), c.end() ); + + output.clear(); + boost::push_back(output, c | type_erased_t()); + + BOOST_CHECK_EQUAL_COLLECTIONS( output.begin(), output.end(), + c.begin(), c.end() ); + } + + template + void test_const_and_mutable(Container& c) + { + test_type_erased_impl(c); + + const Container& const_c = c; + test_type_erased_impl(const_c); + } + + template + void test_driver() + { + using namespace boost::assign; + + typedef typename boost::range_value::type value_type; + + Container c; + test_const_and_mutable(c); + + c += value_type(1); + test_const_and_mutable(c); + + c += value_type(2); + test_const_and_mutable(c); + } + + void test_type_erased() + { + test_driver< std::list >(); + test_driver< std::vector >(); + + test_driver< std::list >(); + test_driver< std::vector >(); + } + + template< + class Traversal + , class Container + > + void test_writeable(Container&, boost::single_pass_traversal_tag) + {} + + template< + class Traversal + , class Container + > + void test_writeable(Container& source, boost::forward_traversal_tag) + { + using namespace boost::adaptors; + + typedef typename boost::range_value::type value_type; + typedef typename boost::range_difference::type difference_type; + typedef typename boost::range_reference::type mutable_reference_type; + typedef boost::any_range< + value_type + , Traversal + , mutable_reference_type + , difference_type + > mutable_any_range; + + mutable_any_range r = source | boost::adaptors::type_erased<>(); + std::vector output_test; + boost::fill(r, value_type(1)); + BOOST_CHECK_EQUAL( boost::distance(r), boost::distance(source) ); + std::vector reference_output(source.size(), value_type(1)); + BOOST_CHECK_EQUAL_COLLECTIONS( reference_output.begin(), reference_output.end(), + r.begin(), r.end() ); + + } + + template< + class Container + , class Traversal + , class Buffer + > + void test_type_erased_impl() + { + using namespace boost::adaptors; + + typedef Buffer buffer_type; + + typedef typename boost::range_value::type value_type; + + typedef typename boost::any_range_type_generator< + Container + , boost::use_default + , Traversal + , boost::use_default + , boost::use_default + , Buffer + >::type mutable_any_range; + + typedef typename boost::any_range_type_generator< + const Container + , boost::use_default + , Traversal + , boost::use_default + , boost::use_default + , Buffer + >::type const_any_range; + + typedef boost::adaptors::type_erased< + boost::use_default + , Traversal + , boost::use_default + , boost::use_default + , Buffer + > type_erased_t; + + Container source; + for (int i = 0; i < 10; ++i) + source.push_back(value_type(i)); + + mutable_any_range r(source); + BOOST_CHECK_EQUAL_COLLECTIONS( source.begin(), source.end(), + r.begin(), r.end() ); + + r = mutable_any_range(); + BOOST_CHECK_EQUAL( r.empty(), true ); + + r = source | type_erased_t(); + BOOST_CHECK_EQUAL_COLLECTIONS( source.begin(), source.end(), + r.begin(), r.end() ); + r = mutable_any_range(); + + r = boost::adaptors::type_erase(source, type_erased_t()); + BOOST_CHECK_EQUAL_COLLECTIONS( source.begin(), source.end(), + r.begin(), r.end() ); + r = mutable_any_range(); + + test_writeable(source, Traversal()); + + // convert and construct a const any_range from a mutable source + // range + const_any_range cr(source); + BOOST_CHECK_EQUAL_COLLECTIONS( source.begin(), source.end(), + cr.begin(), cr.end() ); + // assign an empty range and ensure that this correctly results + // in an empty range. This is important for the validity of + // the rest of the tests. + cr = const_any_range(); + BOOST_CHECK_EQUAL( cr.empty(), true ); + + // Test the pipe type_erased adaptor from a constant source + // range to a constant any_range + const Container& const_source = source; + cr = const_any_range(); + cr = const_source | type_erased_t(); + BOOST_CHECK_EQUAL_COLLECTIONS( const_source.begin(), const_source.end(), + cr.begin(), cr.end() ); + + // Test the pipe type erased adaptor from a mutable source + // range to a constant any_range + cr = const_any_range(); + cr = source | type_erased_t(); + BOOST_CHECK_EQUAL_COLLECTIONS( source.begin(), source.end(), + cr.begin(), cr.end() ); + + // Use the function form of the type_erase adaptor from a constant + // source range + cr = const_any_range(); + cr = boost::adaptors::type_erase(const_source, type_erased_t()); + BOOST_CHECK_EQUAL_COLLECTIONS( const_source.begin(), const_source.end(), + cr.begin(), cr.end() ); + + // Assignment from mutable to const... + cr = const_any_range(); + cr = r; + BOOST_CHECK_EQUAL_COLLECTIONS( cr.begin(), cr.end(), + r.begin(), r.end() ); + + // Converting copy from mutable to const... + cr = const_any_range(); + cr = const_any_range(r); + BOOST_CHECK_EQUAL_COLLECTIONS( cr.begin(), cr.end(), + r.begin(), r.end() ); + } + + template< + class Container + , class Traversal + , class Buffer + > + class test_type_erased_impl_fn + { + public: + typedef void result_type; + void operator()() + { + test_type_erased_impl< Container, Traversal, Buffer >(); + } + }; + + template< + class Container + , class Traversal + > + void test_type_erased_exercise_buffer_types() + { + using boost::any_iterator_default_buffer; + using boost::any_iterator_buffer; + using boost::any_iterator_heap_only_buffer; + using boost::any_iterator_stack_only_buffer; + + test_type_erased_impl_fn< Container, Traversal, any_iterator_default_buffer >()(); + test_type_erased_impl_fn< Container, Traversal, any_iterator_heap_only_buffer >()(); + test_type_erased_impl_fn< Container, Traversal, any_iterator_buffer<1> >()(); + test_type_erased_impl_fn< Container, Traversal, any_iterator_buffer<2> >()(); + test_type_erased_impl_fn< Container, Traversal, any_iterator_buffer<32> >()(); + test_type_erased_impl_fn< Container, Traversal, any_iterator_buffer<64> >()(); + test_type_erased_impl_fn< Container, Traversal, any_iterator_buffer<128> >()(); + test_type_erased_impl_fn< Container, Traversal, any_iterator_stack_only_buffer<128> >()(); + } + + void test_type_erased_single_pass() + { + test_type_erased_exercise_buffer_types< std::list, boost::single_pass_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::deque, boost::single_pass_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::vector, boost::single_pass_traversal_tag >(); + + test_type_erased_exercise_buffer_types< std::list, boost::single_pass_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::deque, boost::single_pass_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::vector, boost::single_pass_traversal_tag >(); + } + + void test_type_erased_forward() + { + test_type_erased_exercise_buffer_types< std::list, boost::forward_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::deque, boost::forward_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::vector, boost::forward_traversal_tag >(); + + test_type_erased_exercise_buffer_types< std::list, boost::forward_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::deque, boost::forward_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::vector, boost::forward_traversal_tag >(); + } + + void test_type_erased_bidirectional() + { + test_type_erased_exercise_buffer_types< std::list, boost::bidirectional_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::deque, boost::bidirectional_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::vector, boost::bidirectional_traversal_tag >(); + + test_type_erased_exercise_buffer_types< std::list, boost::bidirectional_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::deque, boost::bidirectional_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::vector, boost::bidirectional_traversal_tag >(); + } + + void test_type_erased_random_access() + { + test_type_erased_exercise_buffer_types< std::deque, boost::random_access_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::vector, boost::random_access_traversal_tag >(); + + test_type_erased_exercise_buffer_types< std::deque, boost::random_access_traversal_tag >(); + test_type_erased_exercise_buffer_types< std::vector, boost::random_access_traversal_tag >(); + } + + void test_type_erased_multiple_different_template_parameter_conversion() + { + typedef boost::any_range< + int + , boost::random_access_traversal_tag + , int& + , std::ptrdiff_t + > source_range_type; + + typedef boost::any_range< + int + , boost::single_pass_traversal_tag + , const int& + , std::ptrdiff_t + > target_range_type; + + source_range_type source; + + // Converting via construction + target_range_type t1(source); + + // Converting via assignment + target_range_type t2; + t2 = source; + + // Converting via construction to a type with a reference type + // that is a value + typedef boost::any_range< + int + , boost::single_pass_traversal_tag + , int + , std::ptrdiff_t + > target_range2_type; + + target_range2_type t3(source); + target_range2_type t4; + t4 = source; + } + + template< + class Traversal + , class ValueType + , class SourceValueType + , class SourceReference + , class TargetValueType + , class TargetReference + > + void test_type_erased_mix_values_impl() + { + typedef std::vector< ValueType > Container; + + typedef typename boost::any_range_type_generator< + Container + , SourceValueType + , Traversal + , SourceReference + >::type source_type; + + typedef typename boost::any_range_type_generator< + Container + , TargetValueType + , Traversal + , TargetReference + >::type target_type; + + Container test_data; + for (int i = 0; i < 10; ++i) + test_data.push_back(i); + + const source_type source_data(test_data); + target_type t1(source_data); + BOOST_CHECK_EQUAL_COLLECTIONS( source_data.begin(), source_data.end(), + t1.begin(), t1.end() ); + + target_type t2; + t2 = source_data; + BOOST_CHECK_EQUAL_COLLECTIONS( source_data.begin(), source_data.end(), + t2.begin(), t2.end() ); + } + + template + void test_type_erased_mix_values_driver() + { + test_type_erased_mix_values_impl< Traversal, int, char, const int&, short, const int& >(); + test_type_erased_mix_values_impl< Traversal, int, int*, const int&, char, const int& >(); + test_type_erased_mix_values_impl< Traversal, MockType, char, const MockType&, short, const MockType& >(); + + // In fact value type should have no effect in the eligibility + // for conversion, hence we should be able to convert it + // completely backwards! + test_type_erased_mix_values_impl< Traversal, int, short, const int&, char, const int& >(); + test_type_erased_mix_values_impl< Traversal, int, char, const int&, int*, const int& >(); + } + + void test_type_erased_mix_values() + { + test_type_erased_mix_values_driver< boost::single_pass_traversal_tag >(); + test_type_erased_mix_values_driver< boost::forward_traversal_tag >(); + test_type_erased_mix_values_driver< boost::bidirectional_traversal_tag >(); + test_type_erased_mix_values_driver< boost::random_access_traversal_tag >(); + } + + void test_type_erased_operator_brackets() + { + typedef boost::adaptors::type_erased<> type_erased_t; + + std::vector c; + for (int i = 0; i < 10; ++i) + c.push_back(i); + + typedef boost::any_range< + int + , boost::random_access_traversal_tag + , int + , boost::range_difference< std::vector >::type + , boost::use_default + > any_range_type; + + any_range_type rng = c | type_erased_t(); + + for (int i = 0; i < 10; ++i) + { + BOOST_CHECK_EQUAL( rng[i], i ); + } + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.adaptor.type_erased" ); + + test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased ) ); + test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_single_pass ) ); + test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_forward ) ); + test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_bidirectional ) ); + test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_random_access ) ); + test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_multiple_different_template_parameter_conversion ) ); + test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_mix_values ) ); + test->add( BOOST_TEST_CASE( &boost_range_adaptor_type_erased_test::test_type_erased_operator_brackets ) ); + + return test; +} diff --git a/test/adaptor_test/type_erased_example.cpp b/test/adaptor_test/type_erased_example.cpp new file mode 100644 index 0000000..754fba6 --- /dev/null +++ b/test/adaptor_test/type_erased_example.cpp @@ -0,0 +1,115 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace +{ + namespace boost_range_test + { + namespace type_erased_example + { + +// The client interface from an OO perspective merely requires a sequence +// of integers that can be forward traversed +typedef boost::any_range< + int + , boost::forward_traversal_tag + , int + , std::ptrdiff_t +> integer_range; + +namespace server +{ + void display_integers(const integer_range& rng) + { + boost::copy(rng, + std::ostream_iterator(std::cout, ",")); + + std::cout << std::endl; + } +} + +namespace client +{ + void run() + { + using namespace boost::assign; + using namespace boost::adaptors; + + // Under most conditions one would simply use an appropriate + // any_range as a function parameter. The type_erased adaptor + // is often superfluous. However because the type_erased + // adaptor is applied to a range, we can use default template + // arguments that are generated in conjunction with the + // range type to which we are applying the adaptor. + + std::vector input; + input += 1,2,3,4,5; + + // Note that this call is to a non-template function + server::display_integers(input); + + std::list input2; + input2 += 6,7,8,9,10; + + // Note that this call is to the same non-tempate function + server::display_integers(input2); + + input2.clear(); + input2 += 11,12,13,14,15; + + // Calling using the adaptor looks like this: + // Notice that here I have a type_erased that would be a + // bidirectional_traversal_tag, but this is convertible + // to the forward_traversal_tag equivalent hence this + // works. + server::display_integers(input2 | type_erased<>()); + + // However we may simply wish to define an adaptor that + // takes a range and makes it into an appropriate + // forward_traversal any_range... + typedef boost::adaptors::type_erased< + boost::use_default + , boost::forward_traversal_tag + > type_erased_forward; + + // This adaptor can turn other containers with different + // value_types and reference_types into the appropriate + // any_range. + + server::display_integers(input2 | type_erased_forward()); + } +} + + } // namespace type_erased_example + } // namespace boost_range_test +} // anonymous namespace + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.adaptor.type_erased_example" ); + + test->add( BOOST_TEST_CASE( &boost_range_test::type_erased_example::client::run) ); + + return test; +} diff --git a/test/algorithm_test/count_if.cpp b/test/algorithm_test/count_if.cpp index a2e8983..e028741 100644 --- a/test/algorithm_test/count_if.cpp +++ b/test/algorithm_test/count_if.cpp @@ -33,6 +33,7 @@ namespace boost using namespace boost::assign; typedef equal_to_x pred_t; + typedef BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type diff_t; Container cont; const Container& cref_cont = cont; @@ -72,9 +73,9 @@ namespace boost BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, false_predicate()) ); BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), false_predicate()) ); - BOOST_CHECK_EQUAL( boost::size(cont), boost::count_if(cont, true_predicate()) ); - BOOST_CHECK_EQUAL( boost::size(cont), boost::count_if(cref_cont, true_predicate()) ); - BOOST_CHECK_EQUAL( boost::size(cont), boost::count_if(boost::make_iterator_range(cont), true_predicate()) ); + BOOST_CHECK_EQUAL( static_cast(cont.size()), boost::count_if(cont, true_predicate()) ); + BOOST_CHECK_EQUAL( static_cast(cont.size()), boost::count_if(cref_cont, true_predicate()) ); + BOOST_CHECK_EQUAL( static_cast(cont.size()), boost::count_if(boost::make_iterator_range(cont), true_predicate()) ); } void test_count_if() diff --git a/test/algorithm_test/find.cpp b/test/algorithm_test/find.cpp index 6eb1528..d785ac8 100644 --- a/test/algorithm_test/find.cpp +++ b/test/algorithm_test/find.cpp @@ -22,85 +22,82 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_find { - namespace + class find_test_policy { - class find_test_policy + public: + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - public: - template - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::find(cont, 3); + iter_t result2 = boost::find(boost::make_iterator_range(cont), 3); + BOOST_CHECK( result == result2 ); + return result; + } + + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy&, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::find(cont, 3); - iter_t result2 = boost::find(boost::make_iterator_range(cont), 3); + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::find(cont, 3); + result_t result2 = boost::find(boost::make_iterator_range(cont), 3); BOOST_CHECK( result == result2 ); return result; } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::find(cont, 3); - result_t result2 = boost::find(boost::make_iterator_range(cont), 3); - BOOST_CHECK( result == result2 ); - return result; - } - }; - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::find(cont.begin(), cont.end(), 3); - } }; template - void test_find_container() + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - using namespace boost::assign; - - typedef BOOST_DEDUCED_TYPENAME remove_const::type container_t; - - range_test::range_return_test_driver test_driver; - - container_t mcont; - Container& cont = mcont; - test_driver(cont, find_test_policy()); - - mcont.clear(); - mcont += 1; - test_driver(cont, find_test_policy()); - - mcont.clear(); - mcont += 1,2,3,4,5,6,7,8,9; - test_driver(cont, find_test_policy()); + return std::find(cont.begin(), cont.end(), 3); } + }; - void test_find() - { - test_find_container< std::vector >(); - test_find_container< std::list >(); - test_find_container< std::deque >(); + template + void test_find_container() + { + using namespace boost::assign; - test_find_container< const std::vector >(); - test_find_container< const std::list >(); - test_find_container< const std::deque >(); + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container_t; - std::vector vi; - const std::vector& cvi = vi; - std::vector::const_iterator it = boost::find(vi, 0); - std::vector::const_iterator it2 = boost::find(cvi, 0); - BOOST_CHECK( it == it2 ); - } + boost::range_test::range_return_test_driver test_driver; + + container_t mcont; + Container& cont = mcont; + test_driver(cont, find_test_policy()); + + mcont.clear(); + mcont += 1; + test_driver(cont, find_test_policy()); + + mcont.clear(); + mcont += 1,2,3,4,5,6,7,8,9; + test_driver(cont, find_test_policy()); + } + + void test_find() + { + test_find_container< std::vector >(); + test_find_container< std::list >(); + test_find_container< std::deque >(); + + test_find_container< const std::vector >(); + test_find_container< const std::list >(); + test_find_container< const std::deque >(); + + std::vector vi; + const std::vector& cvi = vi; + std::vector::const_iterator it = boost::find(vi, 0); + std::vector::const_iterator it2 = boost::find(cvi, 0); + BOOST_CHECK( it == it2 ); } } @@ -110,7 +107,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find" ); - test->add( BOOST_TEST_CASE( &boost::test_find ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_find::test_find ) ); return test; } diff --git a/test/algorithm_test/find_end.cpp b/test/algorithm_test/find_end.cpp index 0592d5f..b4d77a0 100644 --- a/test/algorithm_test/find_end.cpp +++ b/test/algorithm_test/find_end.cpp @@ -21,173 +21,170 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_find_end { - namespace + template + class find_end_test_policy { - template - class find_end_test_policy + typedef Container2 container2_t; + public: + explicit find_end_test_policy(const Container2& cont) + : m_cont(cont) { - typedef Container2 container2_t; - public: - explicit find_end_test_policy(const Container2& cont) - : m_cont(cont) - { - } + } - container2_t cont() { return m_cont; } + container2_t cont() { return m_cont; } - template - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::find_end(cont, m_cont); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), m_cont) ); + BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(m_cont)) ); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont)) ); + return result; + } + + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::find_end(cont, m_cont); - BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), m_cont) ); - BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(m_cont)) ); - BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont)) ); + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::find_end(cont, policy.cont()); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), policy.cont()) ); + BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(policy.cont())) ); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), + boost::make_iterator_range(policy.cont())) ); return result; } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::find_end(cont, policy.cont()); - BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), policy.cont()) ); - BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(policy.cont())) ); - BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), - boost::make_iterator_range(policy.cont())) ); - return result; - } - }; - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::find_end(cont.begin(), cont.end(), - m_cont.begin(), m_cont.end()); - } - - private: - Container2 m_cont; }; - template - class find_end_pred_test_policy + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - typedef Container2 container2_t; - public: - explicit find_end_pred_test_policy(const Container2& cont) - : m_cont(cont) + return std::find_end(cont.begin(), cont.end(), + m_cont.begin(), m_cont.end()); + } + + private: + Container2 m_cont; + }; + + template + class find_end_pred_test_policy + { + typedef Container2 container2_t; + public: + explicit find_end_pred_test_policy(const Container2& cont) + : m_cont(cont) + { + } + + container2_t& cont() { return m_cont; } + BinaryPredicate& pred() { return m_pred; } + + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t it = boost::find_end(cont, m_cont, m_pred); + BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), m_cont, m_pred) ); + BOOST_CHECK( it == boost::find_end(cont, boost::make_iterator_range(m_cont), m_pred) ); + BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont), m_pred) ); + return it; + } + + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::find_end(cont, policy.cont(), policy.pred()); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), policy.cont(), policy.pred()) ); + BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(policy.cont()), policy.pred()) ); + BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), + boost::make_iterator_range(policy.cont()), policy.pred()) ); + return boost::find_end(cont, policy.cont(), policy.pred()); } - - container2_t& cont() { return m_cont; } - BinaryPredicate& pred() { return m_pred; } - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t it = boost::find_end(cont, m_cont, m_pred); - BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), m_cont, m_pred) ); - BOOST_CHECK( it == boost::find_end(cont, boost::make_iterator_range(m_cont), m_pred) ); - BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont), m_pred) ); - return it; - } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::find_end(cont, policy.cont(), policy.pred()); - BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), policy.cont(), policy.pred()) ); - BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(policy.cont()), policy.pred()) ); - BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), - boost::make_iterator_range(policy.cont()), policy.pred()) ); - return boost::find_end(cont, policy.cont(), policy.pred()); - } - }; - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::find_end(cont.begin(), cont.end(), - m_cont.begin(), m_cont.end(), - m_pred); - } - - private: - Container2 m_cont; - BinaryPredicate m_pred; }; - template - void run_tests(Container1& cont1, Container2& cont2) + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - range_test::range_return_test_driver test_driver; - test_driver(cont1, find_end_test_policy(cont2)); - test_driver(cont1, find_end_pred_test_policy >(cont2)); - test_driver(cont2, find_end_pred_test_policy >(cont2)); + return std::find_end(cont.begin(), cont.end(), + m_cont.begin(), m_cont.end(), + m_pred); } - template - void test_find_end_impl() - { - using namespace boost::assign; + private: + Container2 m_cont; + BinaryPredicate m_pred; + }; - typedef BOOST_DEDUCED_TYPENAME remove_const::type container1_t; - typedef BOOST_DEDUCED_TYPENAME remove_const::type container2_t; + template + void run_tests(Container1& cont1, Container2& cont2) + { + boost::range_test::range_return_test_driver test_driver; + test_driver(cont1, find_end_test_policy(cont2)); + test_driver(cont1, find_end_pred_test_policy >(cont2)); + test_driver(cont2, find_end_pred_test_policy >(cont2)); + } - container1_t mcont1; - Container1& cont1 = mcont1; - container2_t mcont2; - Container2& cont2 = mcont2; + template + void test_find_end_impl() + { + using namespace boost::assign; - run_tests(cont1, cont2); + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container1_t; + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container2_t; - mcont1 += 1; - run_tests(cont1, cont2); + container1_t mcont1; + Container1& cont1 = mcont1; + container2_t mcont2; + Container2& cont2 = mcont2; - mcont2 += 1; - run_tests(cont1, cont2); + run_tests(cont1, cont2); - mcont1 += 2,3,4,5,6,7,8,9; - mcont2 += 2,3,4; - run_tests(cont1, cont2); + mcont1 += 1; + run_tests(cont1, cont2); - mcont2.clear(); - mcont2 += 7,8,9; - run_tests(cont1, cont2); - } + mcont2 += 1; + run_tests(cont1, cont2); - void test_find_end() - { - test_find_end_impl< std::vector, std::vector >(); - test_find_end_impl< std::list, std::list >(); - test_find_end_impl< std::deque, std::deque >(); - test_find_end_impl< const std::vector, const std::vector >(); - test_find_end_impl< const std::list, const std::list >(); - test_find_end_impl< const std::deque, const std::deque >(); - test_find_end_impl< const std::vector, const std::list >(); - test_find_end_impl< const std::list, const std::vector >(); - test_find_end_impl< const std::vector, std::list >(); - test_find_end_impl< const std::list, std::vector >(); - test_find_end_impl< std::vector, std::list >(); - test_find_end_impl< std::list, std::vector >(); - } + mcont1 += 2,3,4,5,6,7,8,9; + mcont2 += 2,3,4; + run_tests(cont1, cont2); + + mcont2.clear(); + mcont2 += 7,8,9; + run_tests(cont1, cont2); + } + + void test_find_end() + { + test_find_end_impl< std::vector, std::vector >(); + test_find_end_impl< std::list, std::list >(); + test_find_end_impl< std::deque, std::deque >(); + test_find_end_impl< const std::vector, const std::vector >(); + test_find_end_impl< const std::list, const std::list >(); + test_find_end_impl< const std::deque, const std::deque >(); + test_find_end_impl< const std::vector, const std::list >(); + test_find_end_impl< const std::list, const std::vector >(); + test_find_end_impl< const std::vector, std::list >(); + test_find_end_impl< const std::list, std::vector >(); + test_find_end_impl< std::vector, std::list >(); + test_find_end_impl< std::list, std::vector >(); } } @@ -197,7 +194,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_end" ); - test->add( BOOST_TEST_CASE( &boost::test_find_end ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_find_end::test_find_end ) ); return test; } diff --git a/test/algorithm_test/find_first_of.cpp b/test/algorithm_test/find_first_of.cpp index c96d36a..296b8fc 100644 --- a/test/algorithm_test/find_first_of.cpp +++ b/test/algorithm_test/find_first_of.cpp @@ -21,171 +21,168 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_find_first_of { - namespace + template + class find_first_of_test_policy { - template - class find_first_of_test_policy + typedef Container2 container2_t; + public: + explicit find_first_of_test_policy(const Container2& cont) + : m_cont(cont) { - typedef Container2 container2_t; - public: - explicit find_first_of_test_policy(const Container2& cont) - : m_cont(cont) - { - } + } - container2_t& cont() { return m_cont; } + container2_t& cont() { return m_cont; } - template - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::find_first_of(cont, m_cont); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont) ); + BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont)) ); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont)) ); + return result; + } + + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::find_first_of(cont, m_cont); - BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont) ); - BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont)) ); - BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont)) ); + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::find_first_of(cont, policy.cont()); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), policy.cont()) ); + BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(policy.cont())) ); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(policy.cont())) ); return result; } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::find_first_of(cont, policy.cont()); - BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), policy.cont()) ); - BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(policy.cont())) ); - BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(policy.cont())) ); - return result; - } - }; - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::find_first_of(cont.begin(), cont.end(), - m_cont.begin(), m_cont.end()); - } - - private: - Container2 m_cont; }; - template - class find_first_of_pred_test_policy + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - typedef Container2 container2_t; - public: - explicit find_first_of_pred_test_policy(const Container2& cont) - : m_cont(cont) - { - } + return std::find_first_of(cont.begin(), cont.end(), + m_cont.begin(), m_cont.end()); + } - container2_t& cont() { return m_cont; } - BinaryPredicate& pred() { return m_pred; } + private: + Container2 m_cont; + }; - template - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + template + class find_first_of_pred_test_policy + { + typedef Container2 container2_t; + public: + explicit find_first_of_pred_test_policy(const Container2& cont) + : m_cont(cont) + { + } + + container2_t& cont() { return m_cont; } + BinaryPredicate& pred() { return m_pred; } + + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::find_first_of(cont, m_cont, m_pred); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont, m_pred) ); + BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont), m_pred) ); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont), m_pred) ); + return result; + } + + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::find_first_of(cont, m_cont, m_pred); - BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont, m_pred) ); - BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont), m_pred) ); - BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont), m_pred) ); + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::find_first_of(cont, policy.cont(), policy.pred()); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), policy.cont(), policy.pred()) ); + BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(policy.cont()), policy.pred()) ); + BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(policy.cont()), policy.pred()) ); return result; } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::find_first_of(cont, policy.cont(), policy.pred()); - BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), policy.cont(), policy.pred()) ); - BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(policy.cont()), policy.pred()) ); - BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(policy.cont()), policy.pred()) ); - return result; - } - }; - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::find_first_of(cont.begin(), cont.end(), - m_cont.begin(), m_cont.end(), - m_pred); - } - - private: - Container2 m_cont; - BinaryPredicate m_pred; }; - template - void run_tests(Container1& cont1, Container2& cont2) + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - range_test::range_return_test_driver test_driver; - test_driver(cont1, find_first_of_test_policy(cont2)); - test_driver(cont1, find_first_of_pred_test_policy >(cont2)); - test_driver(cont2, find_first_of_pred_test_policy >(cont2)); + return std::find_first_of(cont.begin(), cont.end(), + m_cont.begin(), m_cont.end(), + m_pred); } - template - void test_find_first_of_impl() - { - using namespace boost::assign; + private: + Container2 m_cont; + BinaryPredicate m_pred; + }; - typedef BOOST_DEDUCED_TYPENAME remove_const::type container1_t; - typedef BOOST_DEDUCED_TYPENAME remove_const::type container2_t; + template + void run_tests(Container1& cont1, Container2& cont2) + { + boost::range_test::range_return_test_driver test_driver; + test_driver(cont1, find_first_of_test_policy(cont2)); + test_driver(cont1, find_first_of_pred_test_policy >(cont2)); + test_driver(cont2, find_first_of_pred_test_policy >(cont2)); + } - container1_t mcont1; - Container1& cont1 = mcont1; - container2_t mcont2; - Container2& cont2 = mcont2; + template + void test_find_first_of_impl() + { + using namespace boost::assign; - run_tests(cont1, cont2); + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container1_t; + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container2_t; - mcont1 += 1; - run_tests(cont1, cont2); + container1_t mcont1; + Container1& cont1 = mcont1; + container2_t mcont2; + Container2& cont2 = mcont2; - mcont2 += 1; - run_tests(cont1, cont2); + run_tests(cont1, cont2); - mcont1 += 2,3,4,5,6,7,8,9; - mcont2 += 2,3,4; - run_tests(cont1, cont2); + mcont1 += 1; + run_tests(cont1, cont2); - mcont2.clear(); - mcont2 += 7,8,9; - run_tests(cont1, cont2); - } + mcont2 += 1; + run_tests(cont1, cont2); - void test_find_first_of() - { - test_find_first_of_impl< std::vector, std::vector >(); - test_find_first_of_impl< std::list, std::list >(); - test_find_first_of_impl< std::deque, std::deque >(); - test_find_first_of_impl< const std::vector, const std::vector >(); - test_find_first_of_impl< const std::list, const std::list >(); - test_find_first_of_impl< const std::deque, const std::deque >(); - test_find_first_of_impl< const std::vector, const std::list >(); - test_find_first_of_impl< const std::list, const std::vector >(); - test_find_first_of_impl< const std::vector, std::list >(); - test_find_first_of_impl< const std::list, std::vector >(); - test_find_first_of_impl< std::vector, std::list >(); - test_find_first_of_impl< std::list, std::vector >(); - } + mcont1 += 2,3,4,5,6,7,8,9; + mcont2 += 2,3,4; + run_tests(cont1, cont2); + + mcont2.clear(); + mcont2 += 7,8,9; + run_tests(cont1, cont2); + } + + void test_find_first_of() + { + test_find_first_of_impl< std::vector, std::vector >(); + test_find_first_of_impl< std::list, std::list >(); + test_find_first_of_impl< std::deque, std::deque >(); + test_find_first_of_impl< const std::vector, const std::vector >(); + test_find_first_of_impl< const std::list, const std::list >(); + test_find_first_of_impl< const std::deque, const std::deque >(); + test_find_first_of_impl< const std::vector, const std::list >(); + test_find_first_of_impl< const std::list, const std::vector >(); + test_find_first_of_impl< const std::vector, std::list >(); + test_find_first_of_impl< const std::list, std::vector >(); + test_find_first_of_impl< std::vector, std::list >(); + test_find_first_of_impl< std::list, std::vector >(); } } @@ -195,7 +192,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_first_of" ); - test->add( BOOST_TEST_CASE( &boost::test_find_first_of ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_find_first_of::test_find_first_of ) ); return test; } diff --git a/test/algorithm_test/find_if.cpp b/test/algorithm_test/find_if.cpp index 04fe6f2..3ab22c9 100644 --- a/test/algorithm_test/find_if.cpp +++ b/test/algorithm_test/find_if.cpp @@ -23,97 +23,94 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_find_if { - namespace + template + class find_if_test_policy { - template - class find_if_test_policy - { - public: - explicit find_if_test_policy(UnaryPredicate pred) - : m_pred(pred) {} - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::find_if(cont, m_pred); - BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), m_pred) ); - return result; - } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(find_if_test_policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::find_if(cont, policy.pred()); - BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), policy.pred()) ); - return result; - } - }; - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::find_if(cont.begin(), cont.end(), m_pred); - } - - UnaryPredicate& pred() { return m_pred; } - - private: - UnaryPredicate m_pred; - }; - - template - find_if_test_policy - make_policy(UnaryPredicate pred) - { - return find_if_test_policy(pred); - } + public: + explicit find_if_test_policy(UnaryPredicate pred) + : m_pred(pred) {} template - void test_find_if_container() + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - using namespace boost::assign; - using namespace boost::range_test_function; - - typedef BOOST_DEDUCED_TYPENAME remove_const::type container_t; - - range_test::range_return_test_driver test_driver; - - container_t mcont; - Container& cont = mcont; - test_driver(cont, make_policy(greater_than_x(5))); - test_driver(cont, make_policy(false_predicate())); - - mcont.clear(); - mcont += 1; - test_driver(cont, make_policy(greater_than_x(5))); - test_driver(cont, make_policy(false_predicate())); - - mcont.clear(); - mcont += 1,2,3,4,5,6,7,8,9; - test_driver(cont, make_policy(greater_than_x(5))); - test_driver(cont, make_policy(false_predicate())); + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::find_if(cont, m_pred); + BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), m_pred) ); + return result; } - void test_find_if() + template + struct test_range { - test_find_if_container< std::vector >(); - test_find_if_container< std::list >(); - test_find_if_container< std::deque >(); + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(find_if_test_policy& policy, Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::find_if(cont, policy.pred()); + BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), policy.pred()) ); + return result; + } + }; - test_find_if_container< const std::vector >(); - test_find_if_container< const std::list >(); - test_find_if_container< const std::deque >(); + template + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) + { + return std::find_if(cont.begin(), cont.end(), m_pred); } + + UnaryPredicate& pred() { return m_pred; } + + private: + UnaryPredicate m_pred; + }; + + template + find_if_test_policy + make_policy(UnaryPredicate pred) + { + return find_if_test_policy(pred); + } + + template + void test_find_if_container() + { + using namespace boost::assign; + using namespace boost::range_test_function; + + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container_t; + + boost::range_test::range_return_test_driver test_driver; + + container_t mcont; + Container& cont = mcont; + test_driver(cont, make_policy(greater_than_x(5))); + test_driver(cont, make_policy(false_predicate())); + + mcont.clear(); + mcont += 1; + test_driver(cont, make_policy(greater_than_x(5))); + test_driver(cont, make_policy(false_predicate())); + + mcont.clear(); + mcont += 1,2,3,4,5,6,7,8,9; + test_driver(cont, make_policy(greater_than_x(5))); + test_driver(cont, make_policy(false_predicate())); + } + + void test_find_if() + { + test_find_if_container< std::vector >(); + test_find_if_container< std::list >(); + test_find_if_container< std::deque >(); + + test_find_if_container< const std::vector >(); + test_find_if_container< const std::list >(); + test_find_if_container< const std::deque >(); } } @@ -123,7 +120,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.find_if" ); - test->add( BOOST_TEST_CASE( &boost::test_find_if ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_find_if::test_find_if ) ); return test; } diff --git a/test/algorithm_test/lower_bound.cpp b/test/algorithm_test/lower_bound.cpp index e627708..2a120a4 100644 --- a/test/algorithm_test/lower_bound.cpp +++ b/test/algorithm_test/lower_bound.cpp @@ -22,164 +22,160 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_lower_bound { - namespace + class lower_bound_policy { - class lower_bound_policy + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::lower_bound(cont, 5); - BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) ); - return result; - } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::lower_bound(cont, 5); - BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) ); - return result; - } - }; - - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::lower_bound(cont.begin(), cont.end(), 5); - } - }; - - template< class BinaryPredicate > - struct lower_bound_pred_policy - { - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::lower_bound(cont, 5, m_pred); - BOOST_CHECK( result == boost::lower_bound( - boost::make_iterator_range(cont), 5, m_pred) ); - return result; - } - - template< range_return_value return_type > - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::lower_bound(cont, 5, policy.pred()); - BOOST_CHECK( result == boost::lower_bound( - boost::make_iterator_range(cont), 5, policy.pred()) ); - return result; - } - }; - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::lower_bound( - cont.begin(), cont.end(), 5, m_pred); - } - - BinaryPredicate& pred() { return m_pred; } - - private: - BinaryPredicate m_pred; - }; - - template - void test_lower_bound_impl(TestPolicy policy, BinaryPredicate pred) - { - using namespace boost::assign; - - typedef BOOST_DEDUCED_TYPENAME remove_const::type container_t; - typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; - - range_test::range_return_test_driver test_driver; - - container_t mcont; - Container& cont = mcont; - - test_driver(cont, policy); - - mcont.clear(); - mcont += 1; - - std::vector temp(mcont.begin(), mcont.end()); - std::sort(temp.begin(), temp.end(), pred); - mcont.assign(temp.begin(), temp.end()); - - test_driver(cont, policy); - - mcont.clear(); - mcont += 1,2,3,4,5,6,7,8,9; - - temp.assign(mcont.begin(), mcont.end()); - std::sort(temp.begin(), temp.end(), pred); - mcont.assign(temp.begin(), temp.end()); - - test_driver(cont, policy); + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::lower_bound(cont, 5); + BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) ); + return result; } + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy&, Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::lower_bound(cont, 5); + BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) ); + return result; + } + }; + + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) + { + return std::lower_bound(cont.begin(), cont.end(), 5); + } + }; + + template< class BinaryPredicate > + struct lower_bound_pred_policy + { + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::lower_bound(cont, 5, m_pred); + BOOST_CHECK( result == boost::lower_bound( + boost::make_iterator_range(cont), 5, m_pred) ); + return result; + } + + template< boost::range_return_value return_type > + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::lower_bound(cont, 5, policy.pred()); + BOOST_CHECK( result == boost::lower_bound( + boost::make_iterator_range(cont), 5, policy.pred()) ); + return result; + } + }; + template - void test_lower_bound_impl() + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - test_lower_bound_impl( - lower_bound_policy(), - std::less() - ); - - test_lower_bound_impl( - lower_bound_pred_policy >(), - std::less() - ); - - test_lower_bound_impl( - lower_bound_pred_policy >(), - std::greater() - ); + return std::lower_bound( + cont.begin(), cont.end(), 5, m_pred); } - void test_lower_bound() - { - test_lower_bound_impl< std::vector >(); - test_lower_bound_impl< std::list >(); - test_lower_bound_impl< std::deque >(); + BinaryPredicate& pred() { return m_pred; } - test_lower_bound_impl< const std::vector >(); - test_lower_bound_impl< const std::list >(); - test_lower_bound_impl< const std::deque >(); - } + private: + BinaryPredicate m_pred; + }; + + template + void test_lower_bound_impl(TestPolicy policy, BinaryPredicate pred) + { + using namespace boost::assign; + + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container_t; + typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; + + boost::range_test::range_return_test_driver test_driver; + + container_t mcont; + Container& cont = mcont; + + test_driver(cont, policy); + + mcont.clear(); + mcont += 1; + + std::vector temp(mcont.begin(), mcont.end()); + std::sort(temp.begin(), temp.end(), pred); + mcont.assign(temp.begin(), temp.end()); + + test_driver(cont, policy); + + mcont.clear(); + mcont += 1,2,3,4,5,6,7,8,9; + + temp.assign(mcont.begin(), mcont.end()); + std::sort(temp.begin(), temp.end(), pred); + mcont.assign(temp.begin(), temp.end()); + + test_driver(cont, policy); + } + + template + void test_lower_bound_impl() + { + test_lower_bound_impl( + lower_bound_policy(), + std::less() + ); + + test_lower_bound_impl( + lower_bound_pred_policy >(), + std::less() + ); + + test_lower_bound_impl( + lower_bound_pred_policy >(), + std::greater() + ); + } + + void test_lower_bound() + { + test_lower_bound_impl< std::vector >(); + test_lower_bound_impl< std::list >(); + test_lower_bound_impl< std::deque >(); + + test_lower_bound_impl< const std::vector >(); + test_lower_bound_impl< const std::list >(); + test_lower_bound_impl< const std::deque >(); } } - boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.lower_bound" ); - test->add( BOOST_TEST_CASE( &boost::test_lower_bound ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_lower_bound::test_lower_bound ) ); return test; } diff --git a/test/algorithm_test/max_element.cpp b/test/algorithm_test/max_element.cpp index c4c6cb9..9a26099 100644 --- a/test/algorithm_test/max_element.cpp +++ b/test/algorithm_test/max_element.cpp @@ -22,134 +22,131 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_max_element { - namespace + class max_element_test_policy { - class max_element_test_policy + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::max_element(cont); + BOOST_CHECK( result == boost::max_element( + boost::make_iterator_range(cont)) ); + return result; + } + + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy&, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::max_element(cont); - BOOST_CHECK( result == boost::max_element( + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::max_element(cont); + BOOST_CHECK( result == boost::max_element( boost::make_iterator_range(cont)) ); return result; } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::max_element(cont); - BOOST_CHECK( result == boost::max_element( - boost::make_iterator_range(cont)) ); - return result; - } - }; - - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::max_element(cont.begin(), cont.end()); - } }; - template - class max_element_pred_test_policy + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + return std::max_element(cont.begin(), cont.end()); + } + }; + + template + class max_element_pred_test_policy + { + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::max_element(cont, Pred()); + BOOST_CHECK( result == boost::max_element( + boost::make_iterator_range(cont), Pred()) ); + return result; + } + + Pred pred() const { return Pred(); } + + template< boost::range_return_value return_type > + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::max_element(cont, Pred()); - BOOST_CHECK( result == boost::max_element( - boost::make_iterator_range(cont), Pred()) ); + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::max_element(cont, policy.pred()); + BOOST_CHECK( result == boost::max_element( + boost::make_iterator_range(cont), policy.pred()) ); return result; } - - Pred pred() const { return Pred(); } - - template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::max_element(cont, policy.pred()); - BOOST_CHECK( result == boost::max_element( - boost::make_iterator_range(cont), policy.pred()) ); - return result; - } - }; - - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::max_element(cont.begin(), cont.end(), Pred()); - } }; - template - void test_max_element_impl(TestPolicy policy) + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - using namespace boost::assign; - - typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; - typedef BOOST_DEDUCED_TYPENAME remove_const::type container_t; - - range_test::range_return_test_driver test_driver; - - container_t cont; - - test_driver(cont, policy); - - cont.clear(); - cont += 1; - - test_driver(cont, policy); - - cont.clear(); - cont += 1,2,2,2,3,4,5,6,7,8,9; - - test_driver(cont, policy); + return std::max_element(cont.begin(), cont.end(), Pred()); } + }; - template - void test_max_element_impl() - { - test_max_element_impl(max_element_test_policy()); - - test_max_element_impl( - max_element_pred_test_policy >()); + template + void test_max_element_impl(TestPolicy policy) + { + using namespace boost::assign; - test_max_element_impl( - max_element_pred_test_policy >()); - } + typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container_t; - void test_max_element() - { - test_max_element_impl< const std::vector >(); - test_max_element_impl< const std::deque >(); - test_max_element_impl< const std::list >(); + boost::range_test::range_return_test_driver test_driver; - test_max_element_impl< std::vector >(); - test_max_element_impl< std::deque >(); - test_max_element_impl< std::list >(); - } + container_t cont; + + test_driver(cont, policy); + + cont.clear(); + cont += 1; + + test_driver(cont, policy); + + cont.clear(); + cont += 1,2,2,2,3,4,5,6,7,8,9; + + test_driver(cont, policy); + } + + template + void test_max_element_impl() + { + test_max_element_impl(max_element_test_policy()); + + test_max_element_impl( + max_element_pred_test_policy >()); + + test_max_element_impl( + max_element_pred_test_policy >()); + } + + void test_max_element() + { + test_max_element_impl< const std::vector >(); + test_max_element_impl< const std::deque >(); + test_max_element_impl< const std::list >(); + + test_max_element_impl< std::vector >(); + test_max_element_impl< std::deque >(); + test_max_element_impl< std::list >(); } } @@ -159,7 +156,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.max_element" ); - test->add( BOOST_TEST_CASE( &boost::test_max_element ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_max_element::test_max_element ) ); return test; } diff --git a/test/algorithm_test/min_element.cpp b/test/algorithm_test/min_element.cpp index c8fceda..0f9fa68 100644 --- a/test/algorithm_test/min_element.cpp +++ b/test/algorithm_test/min_element.cpp @@ -22,132 +22,129 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_min_element { - namespace + class min_element_test_policy { - class min_element_test_policy + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::min_element(cont); + BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) ); + return result; + } + + template< boost::range_return_value return_type > + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy&, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::min_element(cont); - BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) ); + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::min_element(cont); + BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) ); return result; } - - template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::min_element(cont); - BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) ); - return result; - } - }; - - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::min_element(cont.begin(), cont.end()); - } }; - template - class min_element_pred_test_policy + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + return std::min_element(cont.begin(), cont.end()); + } + }; + + template + class min_element_pred_test_policy + { + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::min_element(cont, Pred()); + BOOST_CHECK( result == boost::min_element( + boost::make_iterator_range(cont), Pred()) ); + return result; + } + + Pred pred() const { return Pred(); } + + template< boost::range_return_value return_type > + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::min_element(cont, Pred()); - BOOST_CHECK( result == boost::min_element( - boost::make_iterator_range(cont), Pred()) ); + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::min_element(cont, policy.pred()); + BOOST_CHECK( result == boost::min_element( + boost::make_iterator_range(cont), policy.pred()) ); return result; } - - Pred pred() const { return Pred(); } - - template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::min_element(cont, policy.pred()); - BOOST_CHECK( result == boost::min_element( - boost::make_iterator_range(cont), policy.pred()) ); - return result; - } - }; - - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::min_element(cont.begin(), cont.end(), Pred()); - } }; - template - void test_min_element_impl(TestPolicy policy) + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - using namespace boost::assign; - - typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; - typedef BOOST_DEDUCED_TYPENAME remove_const::type container_t; - - range_test::range_return_test_driver test_driver; - - container_t cont; - - test_driver(cont, policy); - - cont.clear(); - cont += 1; - - test_driver(cont, policy); - - cont.clear(); - cont += 1,2,2,2,3,4,5,6,7,8,9; - - test_driver(cont, policy); + return std::min_element(cont.begin(), cont.end(), Pred()); } + }; - template - void test_min_element_impl() - { - test_min_element_impl(min_element_test_policy()); - - test_min_element_impl( - min_element_pred_test_policy >()); + template + void test_min_element_impl(TestPolicy policy) + { + using namespace boost::assign; - test_min_element_impl( - min_element_pred_test_policy >()); - } + typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container_t; - void test_min_element() - { - test_min_element_impl< const std::vector >(); - test_min_element_impl< const std::deque >(); - test_min_element_impl< const std::list >(); + boost::range_test::range_return_test_driver test_driver; - test_min_element_impl< std::vector >(); - test_min_element_impl< std::deque >(); - test_min_element_impl< std::list >(); - } + container_t cont; + + test_driver(cont, policy); + + cont.clear(); + cont += 1; + + test_driver(cont, policy); + + cont.clear(); + cont += 1,2,2,2,3,4,5,6,7,8,9; + + test_driver(cont, policy); + } + + template + void test_min_element_impl() + { + test_min_element_impl(min_element_test_policy()); + + test_min_element_impl( + min_element_pred_test_policy >()); + + test_min_element_impl( + min_element_pred_test_policy >()); + } + + void test_min_element() + { + test_min_element_impl< const std::vector >(); + test_min_element_impl< const std::deque >(); + test_min_element_impl< const std::list >(); + + test_min_element_impl< std::vector >(); + test_min_element_impl< std::deque >(); + test_min_element_impl< std::list >(); } } @@ -157,7 +154,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.min_element" ); - test->add( BOOST_TEST_CASE( &boost::test_min_element ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_min_element::test_min_element ) ); return test; } diff --git a/test/algorithm_test/partition.cpp b/test/algorithm_test/partition.cpp index 0160dae..22aefd6 100644 --- a/test/algorithm_test/partition.cpp +++ b/test/algorithm_test/partition.cpp @@ -21,109 +21,106 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_partition { - namespace + struct equal_to_5 { - struct equal_to_5 - { - typedef bool result_type; - typedef int argument_type; - bool operator()(int x) const { return x == 5; } - }; + typedef bool result_type; + typedef int argument_type; + bool operator()(int x) const { return x == 5; } + }; - // test the 'partition' algorithm - template - class partition_test_policy + // test the 'partition' algorithm + template + class partition_test_policy + { + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + + const Container old_cont(cont); + Container cont2(old_cont); + iter_t result = boost::partition(cont, UnaryPredicate()); + + boost::partition(cont2, UnaryPredicate()); + cont2 = old_cont; + boost::partition( + boost::make_iterator_range(cont2), UnaryPredicate()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; + } + + UnaryPredicate pred() const { return UnaryPredicate(); } + + template< boost::range_return_value return_type > + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; const Container old_cont(cont); Container cont2(old_cont); - iter_t result = boost::partition(cont, UnaryPredicate()); + result_t result = boost::partition(cont, policy.pred()); - boost::partition(cont2, UnaryPredicate()); - cont2 = old_cont; - boost::partition( - boost::make_iterator_range(cont2), UnaryPredicate()); + // Test that operation a temporary created by using + // make_iterator_range. + boost::partition( + boost::make_iterator_range(cont2), policy.pred()); BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), cont2.begin(), cont2.end() ); return result; } - - UnaryPredicate pred() const { return UnaryPredicate(); } - - template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - - const Container old_cont(cont); - Container cont2(old_cont); - result_t result = boost::partition(cont, policy.pred()); - - // Test that operation a temporary created by using - // make_iterator_range. - boost::partition( - boost::make_iterator_range(cont2), policy.pred()); - - BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), - cont2.begin(), cont2.end() ); - - return result; - } - }; - - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::partition(cont.begin(), cont.end(), UnaryPredicate()); - } }; - template - void test_partition_impl() + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - using namespace boost::assign; - - range_test::range_return_test_driver test_driver; - - partition_test_policy< equal_to_5 > policy; - - Container cont; - test_driver(cont, policy); - - cont.clear(); - cont += 1; - test_driver(cont, policy); - - cont.clear(); - cont += 1,2,2,2,2,2,3,4,5,6,7,8,9; - test_driver(cont, policy); - - cont.clear(); - cont += 1,2,2,2,2,2,3,3,3,3,4,4,4,4,4,4,4,5,6,7,8,9; - test_driver(cont, policy); + return std::partition(cont.begin(), cont.end(), UnaryPredicate()); } + }; - void test_partition() - { - test_partition_impl< std::vector >(); - test_partition_impl< std::list >(); - test_partition_impl< std::deque >(); - } + template + void test_partition_impl() + { + using namespace boost::assign; + + boost::range_test::range_return_test_driver test_driver; + + partition_test_policy< equal_to_5 > policy; + + Container cont; + test_driver(cont, policy); + + cont.clear(); + cont += 1; + test_driver(cont, policy); + + cont.clear(); + cont += 1,2,2,2,2,2,3,4,5,6,7,8,9; + test_driver(cont, policy); + + cont.clear(); + cont += 1,2,2,2,2,2,3,3,3,3,4,4,4,4,4,4,4,5,6,7,8,9; + test_driver(cont, policy); + } + + void test_partition() + { + test_partition_impl< std::vector >(); + test_partition_impl< std::list >(); + test_partition_impl< std::deque >(); } } @@ -133,7 +130,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.partition" ); - test->add( BOOST_TEST_CASE( &boost::test_partition ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_partition::test_partition ) ); return test; } diff --git a/test/algorithm_test/stable_partition.cpp b/test/algorithm_test/stable_partition.cpp index 5f55b7d..3bf20e2 100644 --- a/test/algorithm_test/stable_partition.cpp +++ b/test/algorithm_test/stable_partition.cpp @@ -21,116 +21,112 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_stable_partition { - namespace + struct equal_to_5 { - struct equal_to_5 - { - typedef bool result_type; - typedef int argument_type; - bool operator()(int x) const { return x == 5; } - }; + typedef bool result_type; + typedef int argument_type; + bool operator()(int x) const { return x == 5; } + }; - // test the 'partition' algorithm - template - class stable_partition_test_policy + // test the 'partition' algorithm + template + class stable_partition_test_policy + { + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) + Container cont2(cont); + + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::stable_partition(cont, UnaryPredicate()); + + iter_t temp_result = boost::stable_partition( + boost::make_iterator_range(cont2), UnaryPredicate()); + + BOOST_CHECK_EQUAL( std::distance(cont.begin(), result), + std::distance(cont2.begin(), temp_result) ); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; + } + + UnaryPredicate pred() const { return UnaryPredicate(); } + + template< boost::range_return_value return_type > + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; Container cont2(cont); - - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::stable_partition(cont, UnaryPredicate()); - - iter_t temp_result = boost::stable_partition( - boost::make_iterator_range(cont2), UnaryPredicate()); - - BOOST_CHECK_EQUAL( std::distance(cont.begin(), result), - std::distance(cont2.begin(), temp_result) ); - - BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), - cont2.begin(), cont2.end() ); - + result_t result = boost::stable_partition(cont, policy.pred()); + + result_t result2 = boost::stable_partition( + boost::make_iterator_range(cont2), policy.pred()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont2.begin(), cont2.end(), + cont.begin(), cont.end() ); + return result; } - - UnaryPredicate pred() const { return UnaryPredicate(); } - - template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - Container cont2(cont); - result_t result = boost::stable_partition(cont, policy.pred()); - - result_t result2 = boost::stable_partition( - boost::make_iterator_range(cont2), policy.pred()); - - BOOST_CHECK_EQUAL_COLLECTIONS( cont2.begin(), cont2.end(), - cont.begin(), cont.end() ); - - return result; - } - }; - - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::stable_partition(cont.begin(), cont.end(), UnaryPredicate()); - } }; - template - void test_stable_partition_impl() + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - using namespace boost::assign; - - range_test::range_return_test_driver test_driver; - - stable_partition_test_policy< equal_to_5 > policy; - - Container cont; - test_driver(cont, policy); - - cont.clear(); - cont += 1; - test_driver(cont, policy); - - cont.clear(); - cont += 1,2,2,2,2,2,3,4,5,6,7,8,9; - test_driver(cont, policy); - - cont.clear(); - cont += 1,2,2,2,2,2,3,3,3,3,4,4,4,4,4,4,4,5,6,7,8,9; - test_driver(cont, policy); + return std::stable_partition(cont.begin(), cont.end(), UnaryPredicate()); } + }; - void test_stable_partition() - { - test_stable_partition_impl< std::vector >(); - test_stable_partition_impl< std::list >(); - test_stable_partition_impl< std::deque >(); - } + template + void test_stable_partition_impl() + { + using namespace boost::assign; + + boost::range_test::range_return_test_driver test_driver; + + stable_partition_test_policy< equal_to_5 > policy; + + Container cont; + test_driver(cont, policy); + + cont.clear(); + cont += 1; + test_driver(cont, policy); + + cont.clear(); + cont += 1,2,2,2,2,2,3,4,5,6,7,8,9; + test_driver(cont, policy); + + cont.clear(); + cont += 1,2,2,2,2,2,3,3,3,3,4,4,4,4,4,4,4,5,6,7,8,9; + test_driver(cont, policy); + } + + void test_stable_partition() + { + test_stable_partition_impl< std::vector >(); + test_stable_partition_impl< std::list >(); + test_stable_partition_impl< std::deque >(); } } - boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.stable_partition" ); - test->add( BOOST_TEST_CASE( &boost::test_stable_partition ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_stable_partition::test_stable_partition ) ); return test; } diff --git a/test/algorithm_test/unique.cpp b/test/algorithm_test/unique.cpp index 49af0e3..880c131 100644 --- a/test/algorithm_test/unique.cpp +++ b/test/algorithm_test/unique.cpp @@ -23,156 +23,153 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_unique { - namespace + // test the 'unique' algorithm without a predicate + class unique_test_policy { - // test the 'unique' algorithm without a predicate - class unique_test_policy + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) - { - // There isn't an iterator return version of boost::unique, so just - // perform the standard algorithm - return std::unique(cont.begin(), cont.end()); - } + // There isn't an iterator return version of boost::unique, so just + // perform the standard algorithm + return std::unique(cont.begin(), cont.end()); + } - template< range_return_value return_type > - struct test_range + template< boost::range_return_value return_type > + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy&, Container& cont) { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - - Container cont2(cont); - - result_t result = boost::unique(cont); - - boost::unique(boost::make_iterator_range(cont2)); - - BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), - cont2.begin(), cont2.end() ); - - return result; - } - }; + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::unique(cont.begin(), cont.end()); + Container cont2(cont); + + result_t result = boost::unique(cont); + + boost::unique(boost::make_iterator_range(cont2)); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; } }; - // test the 'unique' algorithm with a predicate - template - class unique_pred_test_policy + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) - { - // There isn't an iterator return version of boost::unique, so just - // perform the standard algorithm - return std::unique(cont.begin(), cont.end(), Pred()); - } + return std::unique(cont.begin(), cont.end()); + } + }; - Pred pred() const { return Pred(); } + // test the 'unique' algorithm with a predicate + template + class unique_pred_test_policy + { + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + // There isn't an iterator return version of boost::unique, so just + // perform the standard algorithm + return std::unique(cont.begin(), cont.end(), Pred()); + } - template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - - Container cont2(cont); - - result_t result = boost::unique(cont, policy.pred()); - - boost::unique(boost::make_iterator_range(cont2), policy.pred()); - - BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), - cont2.begin(), cont2.end() ); - - return result; - } - }; + Pred pred() const { return Pred(); } - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) + template< boost::range_return_value return_type > + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) { - return std::unique(cont.begin(), cont.end(), Pred()); + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + + Container cont2(cont); + + result_t result = boost::unique(cont, policy.pred()); + + boost::unique(boost::make_iterator_range(cont2), policy.pred()); + + BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(), + cont2.begin(), cont2.end() ); + + return result; } }; - template - void test_unique_impl(TestPolicy policy, Pred pred) + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - using namespace boost::assign; - - typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; - - range_test::range_return_test_driver test_driver; - - Container cont; - - test_driver(cont, policy); - - cont.clear(); - cont += 1; - - std::vector temp(cont.begin(), cont.end()); - std::sort(temp.begin(), temp.end(), pred); - cont.assign(temp.begin(), temp.end()); - - test_driver(cont, policy); - - cont.clear(); - cont += 1,2,2,2,2,3,4,5,6,7,8,9; - - temp.assign(cont.begin(), cont.end()); - std::sort(temp.begin(), temp.end(), pred); - cont.assign(temp.begin(), temp.end()); - - test_driver(cont, policy); + return std::unique(cont.begin(), cont.end(), Pred()); } + }; - template - void test_unique_impl() - { - test_unique_impl( - unique_test_policy(), - std::less() - ); + template + void test_unique_impl(TestPolicy policy, Pred pred) + { + using namespace boost::assign; - test_unique_impl( - unique_pred_test_policy >(), - std::less() - ); - - test_unique_impl( - unique_pred_test_policy >(), - std::greater() - ); - } + typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; - void test_unique() - { - test_unique_impl< std::vector >(); - test_unique_impl< std::list >(); - test_unique_impl< std::deque >(); - } + boost::range_test::range_return_test_driver test_driver; + + Container cont; + + test_driver(cont, policy); + + cont.clear(); + cont += 1; + + std::vector temp(cont.begin(), cont.end()); + std::sort(temp.begin(), temp.end(), pred); + cont.assign(temp.begin(), temp.end()); + + test_driver(cont, policy); + + cont.clear(); + cont += 1,2,2,2,2,3,4,5,6,7,8,9; + + temp.assign(cont.begin(), cont.end()); + std::sort(temp.begin(), temp.end(), pred); + cont.assign(temp.begin(), temp.end()); + + test_driver(cont, policy); + } + + template + void test_unique_impl() + { + test_unique_impl( + unique_test_policy(), + std::less() + ); + + test_unique_impl( + unique_pred_test_policy >(), + std::less() + ); + + test_unique_impl( + unique_pred_test_policy >(), + std::greater() + ); + } + + void test_unique() + { + test_unique_impl< std::vector >(); + test_unique_impl< std::list >(); + test_unique_impl< std::deque >(); } } @@ -182,7 +179,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.unique" ); - test->add( BOOST_TEST_CASE( &boost::test_unique ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_unique::test_unique ) ); return test; } diff --git a/test/algorithm_test/upper_bound.cpp b/test/algorithm_test/upper_bound.cpp index 95e3965..daae764 100644 --- a/test/algorithm_test/upper_bound.cpp +++ b/test/algorithm_test/upper_bound.cpp @@ -21,144 +21,141 @@ #include #include -namespace boost +namespace boost_range_test_algorithm_upper_bound { - namespace + class upper_bound_policy { - class upper_bound_policy + public: + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) { - public: - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::upper_bound(cont, 5); - BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) ); - return result; - } - - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - result_t result = boost::upper_bound(cont, 5); - BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) ); - return result; - } - }; - - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::upper_bound(cont.begin(), cont.end(), 5); - } - }; - - template< class BinaryPredicate > - struct upper_bound_pred_policy - { - template< class Container > - BOOST_DEDUCED_TYPENAME range_iterator::type - test_iter(Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iter_t; - iter_t result = boost::upper_bound(cont, 5, BinaryPredicate()); - BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5, BinaryPredicate()) ); - return result; - } - - template< range_return_value result_type> - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - typedef BOOST_DEDUCED_TYPENAME range_return::type result_t; - - result_t result = boost::upper_bound(cont, 5, policy.pred()); - - BOOST_CHECK( result == boost::upper_bound( - boost::make_iterator_range(cont), 5, policy.pred()) ); - - return result; - } - }; - - template - BOOST_DEDUCED_TYPENAME range_iterator::type - reference(Container& cont) - { - return std::upper_bound( - cont.begin(), cont.end(), 5, BinaryPredicate()); - } - - BinaryPredicate& pred() { return m_pred; } - - private: - BinaryPredicate m_pred; - }; - - template - void test_upper_bound_impl(TestPolicy policy, BinaryPredicate pred) - { - using namespace boost::assign; - - typedef BOOST_DEDUCED_TYPENAME remove_const::type container_t; - typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; - - range_test::range_return_test_driver test_driver; - - container_t mcont; - Container& cont = mcont; - - test_driver(cont, policy); - - mcont.clear(); - mcont += 1; - - std::vector temp(mcont.begin(), mcont.end()); - std::sort(temp.begin(), temp.end(), pred); - mcont.assign(temp.begin(), temp.end()); - - test_driver(cont, policy); - - mcont.clear(); - mcont += 1,2,3,4,5,6,7,8,9; - - temp.assign(mcont.begin(), mcont.end()); - std::sort(temp.begin(), temp.end(), pred); - mcont.assign(temp.begin(), temp.end()); - - test_driver(cont, policy); + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::upper_bound(cont, 5); + BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) ); + return result; } + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy&, Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + result_t result = boost::upper_bound(cont, 5); + BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) ); + return result; + } + }; + + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) + { + return std::upper_bound(cont.begin(), cont.end(), 5); + } + }; + + template< class BinaryPredicate > + struct upper_bound_pred_policy + { + template< class Container > + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + test_iter(Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_iterator::type iter_t; + iter_t result = boost::upper_bound(cont, 5, BinaryPredicate()); + BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5, BinaryPredicate()) ); + return result; + } + + template< boost::range_return_value result_type> + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME boost::range_return::type + operator()(Policy& policy, Container& cont) + { + typedef BOOST_DEDUCED_TYPENAME boost::range_return::type result_t; + + result_t result = boost::upper_bound(cont, 5, policy.pred()); + + BOOST_CHECK( result == boost::upper_bound( + boost::make_iterator_range(cont), 5, policy.pred()) ); + + return result; + } + }; + template - void test_upper_bound_impl() + BOOST_DEDUCED_TYPENAME boost::range_iterator::type + reference(Container& cont) { - test_upper_bound_impl( - upper_bound_policy(), - std::less() - ); - - test_upper_bound_impl( - upper_bound_pred_policy >(), - std::less() - ); - - test_upper_bound_impl( - upper_bound_pred_policy >(), - std::greater() - ); + return std::upper_bound( + cont.begin(), cont.end(), 5, BinaryPredicate()); } + + BinaryPredicate& pred() { return m_pred; } + + private: + BinaryPredicate m_pred; + }; + + template + void test_upper_bound_impl(TestPolicy policy, BinaryPredicate pred) + { + using namespace boost::assign; + + typedef BOOST_DEDUCED_TYPENAME boost::remove_const::type container_t; + typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; + + boost::range_test::range_return_test_driver test_driver; + + container_t mcont; + Container& cont = mcont; + + test_driver(cont, policy); + + mcont.clear(); + mcont += 1; + + std::vector temp(mcont.begin(), mcont.end()); + std::sort(temp.begin(), temp.end(), pred); + mcont.assign(temp.begin(), temp.end()); + + test_driver(cont, policy); + + mcont.clear(); + mcont += 1,2,3,4,5,6,7,8,9; + + temp.assign(mcont.begin(), mcont.end()); + std::sort(temp.begin(), temp.end(), pred); + mcont.assign(temp.begin(), temp.end()); + + test_driver(cont, policy); + } + + template + void test_upper_bound_impl() + { + test_upper_bound_impl( + upper_bound_policy(), + std::less() + ); + + test_upper_bound_impl( + upper_bound_pred_policy >(), + std::less() + ); + + test_upper_bound_impl( + upper_bound_pred_policy >(), + std::greater() + ); } void test_upper_bound() @@ -179,7 +176,7 @@ init_unit_test_suite(int argc, char* argv[]) boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.upper_bound" ); - test->add( BOOST_TEST_CASE( &boost::test_upper_bound ) ); + test->add( BOOST_TEST_CASE( &boost_range_test_algorithm_upper_bound::test_upper_bound ) ); return test; } diff --git a/test/begin.cpp b/test/begin.cpp new file mode 100644 index 0000000..eb745c2 --- /dev/null +++ b/test/begin.cpp @@ -0,0 +1,119 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#include + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +# pragma warn -8091 // supress warning in Boost.Test +# pragma warn -8057 // unused argument argc/argv in Boost.Test +#endif + +#include +#include +#include +#include + +namespace mock_std +{ + template + inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type + begin(SinglePassRange& rng) + { + return rng.begin(); + } + + template + inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type + begin(const SinglePassRange& rng) + { + return rng.begin(); + } + + template + void mock_algorithm_using_begin(const SinglePassRange& rng) + { + BOOST_CHECK( begin(rng) == rng.begin() ); + } + + template + void mock_algorithm_using_begin(SinglePassRange& rng) + { + BOOST_CHECK( begin(rng) == rng.begin() ); + } +} + +namespace boost +{ +#ifdef BOOST_RANGE_SIMULATE_BEGIN_WITHOUT_ADL_NAMESPACE_BARRIER + template + inline BOOST_DEDUCED_TYPENAME range_iterator::type + begin(SinglePassRange& rng) + { + return rng.begin(); + } + + template + inline BOOST_DEDUCED_TYPENAME range_iterator::type + begin(const SinglePassRange& rng) + { + return rng.begin(); + } +#endif + + class MockTestBeginCollection + { + public: + typedef char value_type; + typedef const char* const_pointer; + typedef char* pointer; + typedef const_pointer const_iterator; + typedef pointer iterator; + + MockTestBeginCollection() + : m_first() + , m_last() + { + } + + const_iterator begin() const { return m_first; } + iterator begin() { return m_first; } + const_iterator end() const { return m_last; } + iterator end() { return m_last; } + + private: + iterator m_first; + iterator m_last; + }; +} + +namespace +{ + void test_range_begin() + { + boost::MockTestBeginCollection c; + const boost::MockTestBeginCollection& const_c = c; + mock_std::mock_algorithm_using_begin(const_c); + mock_std::mock_algorithm_using_begin(c); + } +} + +using boost::unit_test_framework::test_suite; + +boost::unit_test_framework::test_suite* +init_unit_test_suite( int argc, char* argv[] ) +{ + boost::unit_test_framework::test_suite* test = BOOST_TEST_SUITE( "Range Test Suite - begin() ADL namespace barrier" ); + + test->add( BOOST_TEST_CASE( &test_range_begin ) ); + + return test; +} + + diff --git a/test/end.cpp b/test/end.cpp new file mode 100644 index 0000000..e3383c3 --- /dev/null +++ b/test/end.cpp @@ -0,0 +1,119 @@ +// Boost.Range library +// +// Copyright Neil Groves 2010. Use, modification and +// distribution is subject to 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#include + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +# pragma warn -8091 // supress warning in Boost.Test +# pragma warn -8057 // unused argument argc/argv in Boost.Test +#endif + +#include +#include +#include +#include + +namespace mock_std +{ + template + inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type + end(SinglePassRange& rng) + { + return rng.end(); + } + + template + inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type + end(const SinglePassRange& rng) + { + return rng.end(); + } + + template + void mock_algorithm_using_end(const SinglePassRange& rng) + { + BOOST_CHECK( end(rng) == rng.end() ); + } + + template + void mock_algorithm_using_end(SinglePassRange& rng) + { + BOOST_CHECK( end(rng) == rng.end() ); + } +} + +namespace boost +{ +#ifdef BOOST_RANGE_SIMULATE_END_WITHOUT_ADL_NAMESPACE_BARRIER + template + inline BOOST_DEDUCED_TYPENAME range_iterator::type + end(SinglePassRange& rng) + { + return rng.end(); + } + + template + inline BOOST_DEDUCED_TYPENAME range_iterator::type + end(const SinglePassRange& rng) + { + return rng.end(); + } +#endif + + class MockTestEndCollection + { + public: + typedef char value_type; + typedef const char* const_pointer; + typedef char* pointer; + typedef const_pointer const_iterator; + typedef pointer iterator; + + MockTestEndCollection() + : m_first() + , m_last() + { + } + + const_iterator begin() const { return m_first; } + iterator begin() { return m_first; } + const_iterator end() const { return m_last; } + iterator end() { return m_last; } + + private: + iterator m_first; + iterator m_last; + }; +} + +namespace +{ + void test_range_end_adl_avoidance() + { + boost::MockTestEndCollection c; + const boost::MockTestEndCollection& const_c = c; + mock_std::mock_algorithm_using_end(const_c); + mock_std::mock_algorithm_using_end(c); + } +} + +using boost::unit_test_framework::test_suite; + +boost::unit_test_framework::test_suite* +init_unit_test_suite( int argc, char* argv[] ) +{ + boost::unit_test_framework::test_suite* test = BOOST_TEST_SUITE( "Range Test Suite - end() ADL namespace barrier" ); + + test->add( BOOST_TEST_CASE( &test_range_end_adl_avoidance ) ); + + return test; +} + + diff --git a/test/extension_size.cpp b/test/extension_size.cpp index 988e557..856f87d 100644 --- a/test/extension_size.cpp +++ b/test/extension_size.cpp @@ -24,24 +24,24 @@ namespace boost_range_extension_size_test { - class FooWithoutMemberSize + class FooWithoutSize { typedef std::list impl_t; typedef impl_t::const_iterator const_iterator; typedef impl_t::iterator iterator; public: - friend inline const_iterator range_begin(const FooWithoutMemberSize& obj) { return obj.m_impl.begin(); } - friend inline iterator range_begin(FooWithoutMemberSize& obj) { return obj.m_impl.begin(); } - friend inline const_iterator range_end(const FooWithoutMemberSize& obj) { return obj.m_impl.end(); } - friend inline iterator range_end(FooWithoutMemberSize& obj){ return obj.m_impl.end(); } + friend inline const_iterator range_begin(const FooWithoutSize& obj) { return obj.m_impl.begin(); } + friend inline iterator range_begin(FooWithoutSize& obj) { return obj.m_impl.begin(); } + friend inline const_iterator range_end(const FooWithoutSize& obj) { return obj.m_impl.end(); } + friend inline iterator range_end(FooWithoutSize& obj){ return obj.m_impl.end(); } private: impl_t m_impl; }; - boost::range_difference >::type - inline range_calculate_size(const FooWithoutMemberSize& rng) + inline boost::range_difference >::type + range_calculate_size(const FooWithoutSize& rng) { return 2u; } @@ -49,12 +49,12 @@ namespace boost_range_extension_size_test namespace boost { - template<> struct range_iterator + template<> struct range_iterator { typedef std::list::const_iterator type; }; - template<> struct range_iterator< ::boost_range_extension_size_test::FooWithoutMemberSize > + template<> struct range_iterator< ::boost_range_extension_size_test::FooWithoutSize> { typedef std::list::iterator type; }; @@ -63,13 +63,6 @@ namespace boost namespace { -void check_size_works_with_less_than_random_access() -{ - std::list container; - container.push_back(1); - BOOST_CHECK_EQUAL( boost::size(container), 1u ); -} - void check_size_works_with_random_access() { std::vector container; @@ -77,28 +70,9 @@ void check_size_works_with_random_access() BOOST_CHECK_EQUAL( boost::size(container), 1u ); } -class FooWithMemberSize -{ -public: - typedef std::list impl_t; - typedef impl_t::const_iterator const_iterator; - typedef impl_t::iterator iterator; - typedef impl_t::value_type value_type; - - std::size_t size() const { return 1u; } - const_iterator begin() const { return m_impl.begin(); } - iterator begin() { return m_impl.begin(); } - const_iterator end() const { return m_impl.end(); } - iterator end() { return m_impl.end(); } - -private: - std::list m_impl; -}; - void check_extension_size() { - BOOST_CHECK_EQUAL( boost::size(FooWithMemberSize()), 1u ); - BOOST_CHECK_EQUAL( boost::size(boost_range_extension_size_test::FooWithoutMemberSize()), 2u ); + BOOST_CHECK_EQUAL( boost::size(boost_range_extension_size_test::FooWithoutSize()), 2u ); } } // anonymous namespace @@ -109,14 +83,8 @@ test_suite* init_unit_test_suite( int argc, char* argv[] ) { test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" ); - test->add( BOOST_TEST_CASE( &check_size_works_with_less_than_random_access )); test->add( BOOST_TEST_CASE( &check_size_works_with_random_access )); test->add( BOOST_TEST_CASE( &check_extension_size ) ); return test; } - - - - - From cafea6aea537eb7fa9fa9994ddcf987285c6e7dc Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Sun, 16 Jan 2011 17:07:27 +0000 Subject: [PATCH 43/73] [boost][range] - Merge a fix to undo an erroneous change to iterator_range.size() that allowed it to compile for ranges that did not model the Random Access Range Concept and thereby broken the complexity guarantees. [SVN r68190] --- include/boost/range/iterator_range_core.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/range/iterator_range_core.hpp b/include/boost/range/iterator_range_core.hpp index 7664c2e..7ef7523 100755 --- a/include/boost/range/iterator_range_core.hpp +++ b/include/boost/range/iterator_range_core.hpp @@ -231,7 +231,7 @@ namespace boost difference_type size() const { - return std::distance(m_Begin, m_End); + return m_End - m_Begin; } bool empty() const From 47e478d099f2fc67abdb4861890571bdfa85114e Mon Sep 17 00:00:00 2001 From: Bryce Adelstein-Lelbach Date: Fri, 27 May 2011 19:51:13 +0000 Subject: [PATCH 44/73] Merge to release. [SVN r72228] --- include/boost/range/iterator_range_core.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 include/boost/range/iterator_range_core.hpp diff --git a/include/boost/range/iterator_range_core.hpp b/include/boost/range/iterator_range_core.hpp old mode 100755 new mode 100644 index 7ef7523..faa0d6b --- a/include/boost/range/iterator_range_core.hpp +++ b/include/boost/range/iterator_range_core.hpp @@ -231,7 +231,7 @@ namespace boost difference_type size() const { - return m_End - m_Begin; + return m_End - m_Begin; } bool empty() const From dc46fc13abfecbc2f98623206b9756106f8c7e15 Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Fri, 8 Jun 2012 22:59:54 +0000 Subject: [PATCH 45/73] [boost][range] - Merge trac resolutions from the trunk. The most notable change is the alteration of the size type to be unsigned. This is a potentially breaking change. [SVN r78860] --- doc/mfc_atl.qbk | 2 +- doc/portability.qbk | 2 +- doc/reference/semantics.qbk | 2 +- doc/reference/synopsis.qbk | 28 +++---- doc/reference/utilities.qbk | 74 +++++++++---------- doc/style.qbk | 8 +- doc/upgrade.qbk | 6 ++ include/boost/range/algorithm/equal.hpp | 20 +++-- include/boost/range/algorithm/for_each.hpp | 1 - include/boost/range/algorithm_ext/copy_n.hpp | 8 +- include/boost/range/as_literal.hpp | 2 +- include/boost/range/counting_range.hpp | 1 - include/boost/range/detail/any_iterator.hpp | 1 - .../range/detail/any_iterator_buffer.hpp | 2 +- include/boost/range/detail/join_iterator.hpp | 2 +- include/boost/range/detail/size_type.hpp | 41 ++++------ include/boost/range/has_range_iterator.hpp | 2 +- include/boost/range/numeric.hpp | 2 +- include/boost/range/size.hpp | 6 +- include/boost/range/size_type.hpp | 60 ++++++++------- test/adl_conformance.cpp | 4 +- test/algorithm_test/for_each.cpp | 2 +- test/begin.cpp | 8 +- test/compat2.cpp | 4 +- test/compat3.cpp | 4 +- test/end.cpp | 8 +- test/extension_size.cpp | 2 +- 27 files changed, 155 insertions(+), 147 deletions(-) mode change 100755 => 100644 include/boost/range/algorithm/equal.hpp mode change 100755 => 100644 include/boost/range/algorithm_ext/copy_n.hpp mode change 100755 => 100644 include/boost/range/counting_range.hpp mode change 100755 => 100644 include/boost/range/detail/size_type.hpp mode change 100755 => 100644 include/boost/range/numeric.hpp mode change 100755 => 100644 test/compat3.cpp diff --git a/doc/mfc_atl.qbk b/doc/mfc_atl.qbk index 0511509..de2e225 100644 --- a/doc/mfc_atl.qbk +++ b/doc/mfc_atl.qbk @@ -41,7 +41,7 @@ BOOST_FOREACH (CList *theList, myArray) * Boost C++ Libraries Version 1.34.0 or later (no compilation required) * Visual C++ 7.1 or later (for MFC and ATL) - + [endsect] [section:mfc_ranges MFC Ranges] diff --git a/doc/portability.qbk b/doc/portability.qbk index aed3825..fabaafc 100644 --- a/doc/portability.qbk +++ b/doc/portability.qbk @@ -19,7 +19,7 @@ For maximum portability you should follow these guidelines: # use __const_begin__`()` and __const_end__`()` whenever your code by intention is read-only; this will also solve most rvalue problems, # do not rely on ADL: * if you overload functions, include that header before the headers in this library, - * put all overloads in namespace boost. + * put all overloads in namespace boost. diff --git a/doc/reference/semantics.qbk b/doc/reference/semantics.qbk index 335ab90..0710a99 100644 --- a/doc/reference/semantics.qbk +++ b/doc/reference/semantics.qbk @@ -128,7 +128,7 @@ ] [ [`size(x)`] - [`range_difference::type`] + [`range_size::type`] [`range_calculate_size(x)` which by default is `boost::end(x) - boost::begin(x)`. Users may supply alternative implementations by implementing `range_calculate_size(x)` so that it will be found via ADL] [constant time] ] diff --git a/doc/reference/synopsis.qbk b/doc/reference/synopsis.qbk index 381d77b..76719df 100644 --- a/doc/reference/synopsis.qbk +++ b/doc/reference/synopsis.qbk @@ -20,10 +20,10 @@ namespace boost template< class T > struct range_reference; - + template< class T > struct range_pointer; - + template< class T > struct range_category; @@ -92,11 +92,11 @@ namespace boost template< class T > typename range_reverse_iterator::type rend( const T& r ); - + // // Random Access Range functions // - + template< class T > typename range_difference::type size( const T& r ); @@ -106,42 +106,42 @@ namespace boost // template< class T > - typename range_iterator::type + typename range_iterator::type const_begin( const T& r ); template< class T > - typename range_iterator::type + typename range_iterator::type const_end( const T& r ); template< class T > - typename range_reverse_iterator::type + typename range_reverse_iterator::type const_rbegin( const T& r ); template< class T > - typename range_reverse_iterator::type + typename range_reverse_iterator::type const_rend( const T& r ); - + // // String utilities // - + template< class T > iterator_range< ... see below ... > as_literal( T& r ); - + template< class T > iterator_range< ... see below ... > as_literal( const T& r ); - + template< class T > iterator_range< typename range_iterator::type > as_array( T& r ); - + template< class T > iterator_range< typename range_iterator::type > as_array( const T& r ); -} // namespace 'boost' +} // namespace 'boost' `` [endsect] diff --git a/doc/reference/utilities.qbk b/doc/reference/utilities.qbk index 94d4699..25a7edb 100644 --- a/doc/reference/utilities.qbk +++ b/doc/reference/utilities.qbk @@ -40,23 +40,23 @@ namespace boost public: // construction, assignment template< class ForwardTraversalIterator2 > iterator_range( ForwardTraversalIterator2 Begin, ForwardTraversalIterator2 End ); - + template< class ForwardRange > iterator_range( ForwardRange& r ); - + template< class ForwardRange > iterator_range( const ForwardRange& r ); - + template< class ForwardRange > iterator_range& operator=( ForwardRange& r ); template< class ForwardRange > iterator_range& operator=( const ForwardRange& r ); - + public: // Forward Range functions iterator begin() const; iterator end() const; - + public: // convenience operator unspecified_bool_type() const; bool equal( const iterator_range& ) const; @@ -65,25 +65,25 @@ namespace boost iterator_range& advance_begin(difference_type n); iterator_range& advance_end(difference_type n); bool empty() const; - // for Random Access Range only: + // for Random Access Range only: reference operator[]( difference_type at ) const; value_type operator()( difference_type at ) const; size_type size() const; }; - + // stream output template< class ForwardTraversalIterator, class T, class Traits > - std::basic_ostream& + std::basic_ostream& operator<<( std::basic_ostream& Os, const iterator_range& r ); // comparison template< class ForwardTraversalIterator, class ForwardTraversalIterator2 > - bool operator==( const iterator_range& l, + bool operator==( const iterator_range& l, const iterator_range& r ); template< class ForwardTraversalIterator, class ForwardRange > - bool operator==( const iterator_range& l, + bool operator==( const iterator_range& l, const ForwardRange& r ); template< class ForwardTraversalIterator, class ForwardRange > @@ -91,11 +91,11 @@ namespace boost const iterator_range& r ); template< class ForwardTraversalIterator, class ForwardTraversalIterator2 > - bool operator!=( const iterator_range& l, + bool operator!=( const iterator_range& l, const iterator_range& r ); template< class ForwardTraversalIterator, class ForwardRange > - bool operator!=( const iterator_range& l, + bool operator!=( const iterator_range& l, const ForwardRange& r ); template< class ForwardTraversalIterator, class ForwardRange > @@ -103,23 +103,23 @@ namespace boost const iterator_range& r ); template< class ForwardTraversalIterator, class ForwardTraversalIterator2 > - bool operator<( const iterator_range& l, + bool operator<( const iterator_range& l, const iterator_range& r ); template< class ForwardTraversalIterator, class ForwardRange > - bool operator<( const iterator_range& l, + bool operator<( const iterator_range& l, const ForwardRange& r ); template< class ForwardTraversalIterator, class ForwardRange > bool operator<( const ForwardRange& l, const iterator_range& r ); - + // external construction template< class ForwardTraversalIterator > iterator_range< ForwardTraversalIterator > - make_iterator_range( ForwardTraversalIterator Begin, + make_iterator_range( ForwardTraversalIterator Begin, ForwardTraversalIterator End ); - + template< class ForwardRange > iterator_range< typename range_iterator::type > make_iterator_range( ForwardRange& r ); @@ -127,25 +127,25 @@ namespace boost template< class ForwardRange > iterator_range< typename range_iterator::type > make_iterator_range( const ForwardRange& r ); - + template< class Range > iterator_range< typename range_iterator::type > make_iterator_range( Range& r, typename range_difference::type advance_begin, typename range_difference::type advance_end ); - + template< class Range > iterator_range< typename range_iterator::type > - make_iterator_range( const Range& r, + make_iterator_range( const Range& r, typename range_difference::type advance_begin, typename range_difference::type advance_end ); - + // convenience template< class Sequence, class ForwardRange > Sequence copy_range( const ForwardRange& r ); - + } // namespace 'boost' -`` +`` If an instance of `iterator_range` is constructed by a client with two iterators, the client must ensure that the two iterators delimit a valid closed-open range [begin,end). @@ -177,7 +177,7 @@ It is worth noticing that the templated constructors and assignment operators al `` iterator_range make_iterator_range( Range& r, - typename range_difference::type advance_begin, + typename range_difference::type advance_begin, typename range_difference::type advance_end ); `` @@ -209,46 +209,46 @@ namespace boost template< class ForwardRange > class sub_range : public iterator_range< typename range_iterator::type > { - public: + public: typedef typename range_iterator::type iterator; typedef typename range_iterator::type const_iterator; typedef typename iterator_difference::type difference_type; - + public: // construction, assignment template< class ForwardTraversalIterator > sub_range( ForwardTraversalIterator Begin, ForwardTraversalIterator End ); template< class ForwardRange2 > sub_range( ForwardRange2& r ); - + template< class ForwardRange2 > sub_range( const Range2& r ); - + template< class ForwardRange2 > sub_range& operator=( ForwardRange2& r ); template< class ForwardRange2 > - sub_range& operator=( const ForwardRange2& r ); - - public: // Forward Range functions + sub_range& operator=( const ForwardRange2& r ); + + public: // Forward Range functions iterator begin(); const_iterator begin() const; iterator end(); - const_iterator end() const; - - public: // convenience + const_iterator end() const; + + public: // convenience value_type& front(); const value_type& front() const; value_type& back(); const value_type& back() const; - // for Random Access Range only: + // for Random Access Range only: value_type& operator[]( size_type at ); const value_type& operator[]( size_type at ) const; - + public: // rest of interface inherited from iterator_range }; - + } // namespace 'boost' `` diff --git a/doc/style.qbk b/doc/style.qbk index c6e5e34..2074ba6 100644 --- a/doc/style.qbk +++ b/doc/style.qbk @@ -13,7 +13,7 @@ Since ranges are characterized by a specific underlying iterator type, we get a * Readable Range * Writeable Range * Swappable Range - * Lvalue Range + * Lvalue Range * [*/Traversal/] category: * __single_pass_range__ * __forward_range__ @@ -25,7 +25,7 @@ Notice how we have used the categories from the __new_style_iterators__. Notice that an iterator (and therefore an range) has one [*/traversal/] property and one or more properties from the [*/value access/] category. So in reality we will mostly talk about mixtures such as * Random Access Readable Writeable Range -* Forward Lvalue Range +* Forward Lvalue Range By convention, we should always specify the [*/traversal/] property first as done above. This seems reasonable since there will only be one [*/traversal/] property, but perhaps many [*/value access/] properties. @@ -37,7 +37,7 @@ As another example, consider how we specify the interface of `std::sort()`. Algo template< class RandomAccessTraversalReadableWritableIterator > void sort( RandomAccessTraversalReadableWritableIterator first, RandomAccessTraversalReadableWritableIterator last ); -`` +`` For ranges the interface becomes @@ -45,6 +45,6 @@ For ranges the interface becomes template< class RandomAccessReadableWritableRange > void sort( RandomAccessReadableWritableRange& r ); `` - + [endsect] diff --git a/doc/upgrade.qbk b/doc/upgrade.qbk index 516ed11..e97f761 100644 --- a/doc/upgrade.qbk +++ b/doc/upgrade.qbk @@ -5,6 +5,12 @@ /] [section:upgrade Upgrade version of Boost.Range] +[section:upgrade_from_1_49 Upgrade from version 1.49] + +# __size__ now returns the type Rng::size_type if the range has size_type; +otherwise range_size::type is used. This is the distance type promoted to +an unsigned type. + [section:upgrade_from_1_45 Upgrade from version 1.45] # __size__ in addition to supporting __random_access_range__ now also supports extensibility via calls to the unqualified `range_calculate_size(rng)` function. diff --git a/include/boost/range/algorithm/equal.hpp b/include/boost/range/algorithm/equal.hpp old mode 100755 new mode 100644 index a3ebc29..4472bb1 --- a/include/boost/range/algorithm/equal.hpp +++ b/include/boost/range/algorithm/equal.hpp @@ -31,7 +31,7 @@ namespace boost IteratorCategoryTag1, IteratorCategoryTag2 ) { - do + while (true) { // If we have reached the end of the left range then this is // the end of the loop. They are equal if and only if we have @@ -46,7 +46,12 @@ namespace boost return false; // continue looping if and only if the values are equal - } while(*first1++ == *first2++); + if (*first1 != *first2) + break; + + ++first1; + ++first2; + } // Reaching this line in the algorithm indicates that a value // inequality has been detected. @@ -66,7 +71,7 @@ namespace boost IteratorCategoryTag1, IteratorCategoryTag2 ) { - do + while (true) { // If we have reached the end of the left range then this is // the end of the loop. They are equal if and only if we have @@ -81,7 +86,12 @@ namespace boost return false; // continue looping if and only if the values are equal - } while(pred(*first1++, *first2++)); + if (!pred(*first1, *first2)) + break; + + ++first1; + ++first2; + } // Reaching this line in the algorithm indicates that a value // inequality has been detected. @@ -182,7 +192,7 @@ namespace boost } } // namespace range - using range::equal; + using ::boost::range::equal; } // namespace boost #endif // include guard diff --git a/include/boost/range/algorithm/for_each.hpp b/include/boost/range/algorithm/for_each.hpp index 12c9d4d..4f5108d 100644 --- a/include/boost/range/algorithm/for_each.hpp +++ b/include/boost/range/algorithm/for_each.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #if BOOST_WORKAROUND(BOOST_MSVC, == 1600) diff --git a/include/boost/range/algorithm_ext/copy_n.hpp b/include/boost/range/algorithm_ext/copy_n.hpp old mode 100755 new mode 100644 index ba7ad1c..f855441 --- a/include/boost/range/algorithm_ext/copy_n.hpp +++ b/include/boost/range/algorithm_ext/copy_n.hpp @@ -30,15 +30,15 @@ namespace boost /// /// \pre SinglePassRange is a model of the SinglePassRangeConcept /// \pre OutputIterator is a model of the OutputIteratorConcept -/// \pre 0 <= n < distance(rng) +/// \pre 0 <= n <= distance(rng) template< class SinglePassRange, class Size, class OutputIterator > inline OutputIterator copy_n(const SinglePassRange& rng, Size n, OutputIterator out) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_ASSERT( n < static_cast(boost::distance(rng)) ); + BOOST_ASSERT( n <= static_cast(::boost::distance(rng)) ); BOOST_ASSERT( n >= static_cast(0) ); - BOOST_DEDUCED_TYPENAME range_iterator::type source = boost::begin(rng); + BOOST_DEDUCED_TYPENAME range_iterator::type source = ::boost::begin(rng); for (Size i = 0; i < n; ++i, ++out, ++source) *out = *source; @@ -47,7 +47,7 @@ inline OutputIterator copy_n(const SinglePassRange& rng, Size n, OutputIterator } } // namespace range - using range::copy_n; + using ::boost::range::copy_n; } // namespace boost #endif // include guard diff --git a/include/boost/range/as_literal.hpp b/include/boost/range/as_literal.hpp index f67ead7..9ea144d 100644 --- a/include/boost/range/as_literal.hpp +++ b/include/boost/range/as_literal.hpp @@ -74,7 +74,7 @@ namespace boost #endif template< class T > - inline long is_char_ptr( T /* r */ ) + inline long is_char_ptr( const T& /* r */ ) { return 0L; } diff --git a/include/boost/range/counting_range.hpp b/include/boost/range/counting_range.hpp old mode 100755 new mode 100644 index 72733a2..b8e4e3a --- a/include/boost/range/counting_range.hpp +++ b/include/boost/range/counting_range.hpp @@ -18,7 +18,6 @@ #include #include #include -#include namespace boost { diff --git a/include/boost/range/detail/any_iterator.hpp b/include/boost/range/detail/any_iterator.hpp index 107dfd6..5705ff0 100644 --- a/include/boost/range/detail/any_iterator.hpp +++ b/include/boost/range/detail/any_iterator.hpp @@ -11,7 +11,6 @@ #define BOOST_RANGE_DETAIL_ANY_ITERATOR_HPP_INCLUDED #include -#include #include #include #include diff --git a/include/boost/range/detail/any_iterator_buffer.hpp b/include/boost/range/detail/any_iterator_buffer.hpp index 26c1420..2bb5d53 100644 --- a/include/boost/range/detail/any_iterator_buffer.hpp +++ b/include/boost/range/detail/any_iterator_buffer.hpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include namespace boost { diff --git a/include/boost/range/detail/join_iterator.hpp b/include/boost/range/detail/join_iterator.hpp index ce86467..bbdeec7 100644 --- a/include/boost/range/detail/join_iterator.hpp +++ b/include/boost/range/detail/join_iterator.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace boost { diff --git a/include/boost/range/detail/size_type.hpp b/include/boost/range/detail/size_type.hpp old mode 100755 new mode 100644 index ec49f4d..78a60a4 --- a/include/boost/range/detail/size_type.hpp +++ b/include/boost/range/detail/size_type.hpp @@ -17,12 +17,19 @@ // missing partial specialization workaround. ////////////////////////////////////////////////////////////////////////////// -namespace boost +namespace boost { - namespace range_detail - { + namespace range_detail + { template< typename T > - struct range_size_type_; + struct range_size_type_ + { + template< typename C > + struct pts + { + typedef std::size_t type; + }; + }; template<> struct range_size_type_ @@ -33,36 +40,14 @@ namespace boost typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type; }; }; + } - template<> - struct range_size_type_ - { - template< typename P > - struct pts - { - typedef std::size_t type; - }; - }; - - template<> - struct range_size_type_ - { - template< typename A > - struct pts - { - typedef std::size_t type; - }; - }; - - - } - template< typename C > class range_size { typedef typename range_detail::range::type c_type; public: - typedef typename range_detail::range_size_type_::BOOST_NESTED_TEMPLATE pts::type type; + typedef typename range_detail::range_size_type_::BOOST_NESTED_TEMPLATE pts::type type; }; } diff --git a/include/boost/range/has_range_iterator.hpp b/include/boost/range/has_range_iterator.hpp index 432efad..8046eb4 100644 --- a/include/boost/range/has_range_iterator.hpp +++ b/include/boost/range/has_range_iterator.hpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include namespace boost { diff --git a/include/boost/range/numeric.hpp b/include/boost/range/numeric.hpp old mode 100755 new mode 100644 index b01b73a..bfd1049 --- a/include/boost/range/numeric.hpp +++ b/include/boost/range/numeric.hpp @@ -40,7 +40,7 @@ namespace boost template< class SinglePassRange, class Value > inline Value accumulate( const SinglePassRange& rng, Value init ) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::accumulate( boost::begin(rng), boost::end(rng), init ); } diff --git a/include/boost/range/size.hpp b/include/boost/range/size.hpp index 4b4eebe..6ae74d1 100644 --- a/include/boost/range/size.hpp +++ b/include/boost/range/size.hpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include namespace boost @@ -26,7 +26,7 @@ namespace boost namespace range_detail { template - inline BOOST_DEDUCED_TYPENAME range_difference::type + inline BOOST_DEDUCED_TYPENAME range_size::type range_calculate_size(const SinglePassRange& rng) { BOOST_ASSERT( (boost::end(rng) - boost::begin(rng)) >= 0 && @@ -36,7 +36,7 @@ namespace boost } template - inline BOOST_DEDUCED_TYPENAME range_difference::type + inline BOOST_DEDUCED_TYPENAME range_size::type size(const SinglePassRange& rng) { #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ diff --git a/include/boost/range/size_type.hpp b/include/boost/range/size_type.hpp index 8c184f8..c6fb54b 100644 --- a/include/boost/range/size_type.hpp +++ b/include/boost/range/size_type.hpp @@ -16,11 +16,13 @@ #endif #include - +#include #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #include #else +#include +#include #include #include #include @@ -33,36 +35,44 @@ namespace boost ////////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////////// - - template< typename C > + + template + class has_size_type + { + typedef char no_type; + struct yes_type { char dummy[2]; }; + + template + static yes_type test(BOOST_DEDUCED_TYPENAME C::size_type x); + + template + static no_type test(Arg x); + + public: + static const bool value = sizeof(test(0)) == sizeof(yes_type); + }; + + template struct range_size + { + typedef BOOST_DEDUCED_TYPENAME make_unsigned< + BOOST_DEDUCED_TYPENAME range_difference::type + >::type type; + }; + + template + struct range_size< + C, + BOOST_DEDUCED_TYPENAME enable_if, void>::type + > { typedef BOOST_DEDUCED_TYPENAME C::size_type type; }; - - ////////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - struct range_size< std::pair > - { - typedef std::size_t type; - }; - - ////////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////////// - - template< typename T, std::size_t sz > - struct range_size< T[sz] > - { - typedef std::size_t type; - }; + } template< class T > - struct range_size : + struct range_size : detail::range_size { }; @@ -70,7 +80,7 @@ namespace boost struct range_size : detail::range_size { }; - + } // namespace boost #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/test/adl_conformance.cpp b/test/adl_conformance.cpp index 2d7f290..277c183 100644 --- a/test/adl_conformance.cpp +++ b/test/adl_conformance.cpp @@ -172,9 +172,9 @@ void check_adl_conformance() BOOST_CHECK_EQUAL( boost_test::begin( r6 ), global_namespace ); } -#include +#include -using boost::unit_test_framework::test_suite; +using boost::unit_test::test_suite; test_suite* init_unit_test_suite( int argc, char* argv[] ) { diff --git a/test/algorithm_test/for_each.cpp b/test/algorithm_test/for_each.cpp index 2ef51bf..701d676 100644 --- a/test/algorithm_test/for_each.cpp +++ b/test/algorithm_test/for_each.cpp @@ -44,7 +44,7 @@ namespace boost BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() ); fn_t result_fn2 = boost::for_each(boost::make_iterator_range(rng), fn_t(rng)); - BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() ); + BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn2.invocation_count() ); // Test the constant version const SinglePassRange& cref_rng = rng; diff --git a/test/begin.cpp b/test/begin.cpp index eb745c2..bbc11c1 100644 --- a/test/begin.cpp +++ b/test/begin.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace mock_std { @@ -104,12 +104,12 @@ namespace } } -using boost::unit_test_framework::test_suite; +using boost::unit_test::test_suite; -boost::unit_test_framework::test_suite* +boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] ) { - boost::unit_test_framework::test_suite* test = BOOST_TEST_SUITE( "Range Test Suite - begin() ADL namespace barrier" ); + boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "Range Test Suite - begin() ADL namespace barrier" ); test->add( BOOST_TEST_CASE( &test_range_begin ) ); diff --git a/test/compat2.cpp b/test/compat2.cpp index 1a5359c..2874c04 100644 --- a/test/compat2.cpp +++ b/test/compat2.cpp @@ -53,9 +53,9 @@ void compat1() iterator_of< std::vector >::type i = v.begin(); } -#include +#include -using boost::unit_test_framework::test_suite; +using boost::unit_test::test_suite; test_suite* init_unit_test_suite( int argc, char* argv[] ) { diff --git a/test/compat3.cpp b/test/compat3.cpp old mode 100755 new mode 100644 index 00987e4..5249c58 --- a/test/compat3.cpp +++ b/test/compat3.cpp @@ -53,9 +53,9 @@ void compat1() iterator_of< std::vector >::type i = v.begin(); } -#include +#include -using boost::unit_test_framework::test_suite; +using boost::unit_test::test_suite; test_suite* init_unit_test_suite( int argc, char* argv[] ) { diff --git a/test/end.cpp b/test/end.cpp index e3383c3..3e989ff 100644 --- a/test/end.cpp +++ b/test/end.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace mock_std { @@ -104,12 +104,12 @@ namespace } } -using boost::unit_test_framework::test_suite; +using boost::unit_test::test_suite; -boost::unit_test_framework::test_suite* +boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] ) { - boost::unit_test_framework::test_suite* test = BOOST_TEST_SUITE( "Range Test Suite - end() ADL namespace barrier" ); + boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "Range Test Suite - end() ADL namespace barrier" ); test->add( BOOST_TEST_CASE( &test_range_end_adl_avoidance ) ); diff --git a/test/extension_size.cpp b/test/extension_size.cpp index 856f87d..b6f15cd 100644 --- a/test/extension_size.cpp +++ b/test/extension_size.cpp @@ -40,7 +40,7 @@ namespace boost_range_extension_size_test impl_t m_impl; }; - inline boost::range_difference >::type + inline boost::range_size >::type range_calculate_size(const FooWithoutSize& rng) { return 2u; From bda0d613c17907185d3c75fa8586da8af967e5d6 Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Sun, 23 Sep 2012 18:59:28 +0000 Subject: [PATCH 46/73] [boost][range] merge from trunk to release [SVN r80677] --- include/boost/range/algorithm/for_each.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/range/algorithm/for_each.hpp b/include/boost/range/algorithm/for_each.hpp index 4f5108d..fe8ab80 100644 --- a/include/boost/range/algorithm/for_each.hpp +++ b/include/boost/range/algorithm/for_each.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include From a417560f096813796f348fb8fcbcfcd71b43770e Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Fri, 21 Dec 2012 08:44:32 +0000 Subject: [PATCH 47/73] [range] merge doc fixes (r81888, r81889) from trunk [SVN r82138] --- doc/history_ack.qbk | 2 +- doc/html/index.html | 9 +- doc/html/quickbook_HTML.manifest | 1 + doc/html/range/concepts.html | 5 +- .../range/concepts/bidirectional_range.html | 55 +++--- doc/html/range/concepts/concept_checking.html | 14 +- doc/html/range/concepts/forward_range.html | 37 ++-- doc/html/range/concepts/overview.html | 5 +- .../range/concepts/random_access_range.html | 42 ++--- .../range/concepts/single_pass_range.html | 54 +++--- doc/html/range/examples.html | 5 +- doc/html/range/faq.html | 5 +- doc/html/range/headers.html | 5 +- doc/html/range/headers/adaptors.html | 5 +- doc/html/range/headers/algorithm.html | 5 +- doc/html/range/headers/algorithm_ext.html | 5 +- doc/html/range/headers/general.html | 5 +- doc/html/range/history_ack.html | 21 +-- doc/html/range/introduction.html | 30 ++-- doc/html/range/mfc_atl.html | 18 +- doc/html/range/mfc_atl/atl_ranges.html | 5 +- doc/html/range/mfc_atl/const_ranges.html | 6 +- doc/html/range/mfc_atl/mfc_ranges.html | 5 +- doc/html/range/mfc_atl/references.html | 5 +- doc/html/range/mfc_atl/requirements.html | 5 +- doc/html/range/portability.html | 21 ++- doc/html/range/reference.html | 5 +- doc/html/range/reference/adaptors.html | 5 +- .../adaptors/general_requirements.html | 7 +- .../reference/adaptors/introduction.html | 38 ++--- .../range/reference/adaptors/reference.html | 5 +- .../adaptors/reference/adjacent_filtered.html | 10 +- .../reference/adaptors/reference/copied.html | 10 +- .../adaptors/reference/filtered.html | 10 +- .../reference/adaptors/reference/indexed.html | 10 +- .../adaptors/reference/indirected.html | 10 +- .../adaptors/reference/map_keys.html | 10 +- .../adaptors/reference/map_values.html | 10 +- .../adaptors/reference/replaced.html | 32 ++-- .../adaptors/reference/replaced_if.html | 30 ++-- .../adaptors/reference/reversed.html | 10 +- .../reference/adaptors/reference/sliced.html | 10 +- .../reference/adaptors/reference/strided.html | 10 +- .../adaptors/reference/tokenized.html | 45 +++-- .../adaptors/reference/transformed.html | 10 +- .../adaptors/reference/type_erased.html | 161 +++++++++--------- .../reference/adaptors/reference/uniqued.html | 10 +- doc/html/range/reference/algorithms.html | 5 +- doc/html/range/reference/algorithms/heap.html | 5 +- .../reference/algorithms/heap/make_heap.html | 36 ++-- .../reference/algorithms/heap/pop_heap.html | 42 ++--- .../reference/algorithms/heap/push_heap.html | 42 ++--- .../reference/algorithms/heap/sort_heap.html | 42 ++--- .../reference/algorithms/introduction.html | 23 ++- .../range/reference/algorithms/mutating.html | 5 +- .../reference/algorithms/mutating/copy.html | 42 ++--- .../algorithms/mutating/copy_backward.html | 42 ++--- .../reference/algorithms/mutating/fill.html | 36 ++-- .../reference/algorithms/mutating/fill_n.html | 38 ++--- .../algorithms/mutating/generate.html | 42 ++--- .../algorithms/mutating/inplace_merge.html | 54 +++--- .../reference/algorithms/mutating/merge.html | 54 +++--- .../algorithms/mutating/nth_element.html | 36 ++-- .../algorithms/mutating/partial_sort.html | 36 ++-- .../algorithms/mutating/partition.html | 36 ++-- .../algorithms/mutating/random_shuffle.html | 42 ++--- .../reference/algorithms/mutating/remove.html | 36 ++-- .../algorithms/mutating/remove_copy.html | 36 ++-- .../algorithms/mutating/remove_copy_if.html | 36 ++-- .../algorithms/mutating/remove_if.html | 36 ++-- .../algorithms/mutating/replace.html | 36 ++-- .../algorithms/mutating/replace_copy.html | 36 ++-- .../algorithms/mutating/replace_copy_if.html | 36 ++-- .../algorithms/mutating/replace_if.html | 36 ++-- .../algorithms/mutating/reverse.html | 36 ++-- .../algorithms/mutating/reverse_copy.html | 36 ++-- .../reference/algorithms/mutating/rotate.html | 42 ++--- .../algorithms/mutating/rotate_copy.html | 42 ++--- .../reference/algorithms/mutating/sort.html | 36 ++-- .../algorithms/mutating/stable_partition.html | 36 ++-- .../algorithms/mutating/stable_sort.html | 36 ++-- .../algorithms/mutating/swap_ranges.html | 36 ++-- .../algorithms/mutating/transform.html | 42 ++--- .../reference/algorithms/mutating/unique.html | 36 ++-- .../algorithms/mutating/unique_copy.html | 36 ++-- doc/html/range/reference/algorithms/new.html | 5 +- .../reference/algorithms/new/copy_n.html | 36 ++-- .../range/reference/algorithms/new/erase.html | 36 ++-- .../reference/algorithms/new/for_each.html | 36 ++-- .../reference/algorithms/new/insert.html | 36 ++-- .../range/reference/algorithms/new/iota.html | 36 ++-- .../reference/algorithms/new/is_sorted.html | 36 ++-- .../reference/algorithms/new/overwrite.html | 36 ++-- .../reference/algorithms/new/push_back.html | 36 ++-- .../reference/algorithms/new/push_front.html | 36 ++-- .../algorithms/new/remove_erase.html | 36 ++-- .../algorithms/new/remove_erase_if.html | 36 ++-- .../reference/algorithms/non_mutating.html | 5 +- .../non_mutating/adjacent_find.html | 36 ++-- .../non_mutating/binary_search.html | 42 ++--- .../algorithms/non_mutating/count.html | 36 ++-- .../algorithms/non_mutating/count_if.html | 36 ++-- .../algorithms/non_mutating/equal.html | 36 ++-- .../algorithms/non_mutating/equal_range.html | 46 ++--- .../algorithms/non_mutating/find.html | 36 ++-- .../algorithms/non_mutating/find_end.html | 36 ++-- .../non_mutating/find_first_of.html | 36 ++-- .../algorithms/non_mutating/find_if.html | 42 ++--- .../algorithms/non_mutating/for_each.html | 38 ++--- .../non_mutating/lexicographical_compare.html | 40 ++--- .../algorithms/non_mutating/lower_bound.html | 42 ++--- .../algorithms/non_mutating/max_element.html | 36 ++-- .../algorithms/non_mutating/min_element.html | 36 ++-- .../algorithms/non_mutating/mismatch.html | 44 ++--- .../algorithms/non_mutating/search.html | 36 ++-- .../algorithms/non_mutating/search_n.html | 36 ++-- .../algorithms/non_mutating/upper_bound.html | 42 ++--- .../range/reference/algorithms/numeric.html | 5 +- .../algorithms/numeric/accumulate.html | 50 +++--- .../numeric/adjacent_difference.html | 54 +++--- .../algorithms/numeric/inner_product.html | 54 +++--- .../algorithms/numeric/partial_sum.html | 54 +++--- .../reference/algorithms/permutation.html | 5 +- .../permutation/next_permutation.html | 36 ++-- .../permutation/prev_permutation.html | 36 ++-- doc/html/range/reference/algorithms/set.html | 5 +- .../reference/algorithms/set/includes.html | 44 ++--- .../algorithms/set/set_difference.html | 42 ++--- .../algorithms/set/set_intersection.html | 44 ++--- .../set/set_symmetric_difference.html | 44 ++--- .../reference/algorithms/set/set_union.html | 46 ++--- .../reference/concept_implementation.html | 5 +- .../concept_implementation/semantics.html | 11 +- .../semantics/functions.html | 7 +- .../semantics/metafunctions.html | 7 +- .../concept_implementation/synopsis.html | 104 +++++------ doc/html/range/reference/extending.html | 5 +- .../range/reference/extending/method_1.html | 5 +- .../range/reference/extending/method_2.html | 76 ++++----- .../range/reference/extending/method_3.html | 5 +- .../extending/method_3/method_3_1.html | 10 +- .../extending/method_3/method_3_2.html | 10 +- doc/html/range/reference/overview.html | 5 +- doc/html/range/reference/ranges.html | 5 +- .../range/reference/ranges/any_range.html | 24 +-- .../reference/ranges/counting_range.html | 30 ++-- doc/html/range/reference/ranges/irange.html | 36 ++-- .../range/reference/ranges/istream_range.html | 24 +-- doc/html/range/reference/utilities.html | 5 +- .../reference/utilities/iterator_range.html | 112 ++++++------ doc/html/range/reference/utilities/join.html | 18 +- .../range/reference/utilities/sub_range.html | 57 +++---- doc/html/range/style_guide.html | 53 +++--- doc/html/range/upgrade.html | 13 +- doc/html/range/upgrade/upgrade_from_1_34.html | 5 +- doc/html/range/upgrade/upgrade_from_1_42.html | 5 +- doc/html/range/upgrade/upgrade_from_1_45.html | 11 +- doc/html/range/upgrade/upgrade_from_1_49.html | 50 ++++++ doc/reference/adaptors/type_erased.qbk | 2 +- doc/reference/algorithm/fill_n.qbk | 2 +- .../algorithm/lexicographical_compare.qbk | 2 +- doc/reference/algorithm/mismatch.qbk | 2 +- doc/reference/numeric/accumulate.qbk | 2 +- doc/reference/utilities.qbk | 2 +- doc/upgrade.qbk | 2 + 165 files changed, 2312 insertions(+), 2240 deletions(-) create mode 100644 doc/html/range/upgrade/upgrade_from_1_49.html diff --git a/doc/history_ack.qbk b/doc/history_ack.qbk index f8c39e4..27f9e2a 100644 --- a/doc/history_ack.qbk +++ b/doc/history_ack.qbk @@ -20,7 +20,7 @@ Special thanks goes to * Pavel Vozenilek for help with porting the library * Jonathan Turkanis and John Torjo for help with documentation * Hartmut Kaiser for being review manager -* Jonathan Turkanis for porting the lib (as far sa possible) to vc6 and vc7. +* Jonathan Turkanis for porting the lib (as far as possible) to vc6 and vc7. The concept checks and their documentation was provided by Daniel Walker. diff --git a/doc/html/index.html b/doc/html/index.html index 1be23d5..e67d025 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -28,9 +28,10 @@

    Neil Groves

    -
    +
    -

    +

    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)

    @@ -122,6 +123,8 @@
    Upgrade version of Boost.Range
    +
    Upgrade from version + 1.49
    Upgrade from version 1.45
    Upgrade from version @@ -144,7 +147,7 @@

    - +

    Last revised: January 01, 2011 at 16:31:27 GMT

    Last revised: December 13, 2012 at 06:53:49 GMT


    diff --git a/doc/html/quickbook_HTML.manifest b/doc/html/quickbook_HTML.manifest index 1b32f72..27afd8c 100644 --- a/doc/html/quickbook_HTML.manifest +++ b/doc/html/quickbook_HTML.manifest @@ -147,6 +147,7 @@ range/mfc_atl/atl_ranges.html range/mfc_atl/const_ranges.html range/mfc_atl/references.html range/upgrade.html +range/upgrade/upgrade_from_1_49.html range/upgrade/upgrade_from_1_45.html range/upgrade/upgrade_from_1_42.html range/upgrade/upgrade_from_1_34.html diff --git a/doc/html/range/concepts.html b/doc/html/range/concepts.html index c3c92a8..f78f33b 100644 --- a/doc/html/range/concepts.html +++ b/doc/html/range/concepts.html @@ -22,7 +22,7 @@
    -
    +
    @@ -37,7 +37,8 @@
    -