| Home | Libraries | People | FAQ | More

### repetitive_view

##### Description

`repetitive_view` presents a view which iterates over a given Sequence repeatedly. Because a `repetitive_view` has infinite length, it can only be used when some external condition determines the end. Thus, initializing a fixed length sequence with a `repetitive_view` is okay, but printing a `repetitive_view` to `std::cout` is not.

##### Header

    #include <boost/fusion/view/repetitive_view.hpp>
    #include <boost/fusion/include/repetitive_view.hpp>

##### Synopsis

    template <typename Sequence>
    struct repetitive_view;

##### Template parameters

Parameter | Description | Default
--- | --- | ---
`Sequence` | An arbitrary Fusion Forward Sequence |

Notation

`RV`

  A `repetitive_view` type

`s`

  An instance of `Sequences`

`rv`, `rv1`, `rv2`

  Instances of `RV`

##### Expression Semantics

Expression | Return Type | Semantics
--- | --- | ---
`RV(s)` |  | Creates an `repetitive_view` given the underlying sequence.
`RV(rv1)` |  | Copy constructs an `repetitive_view` from another `repetitive_view`, `rv1`.
`rv1 = rv2` |  | Assigns to a `repetitive_view`, `rv1`, from another `repetitive_view`, `rv2`.
``begin`(rv)` | Forward Iterator |
``end`(rv)` | Forward Iterator | Creates an unreachable iterator (since the sequnce is infinite)

##### Result Type Expressions

Expression
``result_of::begin`<RV>::type`
``result_of::end`<RV>::type`

##### Example

    typedef vector<int, char, double> vec1;
    typedef vector<int, char, double, int, char> vec2;

    vec1 v1(1, 'c', 2.0);
    vec2 v2(repetitive_view<vec1>(v1));

    std::cout << v2 << std::endl; // 1, 'c', 2.0, 1, 'c'