Skip to content

Commit 95c6386

Browse files
author
Hana Dusíková
committed
properly rangyfi ctre
1 parent db3bcf5 commit 95c6386

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

include/ctre/range.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ template <typename Range, typename RE> struct multi_subject_range {
5656
last_type last{};
5757
value_type current_result{};
5858

59+
constexpr CTRE_FORCE_INLINE iterator() noexcept = default;
5960
constexpr CTRE_FORCE_INLINE iterator(first_type f, last_type l) noexcept: first{f}, last{l}, current_result{find_first()} { }
6061

6162
constexpr CTRE_FORCE_INLINE value_type find_first() noexcept {
@@ -113,8 +114,9 @@ template <typename Range, typename RE> struct multi_subject_range {
113114
}
114115
};
115116

116-
Range range;
117+
Range range{};
117118

119+
constexpr CTRE_FORCE_INLINE multi_subject_range() noexcept = default;
118120
constexpr CTRE_FORCE_INLINE multi_subject_range(Range r) noexcept: range{r} { }
119121

120122
constexpr CTRE_FORCE_INLINE auto begin() const noexcept {
@@ -136,7 +138,8 @@ namespace std::ranges {
136138

137139
template <typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::regex_range<Ts...>> = true;
138140
template <typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::regex_split_range<Ts...>> = true;
139-
template <typename Range, typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::multi_subject_range<Range, Ts...>> = enable_borrowed_range<Range>;
141+
template <typename Range, typename RE> inline constexpr bool enable_borrowed_range<::ctre::multi_subject_range<Range, RE>> = enable_borrowed_range<Range>;
142+
template <typename Range, typename RE> inline constexpr bool enable_view<::ctre::multi_subject_range<Range, RE>> = true;
140143

141144
}
142145
#endif

single-header/ctre-unicode.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4686,6 +4686,7 @@ template <typename Range, typename RE> struct multi_subject_range {
46864686
last_type last{};
46874687
value_type current_result{};
46884688

4689+
constexpr CTRE_FORCE_INLINE iterator() noexcept = default;
46894690
constexpr CTRE_FORCE_INLINE iterator(first_type f, last_type l) noexcept: first{f}, last{l}, current_result{find_first()} { }
46904691

46914692
constexpr CTRE_FORCE_INLINE value_type find_first() noexcept {
@@ -4743,8 +4744,9 @@ template <typename Range, typename RE> struct multi_subject_range {
47434744
}
47444745
};
47454746

4746-
Range range;
4747+
Range range{};
47474748

4749+
constexpr CTRE_FORCE_INLINE multi_subject_range() noexcept = default;
47484750
constexpr CTRE_FORCE_INLINE multi_subject_range(Range r) noexcept: range{r} { }
47494751

47504752
constexpr CTRE_FORCE_INLINE auto begin() const noexcept {
@@ -4765,7 +4767,8 @@ namespace std::ranges {
47654767

47664768
template <typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::regex_range<Ts...>> = true;
47674769
template <typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::regex_split_range<Ts...>> = true;
4768-
template <typename Range, typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::multi_subject_range<Range, Ts...>> = enable_borrowed_range<Range>;
4770+
template <typename Range, typename RE> inline constexpr bool enable_borrowed_range<::ctre::multi_subject_range<Range, RE>> = enable_borrowed_range<Range>;
4771+
template <typename Range, typename RE> inline constexpr bool enable_view<::ctre::multi_subject_range<Range, RE>> = true;
47694772

47704773
}
47714774
#endif

single-header/ctre.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4683,6 +4683,7 @@ template <typename Range, typename RE> struct multi_subject_range {
46834683
last_type last{};
46844684
value_type current_result{};
46854685

4686+
constexpr CTRE_FORCE_INLINE iterator() noexcept = default;
46864687
constexpr CTRE_FORCE_INLINE iterator(first_type f, last_type l) noexcept: first{f}, last{l}, current_result{find_first()} { }
46874688

46884689
constexpr CTRE_FORCE_INLINE value_type find_first() noexcept {
@@ -4740,8 +4741,9 @@ template <typename Range, typename RE> struct multi_subject_range {
47404741
}
47414742
};
47424743

4743-
Range range;
4744+
Range range{};
47444745

4746+
constexpr CTRE_FORCE_INLINE multi_subject_range() noexcept = default;
47454747
constexpr CTRE_FORCE_INLINE multi_subject_range(Range r) noexcept: range{r} { }
47464748

47474749
constexpr CTRE_FORCE_INLINE auto begin() const noexcept {
@@ -4762,7 +4764,8 @@ namespace std::ranges {
47624764

47634765
template <typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::regex_range<Ts...>> = true;
47644766
template <typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::regex_split_range<Ts...>> = true;
4765-
template <typename Range, typename... Ts> inline constexpr bool enable_borrowed_range<::ctre::multi_subject_range<Range, Ts...>> = enable_borrowed_range<Range>;
4767+
template <typename Range, typename RE> inline constexpr bool enable_borrowed_range<::ctre::multi_subject_range<Range, RE>> = enable_borrowed_range<Range>;
4768+
template <typename Range, typename RE> inline constexpr bool enable_view<::ctre::multi_subject_range<Range, RE>> = true;
47664769

47674770
}
47684771
#endif

0 commit comments

Comments
 (0)