flip¶
Header¶
#include <boost/hof/flip.hpp>
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:
- Invocable with more than two argurments
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);
}