From 88c36c194163300a218ca5a91ca0f25319f43e0a Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 28 Aug 2017 20:41:11 +0300 Subject: [PATCH] Remove generator iterator test and docs as these were moved to Boost.Iterator. --- generator_iterator.htm | 163 ------------------------------- index.html | 2 +- test/Jamfile.v2 | 2 - test/generator_iterator_test.cpp | 63 ------------ 4 files changed, 1 insertion(+), 229 deletions(-) delete mode 100644 generator_iterator.htm delete mode 100644 test/generator_iterator_test.cpp diff --git a/generator_iterator.htm b/generator_iterator.htm deleted file mode 100644 index b0e376e..0000000 --- a/generator_iterator.htm +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - Generator Iterator Adaptor Documentation - - - - boost.png (6897 bytes) - -

Generator Iterator Adaptor

- -

Defined in header boost/generator_iterator.hpp

- -

The generator iterator adaptor makes it easier to create custom input - iterators from 0-ary functions and function objects. The adaptor takes a - Generator and - creates a model of Input Iterator. Each - increment retrieves an item from the generator and makes it available to be - retrieved by dereferencing. The motivation for this iterator is that some - concepts can be more naturally expressed as a generator, while most STL - algorithms expect an iterator. An example is the Random Number library.

- -

Synopsis

- -
-
-namespace boost {
-  template <class Generator>
-  class generator_iterator_policies;
-
-  template <class Generator>
-  class generator_iterator_generator;
-
-  template <class Generator>
-  typename generator_iterator_generator<Generator>::type
-  make_generator_iterator(Generator & gen);
-}
-
-
-
- -

The Generator Iterator Generator Class

- -

The class generator_iterator_generator is a helper class whose purpose - is to construct a generator iterator type. The template parameter for this - class is the Generator function object type that is being wrapped. The - generator iterator adaptor only holds a reference (or pointer) to the - function object, therefore the function object must outlive the generator - iterator adaptor constructed from it.

-
-template <class Generator>
-class generator_iterator_generator
-{
-public:
-  typedef unspecified type; // the resulting generator iterator type 
-}
-
- -

Template Parameters

- - - - - - - - - - - - - -
ParameterDescription
GeneratorThe generator (0-ary function object) type being wrapped. The - return type of the function must be defined as - Generator::result_type. The function object must be a model of - Generator.
- -

Concept Model

- -

The generator iterator class is a model of Input Iterator.

- -

Members

- -

The generator iterator implements the member functions and operators - required of the Input Iterator - concept.

-
- -

The - Generator Iterator Object Generator

- -

The make_generator_iterator() function provides a convenient - way to create generator iterator objects. The function saves the user the - trouble of explicitly writing out the iterator types.

- -
-
-template <class Generator>
-typename generator_iterator_generator<Generator>::type
-make_generator_iterator(Generator & gen);
-
-
-
- -

Example

- -

The following program shows how generator_iterator - transforms a generator into an input iterator.

- -
-
-#include <iostream>
-#include <boost/generator_iterator.hpp>
-
-class my_generator
-{
-public:
-  typedef int result_type;
-  my_generator() : state(0) { }
-  int operator()() { return ++state; }
-private:
-  int state;
-};
-
-int main()
-{
-  my_generator gen;
-  boost::generator_iterator_generator<my_generator>::type it = boost::make_generator_iterator(gen);
-  for(int i = 0; i < 10; ++i, ++it)
-    std::cout << *it << std::endl;
-}
-
-
-
- -

Valid HTML 4.01 Transitional

- -

Revised - 05 December, 2006

- -

Copyright © 2001 Jens Maurer

- -

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)

- - diff --git a/index.html b/index.html index be15d40..7ab91c2 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,7 @@ enable_if (moved to the Boost.Core library)
in_place_factory
iterator_adaptors
- generator iterator adaptors
+ generator iterator adaptors (moved to the Boost.Iterator library)
next/prior (moved to the Boost.Iterator library)
noncopyable (moved to the Boost.Core library)
operators
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 22a616a..8374316 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -50,5 +50,3 @@ compile-fail value_init_test_fail2.cpp ; compile-fail value_init_test_fail3.cpp ; compile-fail initialized_test_fail1.cpp ; compile-fail initialized_test_fail2.cpp ; - -run generator_iterator_test.cpp ; diff --git a/test/generator_iterator_test.cpp b/test/generator_iterator_test.cpp deleted file mode 100644 index 1c7a110..0000000 --- a/test/generator_iterator_test.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright 2014 Peter Dimov -// -// 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 -#include - -class X -{ -private: - - int v; - -public: - - typedef int result_type; - - X(): v( 0 ) - { - } - - int operator()() - { - return ++v; - } -}; - -template OutputIterator copy_n( InputIterator first, Size n, OutputIterator result ) -{ - while( n-- > 0 ) - { - *result++ = *first++; - } - - return result; -} - -void copy_test() -{ - X x; - boost::generator_iterator in( &x ); - - int const N = 4; - int v[ N ] = { 0 }; - - ::copy_n( in, 4, v ); - - BOOST_TEST_EQ( v[0], 1 ); - BOOST_TEST_EQ( v[1], 2 ); - BOOST_TEST_EQ( v[2], 3 ); - BOOST_TEST_EQ( v[3], 4 ); -} - -int main() -{ - copy_test(); - return boost::report_errors(); -}