From: Jonathan Wakely Date: Fri, 27 Oct 2017 17:49:36 +0000 (+0100) Subject: Simplify _Node_insert_return to avoid including X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c6705a90426f383208a482263812cfe2894fa74;p=gcc.git Simplify _Node_insert_return to avoid including * include/bits/node_handle.h (_Node_insert_return::get): Avoid use of std::tie and std::get. From-SVN: r254162 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 36689900be1..796e32c1ba3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2017-10-27 Jonathan Wakely + * include/bits/node_handle.h (_Node_insert_return::get): Avoid + use of std::tie and std::get. + * include/Makefile.am: Put headers in alphabetical order. * include/Makefile.in: Regenerate. diff --git a/libstdc++-v3/include/bits/node_handle.h b/libstdc++-v3/include/bits/node_handle.h index c7694a1e0ef..f93bfd7f686 100644 --- a/libstdc++-v3/include/bits/node_handle.h +++ b/libstdc++-v3/include/bits/node_handle.h @@ -37,7 +37,6 @@ # define __cpp_lib_node_extract 201606 #include -#include #include #include @@ -286,22 +285,50 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template decltype(auto) get() & - { return std::get<_Idx>(std::tie(inserted, position, node)); } + { + static_assert(_Idx < 3); + if constexpr (_Idx == 0) + return inserted; + else if constexpr (_Idx == 1) + return position; + else if constexpr (_Idx == 2) + return node; + } template decltype(auto) get() const & - { return std::get<_Idx>(std::tie(inserted, position, node)); } + { + static_assert(_Idx < 3); + if constexpr (_Idx == 0) + return inserted; + else if constexpr (_Idx == 1) + return position; + else if constexpr (_Idx == 2) + return node; + } template decltype(auto) get() && { - return std::move(std::get<_Idx>(std::tie(inserted, position, node))); + static_assert(_Idx < 3); + if constexpr (_Idx == 0) + return std::move(inserted); + else if constexpr (_Idx == 1) + return std::move(position); + else if constexpr (_Idx == 2) + return std::move(node); } template decltype(auto) get() const && { - return std::move(std::get<_Idx>(std::tie(inserted, position, node))); + static_assert(_Idx < 3); + if constexpr (_Idx == 0) + return std::move(inserted); + else if constexpr (_Idx == 1) + return std::move(position); + else if constexpr (_Idx == 2) + return std::move(node); } };