flip

Description

The flip function adaptor swaps the first two parameters.

Synopsis

template<class F>
flip_adaptor<F> flip(F f);

Semantics

assert(flip(f)(x, y, xs...) == f(y, x, xs...));

Requirements

F must be at least:

Or:

And:

  • MoveConstructible

Example

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

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