@@ -125,6 +125,9 @@ template <size_t Id, typename Name = void> struct captured_content {
125125 return to_string ();
126126 }
127127
128+ constexpr CTRE_FORCE_INLINE const auto * data () const noexcept {
129+ return &*(begin ());
130+ }
128131
129132 constexpr CTRE_FORCE_INLINE const auto & select_by_id (id_tag<Id>) const noexcept {
130133 return *this ;
@@ -168,6 +171,19 @@ template <size_t Id, typename Name = void> struct captured_content {
168171 }
169172 }
170173 #endif
174+
175+ constexpr friend CTRE_FORCE_INLINE bool operator ==(const storage & lhs, std::basic_string_view<char_type> rhs) noexcept {
176+ return lhs.view () == rhs;
177+ }
178+ constexpr friend CTRE_FORCE_INLINE bool operator !=(const storage & lhs, std::basic_string_view<char_type> rhs) noexcept {
179+ return lhs.view () != rhs;
180+ }
181+ constexpr friend CTRE_FORCE_INLINE bool operator ==(std::basic_string_view<char_type> lhs, const storage & rhs) noexcept {
182+ return lhs == rhs.view ();
183+ }
184+ constexpr friend CTRE_FORCE_INLINE bool operator !=(std::basic_string_view<char_type> lhs, const storage & rhs) noexcept {
185+ return lhs != rhs.view ();
186+ }
171187 };
172188};
173189
@@ -289,7 +305,7 @@ template <typename Iterator, typename... Captures> class regex_results {
289305 return _captures.template get <Name>();
290306 }
291307
292- static constexpr size_t size () noexcept {
308+ static constexpr CTRE_FORCE_INLINE size_t count () noexcept {
293309 return sizeof ...(Captures) + 1 ;
294310 }
295311
@@ -327,6 +343,14 @@ template <typename Iterator, typename... Captures> class regex_results {
327343 return _captures.template get <0 >().view ();
328344 }
329345
346+ constexpr CTRE_FORCE_INLINE const auto * data () const noexcept {
347+ return _captures.template get <0 >().data ();
348+ }
349+
350+ constexpr CTRE_FORCE_INLINE size_t size () const noexcept {
351+ return _captures.template get <0 >().view ().size ();
352+ }
353+
330354 constexpr CTRE_FORCE_INLINE auto str () const noexcept {
331355 return _captures.template get <0 >().to_string ();
332356 }
@@ -350,6 +374,18 @@ template <typename Iterator, typename... Captures> class regex_results {
350374 _captures.template get <Id>().set_end (pos).matched ();
351375 return *this ;
352376 }
377+ constexpr friend CTRE_FORCE_INLINE bool operator ==(const regex_results & lhs, std::basic_string_view<char_type> rhs) noexcept {
378+ return lhs.view () == rhs;
379+ }
380+ constexpr friend CTRE_FORCE_INLINE bool operator !=(const regex_results & lhs, std::basic_string_view<char_type> rhs) noexcept {
381+ return lhs.view () != rhs;
382+ }
383+ constexpr friend CTRE_FORCE_INLINE bool operator ==(std::basic_string_view<char_type> lhs, const regex_results & rhs) noexcept {
384+ return lhs == rhs.view ();
385+ }
386+ constexpr friend CTRE_FORCE_INLINE bool operator !=(std::basic_string_view<char_type> lhs, const regex_results & rhs) noexcept {
387+ return lhs != rhs.view ();
388+ }
353389};
354390
355391template <typename Iterator, typename ... Captures> regex_results (Iterator, ctll::list<Captures...>) -> regex_results<Iterator, Captures...>;
@@ -365,7 +401,7 @@ template <typename Iterator, typename... Captures> regex_results(Iterator, ctll:
365401#endif
366402
367403namespace std {
368- template <typename ... Captures> struct tuple_size <ctre::regex_results<Captures...>> : public std::integral_constant<size_t , ctre::regex_results<Captures...>::size ()> { };
404+ template <typename ... Captures> struct tuple_size <ctre::regex_results<Captures...>> : public std::integral_constant<size_t , ctre::regex_results<Captures...>::count ()> { };
369405
370406 template <size_t N, typename ... Captures> struct tuple_element <N, ctre::regex_results<Captures...>> {
371407 public:
0 commit comments