mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Use std::void_t when available
This commit is contained in:
parent
0e4b299b45
commit
084937e192
@ -55,6 +55,7 @@
|
||||
#define CONTINUABLE_HAS_CXX17_CONSTEXPR_IF
|
||||
#define CONTINUABLE_HAS_CXX17_DISJUNCTION
|
||||
#define CONTINUABLE_HAS_CXX17_CONJUNCTION
|
||||
#define CONTINUABLE_HAS_CXX17_VOID_T
|
||||
#else
|
||||
// Generic feature detection based on __has_feature
|
||||
#if defined(__has_feature)
|
||||
@ -75,6 +76,12 @@
|
||||
(__cpp_lib_experimental_logical_traits >= 201511)
|
||||
#define CONTINUABLE_HAS_CXX17_CONJUNCTION
|
||||
#endif
|
||||
|
||||
#if !defined(CONTINUABLE_HAS_CXX17_VOID_T) && \
|
||||
defined(__cpp_lib_void_t) && \
|
||||
(__cpp_lib_void_t >= 201411)
|
||||
#define CONTINUABLE_HAS_CXX17_VOID_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// Usually this is enabled by the CMake project
|
||||
@ -85,7 +92,7 @@
|
||||
|
||||
/// Define CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE when
|
||||
/// CONTINUABLE_WITH_EXPERIMENTAL_COROUTINE is defined.
|
||||
#if !defined(CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE) && \
|
||||
#if !defined(CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE) && \
|
||||
defined(CONTINUABLE_WITH_EXPERIMENTAL_COROUTINE)
|
||||
#define CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE
|
||||
#endif
|
||||
|
||||
@ -90,6 +90,9 @@ constexpr auto get(identity<T...>) noexcept {
|
||||
return identify<at_t<I, T...>>{};
|
||||
}
|
||||
|
||||
#if defined(CONTINUABLE_HAS_CXX17_VOID_T)
|
||||
using std::void_t;
|
||||
#else
|
||||
namespace detail {
|
||||
// Equivalent to C++17's std::void_t which targets a bug in GCC,
|
||||
// that prevents correct SFINAE behavior.
|
||||
@ -101,6 +104,7 @@ struct deduce_to_void : std::common_type<void> {};
|
||||
/// C++17 like void_t type
|
||||
template <typename... T>
|
||||
using void_t = typename detail::deduce_to_void<T...>::type;
|
||||
#endif // CONTINUABLE_HAS_CXX17_VOID_T
|
||||
|
||||
namespace detail {
|
||||
template <typename Type, typename TrueCallback>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user