diff options
| author | Martin Hořeňovský | 2024-04-03 12:29:51 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2024-04-03 13:27:10 +0200 |
| commit | f181de9df4c43f188ae932a412af32a0981c9067 (patch) | |
| tree | 873584749ace324b7c3e433c7ff8807ee4ef0330 /src/catch2 | |
| parent | 9271083a0493fe24a56efadcef4c3d640c5dbcad (diff) | |
| download | catch3-f181de9df4c43f188ae932a412af32a0981c9067.tar.gz | |
Use SizedUnsignedType_t to pick UnsignedType for uniform_integer_distribution
The previously used `make_unsigned` approach combined with the overload
set of `extendedMult` caused compilation issues on MacOS platform. By
forcing the selection to be one of `std::uintX_t` types we don't need
to complicate the overload set further.
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/internal/catch_uniform_integer_distribution.hpp | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/catch2/internal/catch_uniform_integer_distribution.hpp b/src/catch2/internal/catch_uniform_integer_distribution.hpp index afa2015d..3332489a 100644 --- a/src/catch2/internal/catch_uniform_integer_distribution.hpp +++ b/src/catch2/internal/catch_uniform_integer_distribution.hpp @@ -13,22 +13,6 @@ namespace Catch { - namespace Detail { - // Indirection to enable make_unsigned<bool> behaviour. - template <typename T> - struct make_unsigned { - using type = std::make_unsigned_t<T>; - }; - - template <> - struct make_unsigned<bool> { - using type = uint8_t; - }; - - template <typename T> - using make_unsigned_t = typename make_unsigned<T>::type; - } - /** * Implementation of uniform distribution on integers. * @@ -44,7 +28,7 @@ template <typename IntegerType> class uniform_integer_distribution { static_assert(std::is_integral<IntegerType>::value, "..."); - using UnsignedIntegerType = Detail::make_unsigned_t<IntegerType>; + using UnsignedIntegerType = Detail::SizedUnsignedType_t<sizeof(IntegerType)>; // Only the left bound is stored, and we store it converted to its // unsigned image. This avoids having to do the conversions inside |