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_CONSTEXPR_IF
|
||||||
#define CONTINUABLE_HAS_CXX17_DISJUNCTION
|
#define CONTINUABLE_HAS_CXX17_DISJUNCTION
|
||||||
#define CONTINUABLE_HAS_CXX17_CONJUNCTION
|
#define CONTINUABLE_HAS_CXX17_CONJUNCTION
|
||||||
|
#define CONTINUABLE_HAS_CXX17_VOID_T
|
||||||
#else
|
#else
|
||||||
// Generic feature detection based on __has_feature
|
// Generic feature detection based on __has_feature
|
||||||
#if defined(__has_feature)
|
#if defined(__has_feature)
|
||||||
@ -75,6 +76,12 @@
|
|||||||
(__cpp_lib_experimental_logical_traits >= 201511)
|
(__cpp_lib_experimental_logical_traits >= 201511)
|
||||||
#define CONTINUABLE_HAS_CXX17_CONJUNCTION
|
#define CONTINUABLE_HAS_CXX17_CONJUNCTION
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|
||||||
/// Usually this is enabled by the CMake project
|
/// Usually this is enabled by the CMake project
|
||||||
|
|||||||
@ -90,6 +90,9 @@ constexpr auto get(identity<T...>) noexcept {
|
|||||||
return identify<at_t<I, T...>>{};
|
return identify<at_t<I, T...>>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONTINUABLE_HAS_CXX17_VOID_T)
|
||||||
|
using std::void_t;
|
||||||
|
#else
|
||||||
namespace detail {
|
namespace detail {
|
||||||
// Equivalent to C++17's std::void_t which targets a bug in GCC,
|
// Equivalent to C++17's std::void_t which targets a bug in GCC,
|
||||||
// that prevents correct SFINAE behavior.
|
// that prevents correct SFINAE behavior.
|
||||||
@ -101,6 +104,7 @@ struct deduce_to_void : std::common_type<void> {};
|
|||||||
/// C++17 like void_t type
|
/// C++17 like void_t type
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
using void_t = typename detail::deduce_to_void<T...>::type;
|
using void_t = typename detail::deduce_to_void<T...>::type;
|
||||||
|
#endif // CONTINUABLE_HAS_CXX17_VOID_T
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename Type, typename TrueCallback>
|
template <typename Type, typename TrueCallback>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user