apply_eval — Boost.HigherOrderFunctions 0.6 documentation

# apply_eval

## Header

    #include <boost/hof/apply_eval.hpp>

## Description

The `apply_eval` function work like apply, except it calls eval on each of its arguments. Each eval call is always ordered from left-to-right.

## Synopsis

    template<class F, class... Ts>
    constexpr auto apply_eval(F&& f, Ts&&... xs);

## Semantics

    assert(apply_eval(f)(xs...) == f(eval(xs)...));

## Requirements

F must be:

- ConstInvocable

Ts must be:

- EvaluatableFunctionObject

## Example

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

    struct sum_f
    {
        template<class T, class U>
        T operator()(T x, U y) const
        {
            return x+y;
        }
    };

    int main() {
        assert(boost::hof::apply_eval(sum_f(), []{ return 1; }, []{ return 2; }) == 3);
    }