From f17725a186d209a26836fc3e13cdcee423ddd1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Wed, 27 Oct 2021 19:49:46 +0200 Subject: [PATCH] Split void_type into its own header and rename it to void_t --- src/CMakeLists.txt | 1 + src/catch2/catch_all.hpp | 1 + src/catch2/catch_tostring.hpp | 12 +++--------- src/catch2/internal/catch_void_type.hpp | 25 +++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 src/catch2/internal/catch_void_type.hpp 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 #include #include +#include #include #include #include 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 #include #include + #include #include #include +#include #include #ifdef CATCH_CONFIG_CPP17_STRING_VIEW @@ -474,19 +476,11 @@ namespace Catch { using std::end; namespace Detail { - template - struct void_type { - using type = void; - }; - - template - using void_type_t = typename void_type::type; - template struct is_range_impl : std::false_type {}; template - struct is_range_impl()))>> : std::true_type {}; + struct is_range_impl()))>> : std::true_type {}; } // namespace Detail template 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 + struct make_void { using type = void; }; + + template + using void_t = typename make_void::type; + + } // namespace Detail +} // namespace Catch + + +#endif // CATCH_VOID_TYPE_HPP_INCLUDED