| Home | Libraries | People | FAQ | More

#### Function join

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.

##### Synopsis

    template<typename SinglePassRange1, typename SinglePassRange2>
    joined_range<const SinglePassRange1, const SinglePassRange2>
    join(const SinglePassRange1& rng1, const SinglePassRange2& rng2)

    template<typename SinglePassRange1, typename SinglePassRange2>
    joined_range<SinglePassRange1, SinglePassRange2>
    join(SinglePassRange1& rng1, SinglePassRange2& rng2);

For the const version:

- Precondition: The `range_value<SinglePassRange2>::type` must be convertible to `range_value<SinglePassRange1>::type`. The `range_reference<const SinglePassRange2>::type` must be convertible to `range_reference<const SinglePassRange1>::type`.
- Range Category: Both `rng1` and `rng2` must be a model of Single Pass Range or better.
- Range Return Type: `joined_range<const SinglePassRange1, const SinglePassRange2>` which is a model of the lesser of the two range concepts passed.
- Returned Range Category: The minimum of the range category of `rng1` and `rng2`.

For the mutable version:

- Precondition: The `range_value<SinglePassRange2>::type` must be convertible to `range_value<SinglePassRange1>::type`. The `range_reference<SinglePassRange2>::type` must be convertible to `range_reference<SinglePassRange1>::type`.
- Range Category: Both `rng1` and `rng2` must be a model of Single Pass Range or better.
- Range Return Type: `joined_range<SinglePassRange1, SinglePassRange2>` which is a model of the lesser of the two range concepts passed.
- Returned Range Category: The minimum of the range category of `rng1` and `rng2`.

##### Example

The expression `join(irange(0,5), irange(5,10))` would evaluate to a range representing an integer range `[0,10)`