Intrinsic operations

Directions

struct direction::front
const direction::front front
struct direction::back
const direction::back back
const auto opposite

Return
The opposite of direction.

const auto make_forward

Return
The forward equivalent of a backward direction.

Ranges

const auto default_direction

Return the default direction of a range.

This is the direction that is used for operations if none is given explicitly. For many ranges, this returns range::front.

Parameters
  • range -

    The range to return the default direction of.

const auto empty

Return whether the range is empty in a direction.

Parameters
  • range -

    The range to operate on.

  • direction -

    (optional) The direction.

const auto size

Return the number of elements in a range.

Applying drop this number of times results in the range being empty.

Parameters
  • range -

    The range to operate on.

  • direction -

    (optional) The direction from which to count.

const auto first

Return the first element from a range.

Parameters
  • range -

    The range to operate on.

  • direction -

    (optional) The direction from which the first element will be taken.

const auto drop

Return the range without its first elements.

Parameters
  • range -

    The range to operate on.

  • increment -

    The number of elements.

  • direction -

    (optional) The direction from which the elements will be taken.

const auto chop

Return the first element and the range without that first element, as an object of type chopped.

This is an operation that ranges that cannot be copied will often implement.

Parameters
  • direction -

    (optional) The direction from which the first element is taken.

  • range -

    The range to operate on. This is often required to be an rvalue.

const auto chop_in_place

Return the first element of the range, and remove this element from the range itself.

Parameters
  • direction -

    (optional) The direction from which the first element is taken.

  • range -

    The range to operate on. It must be homogeneous, so that without the first element it has the same type. This is normally required to be a reference.

const auto view

Turn a range into a view.

A view is lightweight. If the range is already a view, then the range itself is returned. If an rvalue reference to a view is passed in, then the unqualified view is returned.

Parameters
  • range -

    Range that the view should be over.

  • directions -

    Directions that the view should allow traversal in. If no direction is given, then the default direction is used.

const auto forward_view

Turn a range into a view.

A view is lightweight. If the range is already a view, then the range itself is returned. Unlike for view(), the resulting type can be an rvalue reference. This means that you need to make sure that if a temporary can be passed in, the temporary is not destructed until the result of this function goes out of scope. Alternatively, use view(), which is safer.

Parameters
  • range -

    Range that the view should be over.

  • directions -

    Directions that the view should allow traversal in. If no direction is given, then the default direction is used.

const auto view_once

Turn a range into a view that can be viewed once.

If the range is a temporary, the elements of the view can be rvalue references. That is, the elements can be moved. The caller must therefore only access each element only once (or have knowledge particular to the view).

Parameters
  • range -

    Range that the view should be over.

  • directions -

    Directions that the view should allow traversal in. If no direction is given, then the default direction is used.

Table Of Contents

Previous topic

Range library

Next topic

Utility

This Page