From 65e229fb0d83183844409dd295481a9bf0707345 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 10 Dec 2007 15:19:21 +0000 Subject: [PATCH 01/29] SunPro 5.9 can't detect lvalue returns [SVN r41956] --- include/boost/iterator/detail/config_def.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index 3aba895..860332a 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -49,7 +49,9 @@ #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) \ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ - || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) + || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + # define BOOST_NO_LVALUE_RETURN_DETECTION # if 0 // test code From efecbd0d277bda99f3e7262c3a44f461200bda39 Mon Sep 17 00:00:00 2001 From: Boris Gubenko Date: Sat, 15 Dec 2007 03:42:49 +0000 Subject: [PATCH 02/29] don't use identifires R1 and R2: some HP-UX headers define them as macros [SVN r42064] --- include/boost/iterator/iterator_facade.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index f9ea47c..042f978 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -433,26 +433,26 @@ namespace boost # ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY # define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ template < \ - class Derived1, class V1, class TC1, class R1, class D1 \ - , class Derived2, class V2, class TC2, class R2, class D2 \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ > \ prefix typename mpl::apply2::type \ operator op( \ - iterator_facade const& lhs \ - , iterator_facade const& rhs) + iterator_facade const& lhs \ + , iterator_facade const& rhs) # else # define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ template < \ - class Derived1, class V1, class TC1, class R1, class D1 \ - , class Derived2, class V2, class TC2, class R2, class D2 \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ > \ prefix typename boost::detail::enable_if_interoperable< \ Derived1, Derived2 \ , typename mpl::apply2::type \ >::type \ operator op( \ - iterator_facade const& lhs \ - , iterator_facade const& rhs) + iterator_facade const& lhs \ + , iterator_facade const& rhs) # endif # define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \ From bf7d904bf85219c9e03d1d0ba95ce6fd4c29a2d8 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 10 Feb 2008 15:02:17 +0000 Subject: [PATCH 03/29] Point links to the pages that used to be in 'more' to the site. [SVN r43210] --- doc/index.html | 4 ++-- doc/index.rst | 4 ++-- doc/iterator_facade.html | 2 +- doc/iterator_facade_tutorial.rst | 2 +- doc/quickbook/facade_tutorial.qbk | 2 +- doc/quickbook/iterator.qbk | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/index.html b/doc/index.html index 6963fc9..afde947 100755 --- a/doc/index.html +++ b/doc/index.html @@ -40,7 +40,7 @@ Lab, Zephyr Abstract:The Boost Iterator Library contains two parts. The first -is a system of concepts which extend the C++ standard +is a system of concepts which extend the C++ standard iterator requirements. The second is a framework of components for building iterators based on these extended concepts and includes several useful iterator @@ -179,7 +179,7 @@ implement iterators, you probably wrote a type generator to build the +you probably wrote a type generator to build the iterator_adaptor specialization you needed; in the new library design you don't need a type generator (though may want to keep it around as a compatibility aid for older code) because, due to the diff --git a/doc/index.rst b/doc/index.rst index 32db09a..6be27c3 100755 --- a/doc/index.rst +++ b/doc/index.rst @@ -43,7 +43,7 @@ __ ../../../index.htm The components of the Boost Iterator Library replace the older Boost Iterator Adaptor Library. -.. _concepts: ../../../more/generic_programming.html#concept +.. _concepts: http://www.boost.org/more/generic_programming.html#concept .. contents:: **Table of Contents** @@ -271,7 +271,7 @@ over how your iterator works: you can add additional constructors, or even override the iterator functionality provided by the library. -.. _`type generator`: ../../../more/generic_programming.html#type_generator +.. _`type generator`: http://www.boost.org/more/generic_programming.html#type_generator If you're looking for the old ``projection_iterator`` component, its functionality has been merged into ``transform_iterator``: as diff --git a/doc/iterator_facade.html b/doc/iterator_facade.html index c576743..57a69c0 100644 --- a/doc/iterator_facade.html +++ b/doc/iterator_facade.html @@ -866,7 +866,7 @@ operator -(iterator_facade<Dr1,V1,TC1,R1,D1> const& lhs,

In this section we'll walk through the implementation of a few iterators using iterator_facade, based around the simple example of a linked list of polymorphic objects. This example was -inspired by a posting by Keith Macdonald on the Boost-Users +inspired by a posting by Keith Macdonald on the Boost-Users mailing list.

The Problem

diff --git a/doc/iterator_facade_tutorial.rst b/doc/iterator_facade_tutorial.rst index c133b48..75564b7 100755 --- a/doc/iterator_facade_tutorial.rst +++ b/doc/iterator_facade_tutorial.rst @@ -8,7 +8,7 @@ example of a linked list of polymorphic objects. This example was inspired by a `posting`__ by Keith Macdonald on the `Boost-Users`_ mailing list. -.. _`Boost-Users`: ../../../more/mailing_lists.htm#users +.. _`Boost-Users`: http://www.boost.org/more/mailing_lists.htm#users __ http://thread.gmane.org/gmane.comp.lib.boost.user/5100 diff --git a/doc/quickbook/facade_tutorial.qbk b/doc/quickbook/facade_tutorial.qbk index 3687758..09682ac 100644 --- a/doc/quickbook/facade_tutorial.qbk +++ b/doc/quickbook/facade_tutorial.qbk @@ -7,7 +7,7 @@ example of a linked list of polymorphic objects. This example was inspired by a [@http://thread.gmane.org/gmane.comp.lib.boost.user/5100 `posting`] by Keith Macdonald on the -[@../../../more/mailing_lists.htm#users `Boost-Users`] +[@http://www.boost.org/more/mailing_lists.htm#users `Boost-Users`] mailing list. diff --git a/doc/quickbook/iterator.qbk b/doc/quickbook/iterator.qbk index d2e9e75..9c7c4b7 100644 --- a/doc/quickbook/iterator.qbk +++ b/doc/quickbook/iterator.qbk @@ -32,7 +32,7 @@ [section:intro Introduction] -[def _concepts_ [@../../more/generic_programming.html#concept concepts]] +[def _concepts_ [@http://www.boost.org/more/generic_programming.html#concept concepts]] The Boost Iterator Library contains two parts. The first is a system of _concepts_ which extend the C++ standard @@ -203,7 +203,7 @@ templates. [section:upgrading Upgrading from the old Boost Iterator Adaptor Library] -[def _type_generator_ [@../../more/generic_programming.html#type_generator type generator]] +[def _type_generator_ [@http://www.boost.org/more/generic_programming.html#type_generator type generator]] If you have been using the old Boost Iterator Adaptor library to implement iterators, you probably wrote a `Policies` class which From e06c4b327979de0f24c5e1d040f91ec08f43f0de Mon Sep 17 00:00:00 2001 From: Nicola Musatti Date: Thu, 9 Oct 2008 21:49:48 +0000 Subject: [PATCH 04/29] Applied patch from ticket #2344 [SVN r49227] --- include/boost/iterator/detail/config_def.hpp | 2 +- include/boost/iterator/indirect_iterator.hpp | 2 +- include/boost/iterator/iterator_adaptor.hpp | 9 +++++++-- include/boost/iterator/iterator_facade.hpp | 3 +-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index 860332a..fa8d667 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -47,7 +47,7 @@ #endif #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) diff --git a/include/boost/iterator/indirect_iterator.hpp b/include/boost/iterator/indirect_iterator.hpp index f181107..abff7e7 100644 --- a/include/boost/iterator/indirect_iterator.hpp +++ b/include/boost/iterator/indirect_iterator.hpp @@ -110,7 +110,7 @@ namespace boost private: typename super_t::reference dereference() const { -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# if BOOST_WORKAROUND(__BORLANDC__, < 0x5A0 ) return const_cast(**this->base()); # else return **this->base(); diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index ef667c7..27b08ff 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -24,9 +24,14 @@ #ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY # include -#else + +# if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) +# include +# endif + +#else # include -#endif +#endif #include diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 042f978..967d60f 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -470,8 +470,7 @@ namespace boost // class iterator_core_access { -# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) // Tasteless as this may seem, making all members public allows member templates // to work in the absence of member template friends. public: From b0ec5a759b074c7f6129a60f41d1adbf1bcb78ca Mon Sep 17 00:00:00 2001 From: "Michael A. Jackson" Date: Sat, 1 Nov 2008 13:15:41 +0000 Subject: [PATCH 05/29] Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor [SVN r49510] --- CMakeLists.txt | 24 ++++++++++++++++++++++++ module.cmake | 1 + test/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 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..38d6b56 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +#---------------------------------------------------------------------------- +# This file was automatically generated from the original CMakeLists.txt file +# Add a variable to hold the headers for the library +set (lib_headers + iterator.hpp + iterator +) + +# Add a library target to the build system +boost_library_project( + iterator + # SRCDIRS + TESTDIRS test + HEADERS ${lib_headers} + # DOCDIRS + DESCRIPTION "A system of concepts which extend the C++ standard iterator requirementsand a framework of components for building iterators based on these extended concepts and includes several useful iterator adaptors." + MODULARIZED + AUTHORS "David Abrahams " + "Jeremy Siek " + "Thomas Witt " + # MAINTAINERS +) + + diff --git a/module.cmake b/module.cmake new file mode 100644 index 0000000..f918433 --- /dev/null +++ b/module.cmake @@ -0,0 +1 @@ +boost_module(iterator DEPENDS config mpl type_traits function) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..1fd81bc --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,31 @@ +# These first two tests will run last, and are expected to fail +# for many less-capable compilers. + +boost_test_compile_fail(interoperable_fail) +# test uses expected success, so that we catch unrelated +# compilation problems. +boost_test_run(is_convertible_fail) +boost_test_run(zip_iterator_test) + +# These tests should work for just about everything. +boost_test_compile(is_lvalue_iterator) +boost_test_compile(is_readable_iterator) +boost_test_compile(pointee) + +boost_test_run(unit_tests) +boost_test_run(concept_tests) +boost_test_run(iterator_adaptor_cc) +boost_test_run(iterator_adaptor_test) +boost_test_compile(iterator_archetype_cc) +boost_test_compile_fail(iter_archetype_default_ctor) +boost_test_compile_fail(lvalue_concept_fail) +boost_test_run(transform_iterator_test) +boost_test_run(indirect_iterator_test) +boost_test_compile(indirect_iter_member_types) +boost_test_run(filter_iterator_test) +boost_test_run(iterator_facade) +boost_test_run(reverse_iterator_test) +boost_test_run(counting_iterator_test) +boost_test_run(interoperable) +boost_test_run(iterator_traits_test) +boost_test_run(permutation_iterator_test) From 835498603d4fd2aaa413d9f6aad840b516779a83 Mon Sep 17 00:00:00 2001 From: "Michael A. Jackson" Date: Fri, 7 Nov 2008 17:02:56 +0000 Subject: [PATCH 06/29] Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use. [SVN r49627] --- test/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1fd81bc..8cad411 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,5 @@ +boost_additional_test_dependencies(iterator BOOST_DEPENDS test tuple smart_ptr) + # These first two tests will run last, and are expected to fail # for many less-capable compilers. From 55c08b706c96b915712a9c2b9af5eff6133855ec Mon Sep 17 00:00:00 2001 From: "Michael A. Jackson" Date: Fri, 7 Nov 2008 17:05:27 +0000 Subject: [PATCH 07/29] Updating dependency information for modularized libraries. [SVN r49628] --- module.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.cmake b/module.cmake index f918433..2e025e3 100644 --- a/module.cmake +++ b/module.cmake @@ -1 +1 @@ -boost_module(iterator DEPENDS config mpl type_traits function) \ No newline at end of file +boost_module(iterator DEPENDS mpl type_traits function concept_check) \ No newline at end of file From f2433c63d563401616499bb08761add3b1db085f Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 17 Feb 2009 10:05:58 +0000 Subject: [PATCH 08/29] Add PDF generation options to fix external links to point to the web site. Added a few more Boostbook based libs that were missed first time around. Fixed PDF naming issues. [SVN r51284] --- doc/Jamfile.v2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 2fe0c7a..f6bef47 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -16,5 +16,7 @@ boostbook standalone toc.max.depth=3 toc.section.depth=3 chunk.section.depth=4 + pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/libs/iterator/doc ; + From 76fd8e27fbc52b6a1280aef84b3b4f3d9af364d1 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sun, 26 Jul 2009 00:49:56 +0000 Subject: [PATCH 09/29] Copyrights on CMakeLists.txt to keep them from clogging up the inspect reports. This is essentially the same commit as r55095 on the release branch. [SVN r55159] --- CMakeLists.txt | 6 ++++++ test/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38d6b56..bd83261 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/test/CMakeLists.txt b/test/CMakeLists.txt index 8cad411..1b0c5be 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(iterator BOOST_DEPENDS test tuple smart_ptr) # These first two tests will run last, and are expected to fail From d11c7a3ec4d34cc16aecb246d636528948702ad5 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 17 Oct 2009 02:07:38 +0000 Subject: [PATCH 10/29] rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back [SVN r56942] --- CMakeLists.txt | 30 ------------------------------ module.cmake | 1 - test/CMakeLists.txt | 39 --------------------------------------- 3 files changed, 70 deletions(-) delete mode 100644 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 bd83261..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,30 +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 - iterator.hpp - iterator -) - -# Add a library target to the build system -boost_library_project( - iterator - # SRCDIRS - TESTDIRS test - HEADERS ${lib_headers} - # DOCDIRS - DESCRIPTION "A system of concepts which extend the C++ standard iterator requirementsand a framework of components for building iterators based on these extended concepts and includes several useful iterator adaptors." - MODULARIZED - AUTHORS "David Abrahams " - "Jeremy Siek " - "Thomas Witt " - # MAINTAINERS -) - - diff --git a/module.cmake b/module.cmake deleted file mode 100644 index 2e025e3..0000000 --- a/module.cmake +++ /dev/null @@ -1 +0,0 @@ -boost_module(iterator DEPENDS mpl type_traits function concept_check) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 1b0c5be..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,39 +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(iterator BOOST_DEPENDS test tuple smart_ptr) - -# These first two tests will run last, and are expected to fail -# for many less-capable compilers. - -boost_test_compile_fail(interoperable_fail) -# test uses expected success, so that we catch unrelated -# compilation problems. -boost_test_run(is_convertible_fail) -boost_test_run(zip_iterator_test) - -# These tests should work for just about everything. -boost_test_compile(is_lvalue_iterator) -boost_test_compile(is_readable_iterator) -boost_test_compile(pointee) - -boost_test_run(unit_tests) -boost_test_run(concept_tests) -boost_test_run(iterator_adaptor_cc) -boost_test_run(iterator_adaptor_test) -boost_test_compile(iterator_archetype_cc) -boost_test_compile_fail(iter_archetype_default_ctor) -boost_test_compile_fail(lvalue_concept_fail) -boost_test_run(transform_iterator_test) -boost_test_run(indirect_iterator_test) -boost_test_compile(indirect_iter_member_types) -boost_test_run(filter_iterator_test) -boost_test_run(iterator_facade) -boost_test_run(reverse_iterator_test) -boost_test_run(counting_iterator_test) -boost_test_run(interoperable) -boost_test_run(iterator_traits_test) -boost_test_run(permutation_iterator_test) From 4c60e26bf8cdf6602375eaab23a95f4849333fd6 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 28 Nov 2009 05:12:29 +0000 Subject: [PATCH 11/29] Made sure that iterator_facade's nested ``::pointer`` type is always the same as what's returned from operator->. For input iterators, that wasn't always the case (see operator_arrow_proxy). Fixes #1019. [SVN r57989] --- include/boost/iterator/iterator_facade.hpp | 24 +++++++++++----------- test/iterator_facade.cpp | 6 ++++++ 2 files changed, 18 insertions(+), 12 deletions(-) mode change 100755 => 100644 test/iterator_facade.cpp diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 967d60f..9696b50 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -105,6 +105,7 @@ namespace boost typedef typename remove_const::type value_type; + // Not the real associated pointer type typedef typename mpl::eval_if< boost::detail::iterator_writability_disabled , add_pointer @@ -617,6 +618,12 @@ namespace boost Value, CategoryOrTraversal, Reference, Difference > associated_types; + typedef boost::detail::operator_arrow_result< + typename associated_types::value_type + , Reference + , typename associated_types::pointer + > pointer_; + protected: // For use by derived classes typedef iterator_facade iterator_facade_; @@ -626,7 +633,9 @@ namespace boost typedef typename associated_types::value_type value_type; typedef Reference reference; typedef Difference difference_type; - typedef typename associated_types::pointer pointer; + + typedef typename pointer_::type pointer; + typedef typename associated_types::iterator_category iterator_category; reference operator*() const @@ -634,18 +643,9 @@ namespace boost return iterator_core_access::dereference(this->derived()); } - typename boost::detail::operator_arrow_result< - value_type - , reference - , pointer - >::type - operator->() const + pointer operator->() const { - return boost::detail::operator_arrow_result< - value_type - , reference - , pointer - >::make(*this->derived()); + return pointer_::make(*this->derived()); } typename boost::detail::operator_brackets_result::type diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp old mode 100755 new mode 100644 index ed3057e..5efd51d --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -87,6 +87,10 @@ struct input_iter } }; +template +void same_type(U const&) +{ BOOST_MPL_ASSERT((boost::is_same)); } + int main() { int state = 0; @@ -101,6 +105,8 @@ int main() input_iter p; (*p).mutator(); p->mutator(); + + same_type(p.operator->()); return boost::report_errors(); } From ac522bc9e174ec7459796f21d0c196aac54a6402 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 28 Nov 2009 18:53:43 +0000 Subject: [PATCH 12/29] category of each component iterator is reduced to a known category before we try to find a minimum. Closes #1517 [SVN r58012] --- include/boost/iterator/zip_iterator.hpp | 2 +- test/zip_iterator_test.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) mode change 100755 => 100644 include/boost/iterator/zip_iterator.hpp mode change 100755 => 100644 test/zip_iterator_test.cpp diff --git a/include/boost/iterator/zip_iterator.hpp b/include/boost/iterator/zip_iterator.hpp old mode 100755 new mode 100644 index f3896ad..a468070 --- a/include/boost/iterator/zip_iterator.hpp +++ b/include/boost/iterator/zip_iterator.hpp @@ -357,7 +357,7 @@ namespace boost { { typedef typename tuple_impl_specific::tuple_meta_transform< IteratorTuple - , iterator_traversal<> + , pure_traversal_tag > >::type tuple_of_traversal_tags; typedef typename tuple_impl_specific::tuple_meta_accumulate< diff --git a/test/zip_iterator_test.cpp b/test/zip_iterator_test.cpp old mode 100755 new mode 100644 index c6692d2..8062f08 --- a/test/zip_iterator_test.cpp +++ b/test/zip_iterator_test.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,27 @@ struct pure_traversal typename boost::iterator_traversal::type > {}; + + +/// Tests for https://svn.boost.org/trac/boost/ticket/1517 +int to_value(int const &v) +{ + return v; +} + +void category_test() +{ + std::list rng1; + std::string rng2; + + boost::make_zip_iterator( + boost::make_tuple( + boost::make_transform_iterator(rng1.begin(), &to_value), // BidirectionalInput + rng2.begin() // RandomAccess + ) + ); +} +/// ///////////////////////////////////////////////////////////////////////////// // @@ -70,6 +92,8 @@ struct pure_traversal int main( void ) { + category_test(); + std::cout << "\n" << "***********************************************\n" << "* *\n" From c07f55ff65d006fc82cb79c23925231458908d17 Mon Sep 17 00:00:00 2001 From: Jeremiah Willcock Date: Tue, 8 Jun 2010 19:10:16 +0000 Subject: [PATCH 13/29] Removed unneeded #include; fixes #1533 [SVN r62593] --- include/boost/iterator/transform_iterator.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index e449a8b..c365fe0 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -7,7 +7,6 @@ #ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP #define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP -#include #include #include #include From 6bb82230b94e87177a43ccac736c6de8f4dd5fad Mon Sep 17 00:00:00 2001 From: Jeremiah Willcock Date: Wed, 9 Jun 2010 00:09:56 +0000 Subject: [PATCH 14/29] Added function_input_iterator from Dean Michael Berris; fixes #2893 [SVN r62615] --- doc/function_input_iterator.html | 142 ++++++++++++++++++ doc/function_input_iterator.rst | 126 ++++++++++++++++ doc/index.html | 44 +++--- doc/index.rst | 14 +- doc/sources.py | 1 + .../iterator/function_input_iterator.hpp | 64 ++++++++ 6 files changed, 366 insertions(+), 25 deletions(-) create mode 100644 doc/function_input_iterator.html create mode 100644 doc/function_input_iterator.rst mode change 100755 => 100644 doc/index.html mode change 100755 => 100644 doc/index.rst create mode 100644 include/boost/iterator/function_input_iterator.hpp diff --git a/doc/function_input_iterator.html b/doc/function_input_iterator.html new file mode 100644 index 0000000..e097a46 --- /dev/null +++ b/doc/function_input_iterator.html @@ -0,0 +1,142 @@ + + + + + + + + + + + +
+ + +++ + + + + + +
Author:Dean Michael Berris
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)
+
+

Function Input Iterator

+

The Function Input Iterator allows for creating iterators that encapsulate +a nullary function object and a state object which tracks the number of times +the iterator has been incremented. A Function Input Iterator models the +InputIterator concept and is useful for creating bounded input iterators.

+

Like the Generator Iterator, the Function Input Iterator takes a function +that models the Generator concept (which is basically a nullary or 0-arity +function object). Each increment of the function Function Input Iterator +invokes the generator function and stores the value in the iterator. When +the iterator is dereferenced the stored value is returned.

+

The Function Input Iterator encapsulates a state object which models the +Incrementable Concept and the EqualityComparable Concept. These concepts are +described below as:

+
+

Incrementable Concept

+

A type models the Incrementable Concept when it supports the pre- and post- +increment operators. For a given object i with type I, the following +constructs should be valid:

+ +++++ + + + + + + + + + + + + +
Construct Description Return Type
i++Post-increment i.I
++iPre-increment i.I&
+

NOTE: An Incrementable type should also be DefaultConstructible.

+
+
+

Synopsis

+
+namespace {
+    template <class Function, class State>
+    class function_input_iterator;
+
+    template <class Function, class State>
+    typename function_input_iterator<Function, State>
+    make_function_input_iterator(Function & f);
+
+    struct infinite;
+}
+
+
+
+

Function Input Iterator Class

+

The class Function Input Iterator class takes two template parameters +Function and State. These two template parameters tell the +Function Input Iterator the type of the function to encapsulate and +the type of the internal state value to hold.

+

The State parameter is important in cases where you want to +control the type of the counter which determines whether two iterators +are at the same state. This allows for creating a pair of iterators which +bound the range of the invocations of the encapsulated functions.

+
+
+

Examples

+

The following example shows how we use the function input iterator class +in cases where we want to create bounded (lazy) generated ranges.

+
+struct generator {
+    typedef int result_type;
+    generator() { srand(time(0)); }
+    result_type operator() () const {
+        return rand();
+    }
+};
+
+int main(int argc, char * argv[]) {
+    generator f;
+    copy(
+            make_function_input_iterator(f, 0),
+            make_function_input_iterator(f, 10),
+            ostream_iterator<int>(cout, " ")
+        );
+    return 0;
+}
+
+

Here we can see that we've bounded the number of invocations using an int +that counts from 0 to 10. Say we want to create an endless stream +of random numbers and encapsulate that in a pair of integers, we can do +it with the boost::infinite helper class.

+
+copy(
+        make_function_input_iterator(f,infinite()),
+        make_function_input_iterator(f,infinite()),
+        ostream_iterator<int>(count, " ")
+    );
+
+

Above, instead of creating a huge vector we rely on the STL copy algorithm +to traverse the function input iterator and call the function object f +as it increments the iterator. The special property of boost::infinite +is that equating two instances always yield false -- and that incrementing +an instance of boost::infinite doesn't do anything. This is an efficient +way of stating that the iterator range provided by two iterators with an +encapsulated infinite state will definitely be infinite.

+
+
+
+ + + diff --git a/doc/function_input_iterator.rst b/doc/function_input_iterator.rst new file mode 100644 index 0000000..d073fa0 --- /dev/null +++ b/doc/function_input_iterator.rst @@ -0,0 +1,126 @@ +:Author: + `Dean Michael Berris `_ + +: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) + +Function Input Iterator +======================= + +The Function Input Iterator allows for creating iterators that encapsulate +a nullary function object and a state object which tracks the number of times +the iterator has been incremented. A Function Input Iterator models the +`InputIterator`_ concept and is useful for creating bounded input iterators. + +.. _InputIterator: http://www.sgi.com/tech/stl/InputIterator.html + +Like the Generator Iterator, the Function Input Iterator takes a function +that models the Generator_ concept (which is basically a nullary or 0-arity +function object). Each increment of the function Function Input Iterator +invokes the generator function and stores the value in the iterator. When +the iterator is dereferenced the stored value is returned. + +.. _Generator: http://www.sgi.com/tech/stl/Generator.html + +The Function Input Iterator encapsulates a state object which models the +`Incrementable Concept`_ and the EqualityComparable_ Concept. These concepts are +described below as: + +.. _EqualityComparable: http://www.sgi.com/tech/stl/EqualityComparable.html + +Incrementable Concept +--------------------- + +A type models the Incrementable Concept when it supports the pre- and post- +increment operators. For a given object ``i`` with type ``I``, the following +constructs should be valid: + +========= ================= =========== +Construct Description Return Type +----------------------------------------- +i++ Post-increment i. I +++i Pre-increment i. I& +========= ================= =========== + +NOTE: An Incrementable type should also be DefaultConstructible_. + +.. _DefaultConstructible: http://www.sgi.com/tech/stl/DefaultConstructible.html + +Synopsis +-------- + +:: + + namespace { + template + class function_input_iterator; + + template + typename function_input_iterator + make_function_input_iterator(Function & f); + + struct infinite; + } + +Function Input Iterator Class +----------------------------- + +The class Function Input Iterator class takes two template parameters +``Function`` and ``State``. These two template parameters tell the +Function Input Iterator the type of the function to encapsulate and +the type of the internal state value to hold. + +The ``State`` parameter is important in cases where you want to +control the type of the counter which determines whether two iterators +are at the same state. This allows for creating a pair of iterators which +bound the range of the invocations of the encapsulated functions. + +Examples +-------- + +The following example shows how we use the function input iterator class +in cases where we want to create bounded (lazy) generated ranges. + +:: + + struct generator { + typedef int result_type; + generator() { srand(time(0)); } + result_type operator() () const { + return rand(); + } + }; + + int main(int argc, char * argv[]) { + generator f; + copy( + make_function_input_iterator(f, 0), + make_function_input_iterator(f, 10), + ostream_iterator(cout, " ") + ); + return 0; + } + +Here we can see that we've bounded the number of invocations using an ``int`` +that counts from ``0`` to ``10``. Say we want to create an endless stream +of random numbers and encapsulate that in a pair of integers, we can do +it with the ``boost::infinite`` helper class. + +:: + + copy( + make_function_input_iterator(f,infinite()), + make_function_input_iterator(f,infinite()), + ostream_iterator(count, " ") + ); + +Above, instead of creating a huge vector we rely on the STL copy algorithm +to traverse the function input iterator and call the function object f +as it increments the iterator. The special property of ``boost::infinite`` +is that equating two instances always yield false -- and that incrementing +an instance of ``boost::infinite`` doesn't do anything. This is an efficient +way of stating that the iterator range provided by two iterators with an +encapsulated infinite state will definitely be infinite. + + diff --git a/doc/index.html b/doc/index.html old mode 100755 new mode 100644 index afde947..7e7dd9a --- a/doc/index.html +++ b/doc/index.html @@ -3,7 +3,7 @@ - + The Boost.Iterator Library Boost @@ -11,9 +11,6 @@