Skip to content

Commit 4dba519

Browse files
authored
Merge pull request #28 from matbech/patch-1
Add size helper to captured_content
2 parents b7d8f9d + 930ce39 commit 4dba519

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/ctre/return_type.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ template <size_t Id, typename Name = void> struct captured_content {
5353
constexpr CTRE_FORCE_INLINE operator bool() const noexcept {
5454
return _matched;
5555
}
56-
56+
57+
constexpr CTRE_FORCE_INLINE auto size() const noexcept {
58+
return static_cast<size_t>(std::distance(_begin, _end));
59+
}
60+
5761
constexpr CTRE_FORCE_INLINE auto to_view() const noexcept {
5862
return std::basic_string_view<char_type>(&*_begin, static_cast<size_t>(std::distance(_begin, _end)));
5963
}
@@ -215,4 +219,4 @@ namespace std {
215219
};
216220
}
217221

218-
#endif
222+
#endif

0 commit comments

Comments
 (0)