unpack

Description

The unpack function adaptor takes a sequence and uses the elements of the sequence for the arguments to the function. Multiple sequences can be passed to the function. All elements from each sequence will be passed into the function.

Synopsis

template<class F>
unpack_adaptor<F> unpack(F f);

Requirements

F must be:

Example

#include <boost/hof.hpp>
#include <cassert>
using namespace boost::hof;

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

int main() {
    int r = unpack(sum())(std::make_tuple(3,2));
    assert(r == 5);
}

References