diff options
| author | Martin Hořeňovský | 2020-02-02 11:03:48 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-02-02 12:59:19 +0100 |
| commit | 66fe591477caa2f6b592e4318f5fd6020664cd29 (patch) | |
| tree | 7dc32d58423686c0b50efce06ceb82f53d1d20e0 /src/catch2 | |
| parent | ea6db670632204bace889f646ca08bfa58bddeab (diff) | |
| download | catch3-66fe591477caa2f6b592e4318f5fd6020664cd29.tar.gz | |
Replace C++11 use of ::type with the _t suffix for std traits
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/catch_approx.h | 26 | ||||
| -rw-r--r-- | src/catch2/catch_generators.hpp | 2 | ||||
| -rw-r--r-- | src/catch2/catch_generators_specific.hpp | 8 | ||||
| -rw-r--r-- | src/catch2/catch_matchers_vector.h | 6 | ||||
| -rw-r--r-- | src/catch2/catch_meta.hpp | 2 | ||||
| -rw-r--r-- | src/catch2/catch_tostring.h | 24 | ||||
| -rw-r--r-- | src/catch2/catch_xmlwriter.cpp | 12 |
7 files changed, 40 insertions, 40 deletions
diff --git a/src/catch2/catch_approx.h b/src/catch2/catch_approx.h index 8a53b0ef..e6a846b7 100644 --- a/src/catch2/catch_approx.h +++ b/src/catch2/catch_approx.h @@ -32,7 +32,7 @@ namespace Detail { Approx operator-() const; - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> Approx operator()( T const& value ) { Approx approx( static_cast<double>(value) ); approx.m_epsilon = m_epsilon; @@ -41,67 +41,67 @@ namespace Detail { return approx; } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> explicit Approx( T const& value ): Approx(static_cast<double>(value)) {} - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> friend bool operator == ( const T& lhs, Approx const& rhs ) { auto lhs_v = static_cast<double>(lhs); return rhs.equalityComparisonImpl(lhs_v); } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> friend bool operator == ( Approx const& lhs, const T& rhs ) { return operator==( rhs, lhs ); } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> friend bool operator != ( T const& lhs, Approx const& rhs ) { return !operator==( lhs, rhs ); } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> friend bool operator != ( Approx const& lhs, T const& rhs ) { return !operator==( rhs, lhs ); } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> friend bool operator <= ( T const& lhs, Approx const& rhs ) { return static_cast<double>(lhs) < rhs.m_value || lhs == rhs; } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> friend bool operator <= ( Approx const& lhs, T const& rhs ) { return lhs.m_value < static_cast<double>(rhs) || lhs == rhs; } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> friend bool operator >= ( T const& lhs, Approx const& rhs ) { return static_cast<double>(lhs) > rhs.m_value || lhs == rhs; } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> friend bool operator >= ( Approx const& lhs, T const& rhs ) { return lhs.m_value > static_cast<double>(rhs) || lhs == rhs; } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> Approx& epsilon( T const& newEpsilon ) { double epsilonAsDouble = static_cast<double>(newEpsilon); setEpsilon(epsilonAsDouble); return *this; } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> Approx& margin( T const& newMargin ) { double marginAsDouble = static_cast<double>(newMargin); setMargin(marginAsDouble); return *this; } - template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> Approx& scale( T const& newScale ) { m_scale = static_cast<double>(newScale); return *this; diff --git a/src/catch2/catch_generators.hpp b/src/catch2/catch_generators.hpp index 359db5f4..40edc9bb 100644 --- a/src/catch2/catch_generators.hpp +++ b/src/catch2/catch_generators.hpp @@ -149,7 +149,7 @@ namespace Generators { template<typename... Ts> - GeneratorWrapper<std::tuple<Ts...>> table( std::initializer_list<std::tuple<typename std::decay<Ts>::type...>> tuples ) { + GeneratorWrapper<std::tuple<Ts...>> table( std::initializer_list<std::tuple<std::decay_t<Ts>...>> tuples ) { return values<std::tuple<Ts...>>( tuples ); } diff --git a/src/catch2/catch_generators_specific.hpp b/src/catch2/catch_generators_specific.hpp index acca7d97..b4ca536c 100644 --- a/src/catch2/catch_generators_specific.hpp +++ b/src/catch2/catch_generators_specific.hpp @@ -64,8 +64,8 @@ public: // TODO: Ideally this would be also constrained against the various char types, // but I don't expect users to run into that in practice. template <typename T> -typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, -GeneratorWrapper<T>>::type +std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value, +GeneratorWrapper<T>> random(T a, T b) { return GeneratorWrapper<T>( std::make_unique<RandomIntegerGenerator<T>>(a, b) @@ -73,8 +73,8 @@ random(T a, T b) { } template <typename T> -typename std::enable_if<std::is_floating_point<T>::value, -GeneratorWrapper<T>>::type +std::enable_if_t<std::is_floating_point<T>::value, +GeneratorWrapper<T>> random(T a, T b) { return GeneratorWrapper<T>( std::make_unique<RandomFloatingGenerator<T>>(a, b) diff --git a/src/catch2/catch_matchers_vector.h b/src/catch2/catch_matchers_vector.h index 13ac907d..f41e7fcc 100644 --- a/src/catch2/catch_matchers_vector.h +++ b/src/catch2/catch_matchers_vector.h @@ -107,17 +107,17 @@ namespace Matchers { std::string describe() const override { return "is approx: " + ::Catch::Detail::stringify( m_comparator ); } - template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> ApproxMatcher& epsilon( T const& newEpsilon ) { approx.epsilon(newEpsilon); return *this; } - template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> ApproxMatcher& margin( T const& newMargin ) { approx.margin(newMargin); return *this; } - template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> ApproxMatcher& scale( T const& newScale ) { approx.scale(newScale); return *this; diff --git a/src/catch2/catch_meta.hpp b/src/catch2/catch_meta.hpp index 4eca7efc..56cfa0a9 100644 --- a/src/catch2/catch_meta.hpp +++ b/src/catch2/catch_meta.hpp @@ -38,7 +38,7 @@ namespace Catch { using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U>>>; #else template <typename Func, typename U> - using FunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U)>::type>::type>::type; + using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::result_of_t<Func(U)>>>; #endif } // namespace Catch diff --git a/src/catch2/catch_tostring.h b/src/catch2/catch_tostring.h index cba24628..57d43a6d 100644 --- a/src/catch2/catch_tostring.h +++ b/src/catch2/catch_tostring.h @@ -59,23 +59,23 @@ namespace Catch { std::string convertUnknownEnumToString( E e ); template<typename T> - typename std::enable_if< + std::enable_if_t< !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value, - std::string>::type convertUnstreamable( T const& ) { + std::string> convertUnstreamable( T const& ) { return Detail::unprintableString; } template<typename T> - typename std::enable_if< + std::enable_if_t< !std::is_enum<T>::value && std::is_base_of<std::exception, T>::value, - std::string>::type convertUnstreamable(T const& ex) { + std::string> convertUnstreamable(T const& ex) { return ex.what(); } template<typename T> - typename std::enable_if< - std::is_enum<T>::value - , std::string>::type convertUnstreamable( T const& value ) { + std::enable_if_t< + std::is_enum<T>::value, + std::string> convertUnstreamable( T const& value ) { return convertUnknownEnumToString( value ); } @@ -99,7 +99,7 @@ namespace Catch { struct StringMaker { template <typename Fake = T> static - typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type + std::enable_if_t<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string> convert(const Fake& value) { ReusableStringStream rss; // NB: call using the function-like syntax to avoid ambiguity with @@ -110,7 +110,7 @@ namespace Catch { template <typename Fake = T> static - typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type + std::enable_if_t<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string> convert( const Fake& value ) { #if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) return Detail::convertUnstreamable(value); @@ -126,12 +126,12 @@ namespace Catch { // Should be preferably called fully qualified, like ::Catch::Detail::stringify template <typename T> std::string stringify(const T& e) { - return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e); + return ::Catch::StringMaker<std::remove_cv_t<std::remove_reference_t<T>>>::convert(e); } template<typename E> std::string convertUnknownEnumToString( E e ) { - return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e)); + return ::Catch::Detail::stringify(static_cast<std::underlying_type_t<E>>(e)); } #if defined(_MANAGED) @@ -515,7 +515,7 @@ namespace Catch { } template<typename R> - struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> { + struct StringMaker<R, std::enable_if_t<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>> { static std::string convert( R const& range ) { return rangeToString( range ); } diff --git a/src/catch2/catch_xmlwriter.cpp b/src/catch2/catch_xmlwriter.cpp index 3b96035b..a39d4a1b 100644 --- a/src/catch2/catch_xmlwriter.cpp +++ b/src/catch2/catch_xmlwriter.cpp @@ -53,26 +53,26 @@ namespace { } bool shouldNewline(XmlFormatting fmt) { - return !!(static_cast<std::underlying_type<XmlFormatting>::type>(fmt & XmlFormatting::Newline)); + return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Newline)); } bool shouldIndent(XmlFormatting fmt) { - return !!(static_cast<std::underlying_type<XmlFormatting>::type>(fmt & XmlFormatting::Indent)); + return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Indent)); } } // anonymous namespace XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) { return static_cast<XmlFormatting>( - static_cast<std::underlying_type<XmlFormatting>::type>(lhs) | - static_cast<std::underlying_type<XmlFormatting>::type>(rhs) + static_cast<std::underlying_type_t<XmlFormatting>>(lhs) | + static_cast<std::underlying_type_t<XmlFormatting>>(rhs) ); } XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) { return static_cast<XmlFormatting>( - static_cast<std::underlying_type<XmlFormatting>::type>(lhs) & - static_cast<std::underlying_type<XmlFormatting>::type>(rhs) + static_cast<std::underlying_type_t<XmlFormatting>>(lhs) & + static_cast<std::underlying_type_t<XmlFormatting>>(rhs) ); } |