diff --git a/octa/tuple.hh b/octa/tuple.hh index 64acabd..8ca4029 100644 --- a/octa/tuple.hh +++ b/octa/tuple.hh @@ -439,6 +439,49 @@ inline Tuple tie(T &...t) { return Tuple(t...); } +/* ignore */ + +namespace detail { + struct Ignore { + template + const Ignore &operator=(T &&) const { return *this; } + }; +} + +static const detail::Ignore ignore = detail::Ignore(); + +/* make tuple */ + +namespace detail { + template + struct MakeTupleReturnType { + using Type = T; + }; + + template + struct MakeTupleReturnType> { + using Type = T &; + }; + + template + struct MakeTupleReturn { + using Type = typename MakeTupleReturnType>::Type; + }; +} + +template +inline Tuple::Type...> +make_tuple(T &&...t) { + return Tuple::Type...>(forward(t)...); +} + +/* forward as tuple */ + +template +inline Tuple forward_as_tuple(T &&...t) { + return Tuple(forward(t)...); +} + } /* namespace octa */ #endif \ No newline at end of file