# apply

## Header

    #include <boost/hof/apply.hpp>

## Description

The `apply` function calls the function given to it with its arguments.

## Synopsis

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

## Semantics

    assert(apply(f)(xs...) == f(xs...));
    assert(fold(apply, f)(x, y, z) == f(x)(y)(z));

## Requirements

F must be:

- Invocable

## 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(sum_f(), 1, 2) == 3);
    }