#ifndef SPROUT_TUPLE_SSCRISK_CEL_UTILITY_HPP #define SPROUT_TUPLE_SSCRISK_CEL_UTILITY_HPP #include #include #include #include #include namespace sprout { namespace tuples { // // tuple_size // template struct tuple_size > : public std::integral_constant {}; // // tuple_element // namespace detail { template struct tuple_element_impl; template struct tuple_element_impl<0, sscrisk::cel::pair > { public: typedef T1 type; }; template struct tuple_element_impl<1, sscrisk::cel::pair > { public: typedef T2 type; }; } // namespace detail template struct tuple_element > : public sprout::tuples::detail::tuple_element_impl > {}; // // get // namespace detail { template struct get_impl; template struct get_impl<0, sscrisk::cel::pair > { public: T1& operator()(sscrisk::cel::pair& t) const { return t.first; } T1 const& operator()(sscrisk::cel::pair const& t) const { return t.first; } }; template struct get_impl<1, sscrisk::cel::pair > { public: public: T2& operator()(sscrisk::cel::pair& t) const { return t.second; } T2 const& operator()(sscrisk::cel::pair const& t) const { return t.second; } }; } // namespace detail template typename sprout::tuples::tuple_element >::type& get( sscrisk::cel::pair& t ) SPROUT_NOEXCEPT { static_assert(I < 2, "get: index out of range"); return sprout::tuples::detail::get_impl >()(t); } template SPROUT_CONSTEXPR typename sprout::tuples::tuple_element >::type const& get( sscrisk::cel::pair const& t ) SPROUT_NOEXCEPT { static_assert(I < 2, "get: index out of range"); return sprout::tuples::detail::get_impl >()(t); } template typename sprout::tuples::tuple_element >::type&& get( sscrisk::cel::pair&& t ) SPROUT_NOEXCEPT { return std::move(sprout::tuples::get(t)); } } // namespace tuples using sprout::tuples::get; } // namespace sprout #endif // #ifndef SPROUT_TUPLE_SSCRISK_CEL_UTILITY_HPP