unpack_sequence¶
Header¶
#include <fit/unpack_sequence.hpp>
How to unpack a sequence can be defined by specializing unpack_sequence
.
By default, std::tuple
is already specialized. To implement this, one
needs to provide a static apply
function which will unpack the sequence
to the parameters of the function.
Synopsis¶
template<class Sequence, class=void>
struct unpack_sequence;
Example¶
#include <fit.hpp>
#include <cassert>
struct my_sequence
{
int x;
int y;
};
namespace fit {
template<>
struct unpack_sequence<my_sequence>
{
template<class F, class Sequence>
constexpr static auto apply(F&& f, Sequence&& s) FIT_RETURNS
(
f(s.x, s.y)
);
};
} // namespace fit
int main() {
}