diff options
author | Christopher Di Bella <cjdb@google.com> | 2021-06-22 19:21:46 +0000 |
---|---|---|
committer | Christopher Di Bella <cjdb@google.com> | 2021-06-23 01:23:45 +0000 |
commit | cafae0561920883f3269aa9a89aa4035b6a226e1 (patch) | |
tree | 85c1176dff6567dcec25a6675ac682885c3e9ff6 /libcxx/include/utility | |
parent | 493d6928fe1096aed3af35b0794bf79c00976b19 (diff) | |
download | llvm-cafae0561920883f3269aa9a89aa4035b6a226e1.zip llvm-cafae0561920883f3269aa9a89aa4035b6a226e1.tar.gz llvm-cafae0561920883f3269aa9a89aa4035b6a226e1.tar.bz2 |
[libcxx][NFC] prepares `<type_traits>` for moving out forward and swap
* `<type_traits>` depends on `std::forward`, so we replaced it with
`static_cast<T&&>`.
* `swap`'s return type is confusing, so it's been rearranged to improve
readabilitiy.
Diffstat (limited to 'libcxx/include/utility')
-rw-r--r-- | libcxx/include/utility | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libcxx/include/utility b/libcxx/include/utility index 1060b5c..c536a1a 100644 --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -272,19 +272,19 @@ operator>=(const _Tp& __x, const _Tp& __y) // move_if_noexcept -template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 #ifndef _LIBCPP_CXX03_LANG -typename conditional -< - !is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, - const _Tp&, - _Tp&& ->::type -#else // _LIBCPP_CXX03_LANG -const _Tp& +template <class _Tp> +using __move_if_noexcept_result_t = + typename conditional<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, + _Tp&&>::type; +#else // _LIBCPP_CXX03_LANG +template <class _Tp> +using __move_if_noexcept_result_t = const _Tp&; #endif -move_if_noexcept(_Tp& __x) _NOEXCEPT + +template <class _Tp> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +__move_if_noexcept_result_t<_Tp> move_if_noexcept(_Tp& __x) _NOEXCEPT { return _VSTD::move(__x); } |