rotate — Boost.HigherOrderFunctions 0.6 documentation

# rotate

## Header

    #include <boost/hof/rotate.hpp>

## Description

The `rotate` function adaptor moves the first parameter to the last parameter.

## Synopsis

    template<class F>
    rotate_adaptor<F> rotate(F f);

## Semantics

    assert(rotate(f)(x, xs...) == f(xs..., x));

## Requirements

F must be:

- ConstInvocable

- MoveConstructible

## Example

    #include <boost/hof.hpp>
    #include <cassert>

    int main() {
        int r = boost::hof::rotate(boost::hof::_ - boost::hof::_)(2, 5);
        assert(r == 3);
    }