mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Split void_type into its own header and rename it to void_t
This commit is contained in:
parent
ec2d5013fb
commit
f17725a186
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
25
src/catch2/internal/catch_void_type.hpp
Normal file
25
src/catch2/internal/catch_void_type.hpp
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user