diff --git a/sprout/functional/invoke.hpp b/sprout/functional/invoke.hpp index d39a2310..bbb87d76 100644 --- a/sprout/functional/invoke.hpp +++ b/sprout/functional/invoke.hpp @@ -24,7 +24,7 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::invoke_result::type invoke(F&& f, Args&&... args) SPROUT_NOEXCEPT_IF((sprout::is_nothrow_invocable::value)) { - return sprout::detail::invoke(sprout::forward(f), sprout::forward(args)...); + return sprout::detail::invoke(SPROUT_FORWARD(F, f), SPROUT_FORWARD(Args, args)...); } } // namespace sprout diff --git a/sprout/tuple.hpp b/sprout/tuple.hpp index df8fa6fa..edf4c96f 100644 --- a/sprout/tuple.hpp +++ b/sprout/tuple.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include diff --git a/sprout/tuple/make_from_tuple.hpp b/sprout/tuple/make_from_tuple.hpp new file mode 100644 index 00000000..e8994876 --- /dev/null +++ b/sprout/tuple/make_from_tuple.hpp @@ -0,0 +1,43 @@ +/*============================================================================= + Copyright (c) 2011-2017 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + 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 SPROUT_TUPLE_MAKE_FROM_TUPLE_HPP +#define SPROUT_TUPLE_MAKE_FROM_TUPLE_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + namespace tuples { + // + // make_from_tuple + // + namespace detail { + template + inline SPROUT_CONSTEXPR T + make_from_tuple_impl(Tuple&& t, sprout::index_tuple) { + return T(sprout::get(SPROUT_FORWARD(Tuple, t))...); + } + } // namespace detail + template + inline SPROUT_CONSTEXPR T + make_from_tuple(Tuple&& t) { + return sprout::tuples::detail::make_from_tuple_impl( + SPROUT_FORWARD(Tuple, t), + sprout::tuple_indexes::type>::make() + ); + } + } // namespace tuples + + using sprout::tuples::make_from_tuple; +} // namespace sprout + +#endif // #ifndef SPROUT_TUPLE_MAKE_FROM_TUPLE_HPP diff --git a/sprout/type_traits/detail/invoke.hpp b/sprout/type_traits/detail/invoke.hpp index e6b0af6d..8aef3a5b 100644 --- a/sprout/type_traits/detail/invoke.hpp +++ b/sprout/type_traits/detail/invoke.hpp @@ -20,31 +20,31 @@ namespace sprout { template inline SPROUT_CONSTEXPR decltype(std::declval()(std::declval()...)) invoke(F&& f, Args&&... args) SPROUT_NOEXCEPT_IF_EXPR(std::declval()(std::declval()...)) { - return sprout::forward(f)(sprout::forward(args)...); + return SPROUT_FORWARD(F, f)(SPROUT_FORWARD(Args, args)...); } template inline SPROUT_CONSTEXPR decltype(std::declval().*(std::declval())) invoke(T Base::* pm, Derived&& d) SPROUT_NOEXCEPT_IF_EXPR(std::declval().*(std::declval())) { - return sprout::forward(d).*(pm); + return SPROUT_FORWARD(Derived, d).*(pm); } template inline SPROUT_CONSTEXPR decltype((*std::declval()).*(std::declval())) invoke(PMD&& pmd, Pointer&& ptr) SPROUT_NOEXCEPT_IF_EXPR((*std::declval()).*(std::declval())) { - return sprout::forward(ptr).*(sprout::forward(pmd)); + return SPROUT_FORWARD(Pointer, ptr).*(SPROUT_FORWARD(PMD, pmd)); } template inline SPROUT_CONSTEXPR decltype((std::declval().*(std::declval()))(std::declval()...)) invoke(T Base::* pm, Derived&& d, Args&&... args) SPROUT_NOEXCEPT_IF_EXPR((std::declval().*(std::declval()))(std::declval()...)) { - return (sprout::forward(d).*(pm))(sprout::forward(args)...); + return (SPROUT_FORWARD(Derived, d).*(pm))(SPROUT_FORWARD(Args, args)...); } template inline SPROUT_CONSTEXPR decltype(((*std::declval()).*(std::declval()))(std::declval()...)) invoke(PMF&& pmf, Pointer&& ptr, Args&&... args) SPROUT_NOEXCEPT_IF_EXPR(((*std::declval()).*(std::declval()))(std::declval()...)) { - return (sprout::forward(ptr).*(sprout::forward(pmf)))(sprout::forward(args)...); + return (SPROUT_FORWARD(Pointer, ptr).*(SPROUT_FORWARD(PMF, pmf)))(SPROUT_FORWARD(Args, args)...); } template