Avoid including ranges header under reflective-rapidjson's generator

This works around errors which Clang 11.1.0 has when parsing this header
from GCC 11.1.0. (Yes, at this point the GCC and Clang versions which are
currently in Arch Linux testing are identical.)
This commit is contained in:
Martchus 2021-05-16 19:21:58 +02:00
parent 7cea979261
commit 63955ffcc5
1 changed files with 5 additions and 2 deletions

View File

@ -18,7 +18,10 @@
#include <system_error>
#include <vector>
#if __cplusplus >= 201709
#if __cplusplus >= 201709 && !defined(REFLECTIVE_RAPIDJSON_GENERATOR)
#ifndef CPP_UTILITIES_USE_RANGES
#define CPP_UTILITIES_USE_RANGES
#endif
#include <ranges>
#endif
@ -65,7 +68,7 @@ CPP_UTILITIES_EXPORT void truncateString(std::string &str, char terminationChar
/// \cond
namespace Detail {
#if __cplusplus >= 201709
#ifdef CPP_UTILITIES_USE_RANGES
template <class Container>
using ContainerValueType = typename std::conditional_t<std::ranges::range<Container>,
std::iterator_traits<std::remove_cvref_t<std::ranges::iterator_t<Container>>>, Container>::value_type;