@@ -16,6 +16,9 @@ template <size_t Id, typename Name = void> struct captured_content {
16
16
template <typename Iterator> struct storage {
17
17
Iterator _begin{};
18
18
Iterator _end{};
19
+
20
+ using char_type = typename std::iterator_traits<Iterator>::value_type;
21
+
19
22
bool _matched{false };
20
23
21
24
using name = Name;
@@ -52,10 +55,11 @@ template <size_t Id, typename Name = void> struct captured_content {
52
55
}
53
56
54
57
constexpr CTRE_FORCE_INLINE auto to_view () const noexcept {
55
- return std::string_view{ _begin, static_cast <size_t >(std::distance (_begin, _end))} ;
58
+ return std::basic_string_view<char_type>(&* _begin, static_cast <size_t >(std::distance (_begin, _end))) ;
56
59
}
57
60
58
- constexpr operator std::string_view () const noexcept {
61
+ template <typename U = char_type>
62
+ constexpr operator std::basic_string_view<U>() const noexcept {
59
63
return to_view ();
60
64
}
61
65
@@ -135,6 +139,8 @@ template <> struct captures<> {
135
139
};
136
140
137
141
template <typename Iterator, typename ... Captures> struct regex_results {
142
+ using char_type = typename std::iterator_traits<Iterator>::value_type;
143
+
138
144
captures<captured_content<0 >::template storage<Iterator>, typename Captures::template storage<Iterator>...> _captures;
139
145
140
146
constexpr CTRE_FORCE_INLINE regex_results () noexcept { }
@@ -163,8 +169,9 @@ template <typename Iterator, typename... Captures> struct regex_results {
163
169
constexpr CTRE_FORCE_INLINE operator bool () const noexcept {
164
170
return bool (_captures.template select <0 >());
165
171
}
166
-
167
- constexpr operator std::string_view () const noexcept {
172
+
173
+ template <typename U = char_type>
174
+ constexpr operator std::basic_string_view<U>() const noexcept {
168
175
return to_view ();
169
176
}
170
177
0 commit comments