unpack¶
Header¶
#include <boost/hof/unpack.hpp>
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);
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¶
- std::apply - C++17 function to unpack a tuple
- unpack_sequence