diff --git a/sprout/tuple/tuple.hpp b/sprout/tuple/tuple.hpp index 6d643c7b..d1dcf5e4 100644 --- a/sprout/tuple/tuple.hpp +++ b/sprout/tuple/tuple.hpp @@ -195,8 +195,45 @@ namespace sprout { return *this; } }; + + template + struct and_impl + : public std::false_type + {}; + template + struct and_impl + : public std::integral_constant::value> + {}; + + template + struct and_ + : public sprout::tuples::detail::and_impl + {}; } // namespace detail + template + class tuple; + + // + // is_tuple + // + template + struct is_tuple + : public std::false_type + {}; + template + struct is_tuple + : public sprout::tuples::is_tuple + {}; + template + struct is_tuple + : public sprout::tuples::is_tuple + {}; + template + struct is_tuple > + : public std::true_type + {}; + // // tuple // @@ -214,9 +251,22 @@ namespace sprout { SPROUT_CONSTEXPR explicit tuple(Types const&... elements) : inherited_type(elements...) {} - template - SPROUT_CONSTEXPR explicit tuple(UTypes&&... elements) - : inherited_type(sprout::forward(elements)...) + template< + typename U, + typename = typename std::enable_if< + !sprout::tuples::is_tuple::type>::value + >::type + > + SPROUT_CONSTEXPR explicit tuple(U&& elem) + : inherited_type(sprout::forward(elem)) + {} + template< + typename U1, + typename U2, + typename... UTypes + > + SPROUT_CONSTEXPR explicit tuple(U1&& elem1, U2&& elem2, UTypes&&... elements) + : inherited_type(sprout::forward(elem1), sprout::forward(elem2), sprout::forward(elements)...) {} SPROUT_CONSTEXPR tuple(tuple const&) = default; SPROUT_CONSTEXPR tuple(tuple&&) = default;