diff --git a/sprout/tuple/tuple/tuple_decl.hpp b/sprout/tuple/tuple/tuple_decl.hpp index 6204e922..b46df3c6 100644 --- a/sprout/tuple/tuple/tuple_decl.hpp +++ b/sprout/tuple/tuple/tuple_decl.hpp @@ -110,7 +110,7 @@ namespace sprout { template friend class sprout::tuples::detail::tuple_impl; protected: - void swap(tuple_impl&) SPROUT_NOEXCEPT {} + SPROUT_CXX14_CONSTEXPR void swap(tuple_impl&) SPROUT_NOEXCEPT {} public: tuple_impl() = default; template @@ -121,14 +121,18 @@ namespace sprout { SPROUT_CONSTEXPR tuple_impl(tuple_impl const&) SPROUT_NOEXCEPT {} template SPROUT_CONSTEXPR tuple_impl(tuple_impl&&) SPROUT_NOEXCEPT {} - tuple_impl& operator=(tuple_impl const&) = default; - tuple_impl& operator=(tuple_impl&& t) = default; - template - tuple_impl& operator=(sprout::tuples::detail::tuple_impl const&) SPROUT_NOEXCEPT { + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(tuple_impl const&) SPROUT_NOEXCEPT { + return *this; + } + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(tuple_impl&& t) SPROUT_NOEXCEPT { return *this; } template - tuple_impl& operator=(sprout::tuples::detail::tuple_impl&&) SPROUT_NOEXCEPT { + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(sprout::tuples::detail::tuple_impl const&) SPROUT_NOEXCEPT { + return *this; + } + template + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(sprout::tuples::detail::tuple_impl&&) SPROUT_NOEXCEPT { return *this; } }; @@ -159,7 +163,7 @@ namespace sprout { return t; } public: - void swap(tuple_impl& t) + SPROUT_CXX14_CONSTEXPR void swap(tuple_impl& t) SPROUT_NOEXCEPT_EXPR( SPROUT_NOEXCEPT_EXPR(sprout::swap(head(std::declval()), head(t))) && SPROUT_NOEXCEPT_EXPR(std::declval().swap(tail(t))) @@ -182,9 +186,9 @@ namespace sprout { : inherited_type(sprout::forward(tail)...) , base_type(sprout::forward(h)) {} - SPROUT_CONSTEXPR tuple_impl(tuple_impl const&) = default; + tuple_impl(tuple_impl const&) = default; #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ <= 1)) - SPROUT_CONSTEXPR tuple_impl(tuple_impl&&) = default; + tuple_impl(tuple_impl&&) = default; #else SPROUT_CONSTEXPR tuple_impl(tuple_impl&& t) SPROUT_NOEXCEPT_EXPR(std::is_nothrow_move_constructible::value && std::is_nothrow_move_constructible::value) @@ -210,12 +214,12 @@ namespace sprout { : inherited_type() , base_type() {} - tuple_impl& operator=(tuple_impl const& t) { + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(tuple_impl const& t) { head(*this) = head(t); tail(*this) = tail(t); return *this; } - tuple_impl& operator=(tuple_impl&& t) + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(tuple_impl&& t) SPROUT_NOEXCEPT_EXPR(std::is_nothrow_move_assignable::value && std::is_nothrow_move_assignable::value) { head(*this) = sprout::forward(head(t)); @@ -223,22 +227,22 @@ namespace sprout { return *this; } template - tuple_impl& operator=(sprout::tuples::detail::tuple_impl const& t) { + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(sprout::tuples::detail::tuple_impl const& t) { head(*this) = sprout::tuples::detail::tuple_impl::head(t); tail(*this) = sprout::tuples::detail::tuple_impl::tail(t); return *this; } template - tuple_impl& operator=(sprout::tuples::detail::tuple_impl&& t) { + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(sprout::tuples::detail::tuple_impl&& t) { head(*this) = sprout::forward(sprout::tuples::detail::tuple_impl::head(t)); tail(*this) = sprout::move(sprout::tuples::detail::tuple_impl::tail(t)); return *this; } - tuple_impl& operator=(sprout::tuples::detail::tuple_impl const&) { + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(sprout::tuples::detail::tuple_impl const&) { *this = sprout::move(tuple_impl()); return *this; } - tuple_impl& operator=(sprout::tuples::detail::tuple_impl&&) { + SPROUT_CXX14_CONSTEXPR tuple_impl& operator=(sprout::tuples::detail::tuple_impl&&) { *this = sprout::move(tuple_impl()); return *this; } @@ -315,8 +319,8 @@ namespace sprout { explicit SPROUT_CONSTEXPR tuple(UTypes&&... elements) : impl_type(sprout::forward(elements)...) {} - SPROUT_CONSTEXPR tuple(tuple const&) = default; - SPROUT_CONSTEXPR tuple(tuple&&) = default; + tuple(tuple const&) = default; + tuple(tuple&&) = default; template< typename... UTypes, typename = typename std::enable_if< @@ -392,11 +396,11 @@ namespace sprout { > SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair&& t); // tuple assignment - tuple& operator=(tuple const& rhs) { + SPROUT_CXX14_CONSTEXPR tuple& operator=(tuple const& rhs) { static_cast(*this) = rhs; return *this; } - tuple& operator=(tuple&& rhs) + SPROUT_CXX14_CONSTEXPR tuple& operator=(tuple&& rhs) SPROUT_NOEXCEPT_EXPR(sprout::tpp::all_of...>::value) { static_cast(*this) = sprout::move(rhs); @@ -408,7 +412,7 @@ namespace sprout { sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of...>::value >::type > - tuple& operator=(sprout::tuples::tuple const& rhs) { + SPROUT_CXX14_CONSTEXPR tuple& operator=(sprout::tuples::tuple const& rhs) { static_cast(*this) = rhs; return *this; } @@ -418,12 +422,12 @@ namespace sprout { sizeof...(Types) == sizeof...(UTypes) && sprout::tpp::all_of...>::value >::type > - tuple& operator=(sprout::tuples::tuple&& rhs) { + SPROUT_CXX14_CONSTEXPR tuple& operator=(sprout::tuples::tuple&& rhs) { static_cast(*this) = sprout::move(rhs); return *this; } // tuple swap - void swap(tuple& other) + SPROUT_CXX14_CONSTEXPR void swap(tuple& other) SPROUT_NOEXCEPT_EXPR(sprout::tpp::all_of_c(), std::declval()), false)...>::value) { impl_type::swap(other); @@ -433,9 +437,9 @@ namespace sprout { class tuple<> { public: // tuple construction - SPROUT_CONSTEXPR tuple() = default; - SPROUT_CONSTEXPR tuple(tuple const&) = default; - SPROUT_CONSTEXPR tuple(tuple&&) = default; + tuple() = default; + tuple(tuple const&) = default; + tuple(tuple&&) = default; template explicit SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, UTypes&&...) {} template @@ -447,14 +451,14 @@ namespace sprout { template SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair&&) {} // tuple swap - void swap(tuple&) SPROUT_NOEXCEPT {} + SPROUT_CXX14_CONSTEXPR void swap(tuple&) SPROUT_NOEXCEPT {} }; // // swap // template - inline void + inline SPROUT_CXX14_CONSTEXPR void swap(sprout::tuples::tuple& lhs, sprout::tuples::tuple& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {