File tree Expand file tree Collapse file tree 3 files changed +24
-15
lines changed
Expand file tree Collapse file tree 3 files changed +24
-15
lines changed Original file line number Diff line number Diff line change 88#include < string_view>
99#include < string>
1010#include < iterator>
11+ #include < memory>
1112#include < iosfwd>
1213#if __has_include(<charconv>)
1314#include < charconv>
@@ -70,17 +71,19 @@ template <size_t Id, typename Name = void> struct captured_content {
7071 return _matched;
7172 }
7273
73- template <typename It = Iterator> constexpr CTRE_FORCE_INLINE const auto * data_unsafe () const noexcept {
74+ template <typename It = Iterator> constexpr CTRE_FORCE_INLINE const auto * data_unsafe () const noexcept {
7475 static_assert (!is_reverse_iterator<It>, " Iterator in your capture must not be reverse!" );
7576
7677 #if __cpp_char8_t >= 201811
7778 if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
7879 return _begin.ptr ;
79- } else {
80- return &*_begin;
80+ } else { // I'm doing this to avoid warning about dead code
81+ #endif
82+
83+ return std::to_address (_begin);
84+
85+ #if __cpp_char8_t >= 201811
8186 }
82- #else
83- return &*_begin;
8487 #endif
8588 }
8689
Original file line number Diff line number Diff line change @@ -3296,6 +3296,7 @@ struct utf8_range {
32963296#include <string_view>
32973297#include <string>
32983298#include <iterator>
3299+ #include <memory>
32993300#include <iosfwd>
33003301#if __has_include(<charconv>)
33013302#include <charconv>
@@ -3358,17 +3359,19 @@ template <size_t Id, typename Name = void> struct captured_content {
33583359 return _matched;
33593360 }
33603361
3361- template <typename It = Iterator> constexpr CTRE_FORCE_INLINE const auto * data_unsafe() const noexcept {
3362+ template <typename It = Iterator> constexpr CTRE_FORCE_INLINE const auto * data_unsafe() const noexcept {
33623363 static_assert(!is_reverse_iterator<It>, "Iterator in your capture must not be reverse!");
33633364
33643365 #if __cpp_char8_t >= 201811
33653366 if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
33663367 return _begin.ptr;
3367- } else {
3368- return &*_begin;
3368+ } else { // I'm doing this to avoid warning about dead code
3369+ #endif
3370+
3371+ return std::to_address(_begin);
3372+
3373+ #if __cpp_char8_t >= 201811
33693374 }
3370- #else
3371- return &*_begin;
33723375 #endif
33733376 }
33743377
Original file line number Diff line number Diff line change @@ -3293,6 +3293,7 @@ struct utf8_range {
32933293#include < string_view>
32943294#include < string>
32953295#include < iterator>
3296+ #include < memory>
32963297#include < iosfwd>
32973298#if __has_include(<charconv>)
32983299#include < charconv>
@@ -3355,17 +3356,19 @@ template <size_t Id, typename Name = void> struct captured_content {
33553356 return _matched;
33563357 }
33573358
3358- template <typename It = Iterator> constexpr CTRE_FORCE_INLINE const auto * data_unsafe () const noexcept {
3359+ template <typename It = Iterator> constexpr CTRE_FORCE_INLINE const auto * data_unsafe () const noexcept {
33593360 static_assert (!is_reverse_iterator<It>, " Iterator in your capture must not be reverse!" );
33603361
33613362 #if __cpp_char8_t >= 201811
33623363 if constexpr (std::is_same_v<Iterator, utf8_iterator>) {
33633364 return _begin.ptr ;
3364- } else {
3365- return &*_begin;
3365+ } else { // I'm doing this to avoid warning about dead code
3366+ #endif
3367+
3368+ return std::to_address (_begin);
3369+
3370+ #if __cpp_char8_t >= 201811
33663371 }
3367- #else
3368- return &*_begin;
33693372 #endif
33703373 }
33713374
You can’t perform that action at this time.
0 commit comments