Skip to content

Commit a722d7e

Browse files
author
Hana Dusíková
committed
plain parsing of pattern is working
1 parent a4a6dbf commit a722d7e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

include/ctre/return_type.hpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ template <size_t Id, typename Name = void> struct captured_content {
5555
return std::basic_string_view{_begin, static_cast<size_t>(std::distance(_begin, _end))};
5656
}
5757

58-
using string_view_type = decltype(std::basic_string_view{_begin, static_cast<size_t>(std::distance(_begin, _end))});
59-
60-
constexpr operator string_view_type() const noexcept {
58+
constexpr operator std::string_view() const noexcept {
6159
return to_view();
6260
}
6361

@@ -137,8 +135,6 @@ template <> struct captures<> {
137135
};
138136

139137
template <typename Iterator, typename... Captures> struct regex_results {
140-
using char_type = std::remove_reference_t<std::remove_const_t<decltype(*std::declval<Iterator>())>>;
141-
142138
captures<captured_content<0>::template storage<Iterator>, typename Captures::template storage<Iterator>...> _captures;
143139

144140
constexpr CTRE_FORCE_INLINE regex_results() noexcept { }
@@ -170,8 +166,8 @@ template <typename Iterator, typename... Captures> struct regex_results {
170166

171167
using string_view_type = decltype(_captures.template select<0>().to_view());
172168

173-
constexpr operator string_view_type() const noexcept {
174-
return _captures.template select<0>().to_view();
169+
constexpr operator std::string_view() const noexcept {
170+
return to_view();
175171
}
176172
constexpr auto to_view() const noexcept {
177173
return _captures.template select<0>().to_view();

tests/msvc.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
using namespace std::string_view_literals;
55

66
static inline constexpr auto pattern1 = ctll::basic_fixed_string{"^[\\x30-\\x39]+?$"};
7+
static inline constexpr auto pattern2 = ctll::basic_fixed_string{""};
8+
79

810
static_assert(ctre::re<pattern1>().match("123456789"sv));
11+
static_assert(ctre::re<pattern2>().match(""sv));

0 commit comments

Comments
 (0)