noexcept_traits: convert enable_if to concepts

A little easier to read.

Closes #8329
This commit is contained in:
Avi Kivity
2021-03-21 19:07:30 +02:00
committed by Piotr Sarna
parent 405c4e7af1
commit c1badc6317

View File

@@ -39,11 +39,12 @@
// T val2 = traits::unwrap(f.get0());
//
template<typename T, typename Enable = void>
template<typename T>
struct noexcept_movable;
template<typename T>
struct noexcept_movable<T, std::enable_if_t<std::is_nothrow_move_constructible<T>::value>> {
requires std::is_nothrow_move_constructible_v<T>
struct noexcept_movable<T> {
using type = T;
static type wrap(T&& v) {
@@ -64,7 +65,8 @@ struct noexcept_movable<T, std::enable_if_t<std::is_nothrow_move_constructible<T
};
template<typename T>
struct noexcept_movable<T, std::enable_if_t<!std::is_nothrow_move_constructible<T>::value>> {
requires (!std::is_nothrow_move_constructible_v<T>)
struct noexcept_movable<T> {
using type = std::unique_ptr<T>;
static type wrap(T&& v) {