/*============================================================================= Copyright (c) 2012 Paul Fultz II invoke.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_INVOKE_H #define FIT_GUARD_FUNCTION_INVOKE_H /// !!DEPRECATED: Please use unpack instead. /// invoke /// ====== /// /// Description /// ----------- /// /// Calls a function object with the arguments from a tuple. /// /// Synopsis /// -------- /// /// template /// auto invoke(F f, const Sequence& seq); /// /// Requirements /// ------------ /// /// F must be: /// /// FunctionObject /// MoveConstructible /// /// Sequence must be a: /// /// TupleSequence /// /// Example /// ------- /// /// std::plus add; /// assert(invoke(add,std::make_tuple(1,1)) == 2); /// #include #include #include namespace fit { // // invoke // namespace detail { template constexpr typename gens::value>::type make_sequence_gens(const Sequence&) { return {}; } template constexpr auto invoke_impl(F&& f, T && t, seq) FIT_RETURNS ( f(FIT_AUTO_FORWARD(std::get(t))...) ); } template constexpr auto invoke(F&& f, Sequence && t) FIT_RETURNS ( detail::invoke_impl(fit::forward(f), fit::forward(t), detail::make_sequence_gens(t)) ); } #endif