/*============================================================================= Copyright (c) 2011-2019 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_UTILITY_PACK_HPP #define SPROUT_UTILITY_PACK_HPP #include #include #include #include #include #include #include #include namespace sprout { // // pack_element // template struct pack_element : public std::tuple_element > {}; // // pack_element_c // template struct pack_element_c : public sprout::pack_element...> {}; // // pack_get // namespace detail { template struct pack_get_helper; template struct pack_get_helper > { template static SPROUT_CONSTEXPR Head&& eval(Args&&..., Head&& head, Tail&&...) { return SPROUT_FORWARD(Head, head); } }; } // namespace detail template inline SPROUT_CONSTEXPR typename sprout::pack_element::type pack_get(Args&&... args) { return sprout::detail::pack_get_helper< typename sprout::types::detail::tuple_take >::type >::eval(SPROUT_FORWARD(Args, args)...); } // // head_element // template struct head_element; template struct head_element : public sprout::identity {}; template<> struct head_element<> : public sprout::detail::nil_base {}; // // head_get // template inline SPROUT_CONSTEXPR Head&& head_get(Head&& head, Tail&&...) { return SPROUT_FORWARD(Head, head); } } // namespace sprout #endif // #ifndef SPROUT_UTILITY_PACK_HPP