diff --git a/docs/headers.md b/docs/headers.md index 5f4eef1..033cd8a 100644 --- a/docs/headers.md +++ b/docs/headers.md @@ -91,16 +91,16 @@ See [SL.str.5: Use `std::byte` to refer to byte values that do not necessarily r ### Non-member functions ```cpp -template ::value>> +template ::value, bool> = true> constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept; -template ::value>> +template ::value, bool> = true> constexpr byte operator<<(byte b, IntegerType shift) noexcept; -template ::value>> +template ::value, bool> = true> constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept; -template ::value>> +template ::value, bool> = true> constexpr byte operator>>(byte b, IntegerType shift) noexcept; ``` @@ -134,7 +134,7 @@ constexpr byte operator~(byte b) noexcept; Bitwise negation of a `byte`. Flips all bits. Zeroes become ones, ones become zeroes. ```cpp -template ::value>> +template ::value, bool> = true> constexpr IntegerType to_integer(byte b) noexcept; ``` @@ -310,7 +310,7 @@ auto make_not_null(T&& t) noexcept; Creates a `gsl::not_null` object, deducing the target type from the type of the argument. ```cpp -template ::value && std::is_move_constructible::value>> +template ::value && std::is_move_constructible::value, bool> = true> void swap(not_null& a, not_null& b); ``` diff --git a/include/gsl/byte b/include/gsl/byte index 87d007e..72044bb 100644 --- a/include/gsl/byte +++ b/include/gsl/byte @@ -91,25 +91,25 @@ enum class byte_may_alias byte : unsigned char { }; -template ::value>> +template ::value, bool> = true> constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept { return b = byte(static_cast(b) << shift); } -template ::value>> +template ::value, bool> = true> constexpr byte operator<<(byte b, IntegerType shift) noexcept { return byte(static_cast(b) << shift); } -template ::value>> +template ::value, bool> = true> constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept { return b = byte(static_cast(b) >> shift); } -template ::value>> +template ::value, bool> = true> constexpr byte operator>>(byte b, IntegerType shift) noexcept { return byte(static_cast(b) >> shift); @@ -147,7 +147,7 @@ constexpr byte operator^(byte l, byte r) noexcept constexpr byte operator~(byte b) noexcept { return byte(~static_cast(b)); } -template ::value>> +template ::value, bool> = true> constexpr IntegerType to_integer(byte b) noexcept { return static_cast(b); diff --git a/include/gsl/pointers b/include/gsl/pointers index cd07939..78d191c 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -145,7 +145,7 @@ private: T ptr_; }; -template ::value && std::is_move_constructible::value>> +template ::value && std::is_move_constructible::value, bool> = true> void swap(not_null& a, not_null& b) { a.swap(b); diff --git a/tests/byte_tests.cpp b/tests/byte_tests.cpp index 0308992..b37b90a 100644 --- a/tests/byte_tests.cpp +++ b/tests/byte_tests.cpp @@ -136,36 +136,36 @@ template static constexpr bool LShiftCompilesFor = false; template static constexpr bool LShiftCompilesFor< - U, std::void_t(declval(), declval()))>> = true; -static_assert(LShiftCompilesFor, "LShiftCompilesFor"); + U, std::void_t(declval(), declval()))>> = true; +static_assert(!LShiftCompilesFor, "!LShiftCompilesFor"); template static constexpr bool RShiftCompilesFor = false; template static constexpr bool RShiftCompilesFor< - U, std::void_t> (declval(), declval()))>> = true; -static_assert(RShiftCompilesFor, "RShiftCompilesFor"); + U, std::void_t> (declval(), declval()))>> = true; +static_assert(!RShiftCompilesFor, "!RShiftCompilesFor"); template static constexpr bool LShiftAssignCompilesFor = false; template static constexpr bool LShiftAssignCompilesFor< - U, std::void_t(declval(), declval()))>> = true; -static_assert(LShiftAssignCompilesFor, "LShiftAssignCompilesFor"); + U, std::void_t(declval(), declval()))>> = true; +static_assert(!LShiftAssignCompilesFor, "!LShiftAssignCompilesFor"); template static constexpr bool RShiftAssignCompilesFor = false; template static constexpr bool RShiftAssignCompilesFor< - U, std::void_t>= (declval(), declval()))>> = true; -static_assert(RShiftAssignCompilesFor, "RShiftAssignCompilesFor"); + U, std::void_t>= (declval(), declval()))>> = true; +static_assert(!RShiftAssignCompilesFor, "!RShiftAssignCompilesFor"); template static constexpr bool ToIntegerCompilesFor = false; template -static constexpr bool ToIntegerCompilesFor< - U, std::void_t(gsl::byte{}))>> = true; -static_assert(ToIntegerCompilesFor, "ToIntegerCompilesFor"); +static constexpr bool + ToIntegerCompilesFor(gsl::byte{}))>> = true; +static_assert(!ToIntegerCompilesFor, "!ToIntegerCompilesFor"); } // namespace diff --git a/tests/pointers_tests.cpp b/tests/pointers_tests.cpp index cbb476b..a88d209 100644 --- a/tests/pointers_tests.cpp +++ b/tests/pointers_tests.cpp @@ -33,10 +33,10 @@ struct NotMovable template static constexpr bool SwapCompilesFor = false; template -static constexpr bool SwapCompilesFor< - U, std::void_t(std::declval&>(), - std::declval&>()))>> = - true; -static_assert(SwapCompilesFor, "SwapCompilesFor"); +static constexpr bool + SwapCompilesFor(std::declval&>(), + std::declval&>()))>> = + true; +static_assert(!SwapCompilesFor, "!SwapCompilesFor"); } // namespace