mirror of git://gcc.gnu.org/git/gcc.git
Simplify _Node_insert_return to avoid including <tuple>
* include/bits/node_handle.h (_Node_insert_return::get): Avoid use of std::tie and std::get. From-SVN: r254162
This commit is contained in:
parent
5880ce184a
commit
6c6705a904
|
|
@ -1,5 +1,8 @@
|
||||||
2017-10-27 Jonathan Wakely <jwakely@redhat.com>
|
2017-10-27 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
* 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.am: Put headers in alphabetical order.
|
||||||
* include/Makefile.in: Regenerate.
|
* include/Makefile.in: Regenerate.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
# define __cpp_lib_node_extract 201606
|
# define __cpp_lib_node_extract 201606
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <tuple>
|
|
||||||
#include <bits/alloc_traits.h>
|
#include <bits/alloc_traits.h>
|
||||||
#include <bits/ptr_traits.h>
|
#include <bits/ptr_traits.h>
|
||||||
|
|
||||||
|
|
@ -286,22 +285,50 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
|
|
||||||
template<size_t _Idx>
|
template<size_t _Idx>
|
||||||
decltype(auto) get() &
|
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<size_t _Idx>
|
template<size_t _Idx>
|
||||||
decltype(auto) get() const &
|
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<size_t _Idx>
|
template<size_t _Idx>
|
||||||
decltype(auto) get() &&
|
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<size_t _Idx>
|
template<size_t _Idx>
|
||||||
decltype(auto) get() const &&
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue