mdbx++: fix/refine detection of C++20 concepts accessibility.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-04-21 21:50:52 +03:00
parent abc2341cb4
commit e00f827de7

View File

@ -209,14 +209,23 @@
#endif
#endif /* MDBX_CXX20_UNLIKELY */
#ifndef MDBX_CXX20_CONCEPT
#ifndef MDBX_HAVE_CXX20_CONCEPTS
#if defined(DOXYGEN) || \
(defined(__cpp_concepts) && __cpp_concepts >= 201907L && \
(!defined(__clang__) || \
(__clang_major__ >= 12 && !defined(__APPLE__) && \
!defined(__ANDROID_API__)) || \
__clang_major__ >= \
/* Hope Apple will fix concepts in AppleClang 14 */ 14))
(!defined(__clang__) || __has_include(<concepts>) || \
(defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L)))
#if __has_include(<concepts>) || \
(defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L)
#include <concepts>
#endif /* <concepts> */
#define MDBX_HAVE_CXX20_CONCEPTS 1
#else
#define MDBX_HAVE_CXX20_CONCEPTS 0
#endif
#endif /* MDBX_HAVE_CXX20_CONCEPTS */
#ifndef MDBX_CXX20_CONCEPT
#if MDBX_HAVE_CXX20_CONCEPTS
#define MDBX_CXX20_CONCEPT(CONCEPT, NAME) CONCEPT NAME
#else
#define MDBX_CXX20_CONCEPT(CONCEPT, NAME) typename NAME
@ -224,13 +233,7 @@
#endif /* MDBX_CXX20_CONCEPT */
#ifndef MDBX_ASSERT_CXX20_CONCEPT_SATISFIED
#if defined(DOXYGEN) || \
(defined(__cpp_concepts) && __cpp_concepts >= 201907L && \
(!defined(__clang__) || \
(__clang_major__ >= 12 && !defined(__APPLE__) && \
!defined(__ANDROID_API__)) || \
__clang_major__ >= \
/* Hope Apple will fix concepts in AppleClang 14 */ 14))
#if MDBX_HAVE_CXX20_CONCEPTS
#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, TYPE) \
static_assert(CONCEPT<TYPE>)
#else
@ -509,13 +512,7 @@ static MDBX_CXX20_CONSTEXPR void *memcpy(void *dest, const void *src,
size_t bytes) noexcept;
//------------------------------------------------------------------------------
#if defined(DOXYGEN) || \
(defined(__cpp_concepts) && __cpp_concepts >= 201907L && \
(!defined(__clang__) || \
(__clang_major__ >= 12 && !defined(__APPLE__) && \
!defined(__ANDROID_API__)) || \
__clang_major__ >= \
/* Hope Apple will fix concepts in AppleClang 14 */ 14))
#if MDBX_HAVE_CXX20_CONCEPTS
template <typename T>
concept MutableByteProducer = requires(T a, char array[42]) {
@ -538,7 +535,7 @@ concept SliceTranscoder = ImmutableByteProducer<T> &&
{ a.is_erroneous() } -> std::same_as<bool>;
};
#endif /* __cpp_concepts >= 201907L*/
#endif /* MDBX_HAVE_CXX20_CONCEPTS */
template <class ALLOCATOR = legacy_allocator,
typename CAPACITY_POLICY = default_capacity_policy,