diff options
| author | Martin Hořeňovský | 2021-10-27 19:49:46 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-10-27 20:01:13 +0200 |
| commit | f17725a186d209a26836fc3e13cdcee423ddd1e8 (patch) | |
| tree | 064ae842d7baa9da077a32b28ff2eb627b3a21d3 | |
| parent | ec2d5013fbeddd30e65c44639287b15eb591d68e (diff) | |
| download | catch3-f17725a186d209a26836fc3e13cdcee423ddd1e8.tar.gz | |
Split void_type into its own header and rename it to void_t
| -rw-r--r-- | src/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/catch2/catch_all.hpp | 1 | ||||
| -rw-r--r-- | src/catch2/catch_tostring.hpp | 12 | ||||
| -rw-r--r-- | src/catch2/internal/catch_void_type.hpp | 25 |
4 files changed, 30 insertions, 9 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 32403f6f..7808a198 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -140,6 +140,7 @@ set(INTERNAL_HEADERS ${SOURCES_DIR}/catch_translate_exception.hpp ${SOURCES_DIR}/internal/catch_uncaught_exceptions.hpp ${SOURCES_DIR}/internal/catch_unique_ptr.hpp + ${SOURCES_DIR}/internal/catch_void_type.hpp ${SOURCES_DIR}/catch_version.hpp ${SOURCES_DIR}/catch_version_macros.hpp ${SOURCES_DIR}/internal/catch_wildcard_pattern.hpp diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp index 742d89a9..e111756a 100644 --- a/src/catch2/catch_all.hpp +++ b/src/catch2/catch_all.hpp @@ -106,6 +106,7 @@ #include <catch2/internal/catch_uncaught_exceptions.hpp> #include <catch2/internal/catch_unique_name.hpp> #include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_void_type.hpp> #include <catch2/internal/catch_wildcard_pattern.hpp> #include <catch2/internal/catch_windows_h_proxy.hpp> #include <catch2/internal/catch_xmlwriter.hpp> diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp index 2fd613d3..0bbf989c 100644 --- a/src/catch2/catch_tostring.hpp +++ b/src/catch2/catch_tostring.hpp @@ -14,9 +14,11 @@ #include <type_traits> #include <string> #include <string.h> + #include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_config_wchar.hpp> #include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_void_type.hpp> #include <catch2/interfaces/catch_interfaces_enum_values_registry.hpp> #ifdef CATCH_CONFIG_CPP17_STRING_VIEW @@ -474,19 +476,11 @@ namespace Catch { using std::end; namespace Detail { - template <typename...> - struct void_type { - using type = void; - }; - - template <typename... Ts> - using void_type_t = typename void_type<Ts...>::type; - template <typename T, typename = void> struct is_range_impl : std::false_type {}; template <typename T> - struct is_range_impl<T, void_type_t<decltype(begin(std::declval<T>()))>> : std::true_type {}; + struct is_range_impl<T, void_t<decltype(begin(std::declval<T>()))>> : std::true_type {}; } // namespace Detail template <typename T> diff --git a/src/catch2/internal/catch_void_type.hpp b/src/catch2/internal/catch_void_type.hpp new file mode 100644 index 00000000..23875c35 --- /dev/null +++ b/src/catch2/internal/catch_void_type.hpp @@ -0,0 +1,25 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_VOID_TYPE_HPP_INCLUDED +#define CATCH_VOID_TYPE_HPP_INCLUDED + + +namespace Catch { + namespace Detail { + + template <typename...> + struct make_void { using type = void; }; + + template <typename... Ts> + using void_t = typename make_void<Ts...>::type; + + } // namespace Detail +} // namespace Catch + + +#endif // CATCH_VOID_TYPE_HPP_INCLUDED |