#ifndef SPROUT_UTILITY_PACK_HPP #define SPROUT_UTILITY_PACK_HPP #include #include #include #include #include namespace sprout { // // tppack_at // namespace detail { template struct tppack_at_impl_1 { public: typedef typename sprout::detail::tppack_at_impl::type type; }; template struct tppack_at_impl_1<0, Head, Tail...> { public: typedef Head type; }; template< std::size_t N, typename... Args, typename std::enable_if<(N < sizeof...(Args))>::type*& = sprout::enabler > struct tppack_at_impl : public sprout::detail::tppack_at_impl_1 {}; template< std::size_t N, typename... Args, typename std::enable_if<(N >= sizeof...(Args))>::type*& = sprout::enabler > struct tppack_at_impl {}; } // namespace detail template struct tppack_at : public sprout::detail::tppack_at_impl {}; // // fppack_at // namespace detail { template< std::size_t N, typename R, typename Head, typename... Tail, typename std::enable_if::type*& = sprout::enabler > SPROUT_CONSTEXPR R fppack_at_impl(Head&& head, Tail&&... tail) { return sprout::forward(head); } template< std::size_t N, typename R, typename Head, typename... Tail, typename std::enable_if::type*& = sprout::enabler > SPROUT_CONSTEXPR R fppack_at_impl(Head&& head, Tail&&... tail) { return sprout::detail::fppack_at_impl(sprout::forward(tail)...); } } // namespace detail template SPROUT_CONSTEXPR typename sprout::tppack_at::type fppack_at(Args&&... args) { return sprout::detail::fppack_at_impl< N, typename sprout::tppack_at::type >(sprout::forward(args)...); } } // namespace sprout #endif // #ifndef SPROUT_UTILITY_PACK_HPP