/*============================================================================= Copyright (c) 2012 Paul Fultz II variadic.h Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #ifndef FIT_GUARD_FUNCTION_VARIADIC_H #define FIT_GUARD_FUNCTION_VARIADIC_H /// variadic /// ======== /// /// Description /// ----------- /// /// The `variadic` function adaptor converts the arguments to the function to a /// tuple. /// /// Synopsis /// -------- /// /// template /// constexpr variadic_adaptor variadic(F f); /// /// Requirements /// ------------ /// /// F must be: /// /// FunctionObject /// MoveConstructible /// #include #include #include #include #include namespace fit { template struct variadic_adaptor : F { template constexpr variadic_adaptor(Ts && ... x) : F(fit::forward(x)...) {} template constexpr const F& base_function(Ts&&... xs) const { return always_ref(*this)(xs...); } FIT_RETURNS_CLASS(variadic_adaptor); template constexpr auto operator()(Ts && ... xs) const FIT_RETURNS ( FIT_MANGLE_CAST(const F&)(FIT_CONST_THIS->base_function(xs...))(detail::make_ref_tuple(fit::forward(xs)...)) ); }; FIT_DECLARE_STATIC_VAR(variadic, detail::make); } #endif