@@ -388,7 +388,7 @@ CTLL_EXPORT template <size_t N> struct fixed_string {
388388 real_size++;
389389 }
390390 #endif
391- #if __cpp_char8_t
391+ #if defined( __cpp_char8_t) && __cpp_char8_t >= 201811
392392 } else if constexpr (std::is_same_v<T, char8_t>) {
393393 size_t out{0};
394394 for (size_t i{0}; i < N; ++i) {
@@ -418,7 +418,7 @@ CTLL_EXPORT template <size_t N> struct fixed_string {
418418 return;
419419 }
420420 }
421- #endif
421+ #endif
422422 } else if constexpr (std::is_same_v<T, char16_t>) {
423423 size_t out{0};
424424 for (size_t i{0}; i < N; ++i) {
@@ -3088,14 +3088,14 @@ constexpr bool starts_with_anchor(const flags & f, ctll::list<capture_with_name<
30883088#ifndef CTRE__UTF8__HPP
30893089#define CTRE__UTF8__HPP
30903090
3091- #if __cpp_char8_t >= 201811
3091+ #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811
30923092
30933093#ifndef CTRE_IN_A_MODULE
30943094#include <string_view>
30953095#include <iterator>
30963096#endif
30973097
3098- #if __cpp_lib_char8_t >= 201811L
3098+ #if defined(__cpp_char8_t) && __cpp_lib_char8_t >= 201811L
30993099#define CTRE_ENABLE_UTF8_RANGE
31003100#endif
31013101
@@ -3129,7 +3129,7 @@ struct utf8_iterator {
31293129 friend constexpr auto operator==(self_type, const char8_t * other_ptr) noexcept {
31303130 return *other_ptr == char8_t{0};
31313131 }
3132- #if __cpp_impl_three_way_comparison < 201907L
3132+ #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison < 201907L
31333133 friend constexpr auto operator!=(self_type, const char8_t * other_ptr) noexcept {
31343134 return *other_ptr != char8_t{0};
31353135 }
@@ -3146,7 +3146,7 @@ struct utf8_iterator {
31463146
31473147 const char8_t * ptr{nullptr};
31483148 const char8_t * end{nullptr};
3149- #if __cpp_impl_three_way_comparison < 201907L
3149+ #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison < 201907L
31503150 constexpr friend bool operator!=(const utf8_iterator & lhs, sentinel) {
31513151 return lhs.ptr < lhs.end;
31523152 }
@@ -3171,7 +3171,7 @@ struct utf8_iterator {
31713171 return lhs.ptr == rhs.ptr;
31723172 }
31733173
3174- #if __cpp_impl_three_way_comparison < 201907L
3174+ #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison < 201907L
31753175 constexpr friend bool operator!=(sentinel, const utf8_iterator & rhs) {
31763176 return rhs.ptr < rhs.end;
31773177 }
@@ -3350,7 +3350,7 @@ struct utf8_range {
33503350#if __has_include(<charconv>)
33513351#include <charconv>
33523352#endif
3353- #if __cpp_concepts >= 202002L
3353+ #if defined(__cpp_concepts) && __cpp_concepts >= 202002L
33543354#include <concepts>
33553355#endif
33563356#endif
@@ -3415,21 +3415,21 @@ template <size_t Id, typename Name = void> struct captured_content {
34153415 template <typename It = Iterator> constexpr CTRE_FORCE_INLINE const auto * data_unsafe() const noexcept {
34163416 static_assert(!is_reverse_iterator<It>, "Iterator in your capture must not be reverse!");
34173417
3418- #if __cpp_char8_t >= 201811
3418+ #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811
34193419 if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
34203420 return _begin.ptr;
34213421 } else { // I'm doing this to avoid warning about dead code
3422- #endif
3422+ #endif
34233423
3424- #ifdef _MSC_VER
3424+ #ifdef _MSC_VER
34253425 return std::to_address(_begin); // I'm enabling this only for MSVC for now, as some clang old versions with various libraries (random combinations) has different problems
3426- #else
3426+ #else
34273427 return &*_begin;
3428- #endif
3428+ #endif
34293429
3430- #if __cpp_char8_t >= 201811
3430+ #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811
34313431 }
3432- #endif
3432+ #endif
34333433 }
34343434
34353435 template <typename It = Iterator> constexpr CTRE_FORCE_INLINE const auto * data() const noexcept {
@@ -3445,15 +3445,15 @@ template <size_t Id, typename Name = void> struct captured_content {
34453445 }
34463446
34473447 constexpr CTRE_FORCE_INLINE size_t unit_size() const noexcept {
3448- #if __cpp_char8_t >= 201811
3448+ #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811
34493449 if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
34503450 return static_cast<size_t>(std::distance(_begin.ptr, _end.ptr));
34513451 } else {
34523452 return static_cast<size_t>(std::distance(begin(), end()));
34533453 }
3454- #else
3454+ #else
34553455 return static_cast<size_t>(std::distance(begin(), end()));
3456- #endif
3456+ #endif
34573457 }
34583458
34593459#if __has_include(<charconv>)
@@ -3494,15 +3494,15 @@ template <size_t Id, typename Name = void> struct captured_content {
34943494 }
34953495
34963496 constexpr CTRE_FORCE_INLINE std::basic_string<char_type> to_string() const noexcept {
3497- #if __cpp_char8_t >= 201811
3497+ #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811
34983498 if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
34993499 return std::basic_string<char_type>(data_unsafe(), static_cast<size_t>(unit_size()));
35003500 } else {
35013501 return std::basic_string<char_type>(begin(), end());
35023502 }
3503- #else
3503+ #else
35043504 return std::basic_string<char_type>(begin(), end());
3505- #endif
3505+ #endif
35063506 }
35073507
35083508 constexpr CTRE_FORCE_INLINE auto str() const noexcept {
@@ -3554,7 +3554,7 @@ template <size_t Id, typename Name = void> struct captured_content {
35543554 };
35553555};
35563556
3557- #if __cpp_concepts >= 202002L
3557+ #if defined(__cpp_concepts) && __cpp_concepts >= 202002L
35583558template <typename T> concept capture_group = requires(const T & cap) {
35593559 { T::get_id() } -> std::same_as<size_t>;
35603560 { cap.view() };
@@ -3870,7 +3870,7 @@ template <typename Iterator, typename... Captures> struct is_regex_results_t<reg
38703870
38713871template <typename T> constexpr bool is_regex_results_v = is_regex_results_t<T>();
38723872
3873- #if __cpp_concepts >= 201907L
3873+ #if defined(__cpp_concepts) && __cpp_concepts >= 201907L
38743874template <typename T> concept capture_groups = is_regex_results_v<T>;
38753875#endif
38763876
0 commit comments