@@ -47,84 +47,42 @@ constexpr auto & _input = input;
47
47
// in moment when we get C++20 support this will start to work :)
48
48
49
49
#if __cpp_nontype_template_parameter_class
50
- template <ctll::basic_fixed_string input> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto match (std::string_view sv ) noexcept {
50
+ template <ctll::basic_fixed_string input, typename ... Args > CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto match (Args && ... args ) noexcept {
51
51
constexpr auto _input = input; // workaround for GCC 9 bug 88092
52
52
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
53
53
static_assert (tmp (), " Regular Expression contains syntax error." );
54
54
using re = decltype (ctll::front (typename tmp::output_type::stack_type ()));
55
55
auto re_obj = ctre::regular_expression<re>(re ());
56
- return re_obj.match (sv );
56
+ return re_obj.match (std::forward<Args>(args)... );
57
57
}
58
58
#else
59
- template <auto & input> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto match (std::string_view sv ) noexcept {
59
+ template <auto & input, typename ... Args > CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto match (Args && ... args ) noexcept {
60
60
constexpr auto & _input = input;
61
61
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
62
62
static_assert (tmp (), " Regular Expression contains syntax error." );
63
63
using re = decltype (ctll::front (typename tmp::output_type::stack_type ()));
64
64
auto re_obj = ctre::regular_expression<re>(re ());
65
- return re_obj.match (sv );
65
+ return re_obj.match (std::forward<Args>(args)... );
66
66
}
67
67
#endif
68
68
69
-
70
- #if __cpp_nontype_template_parameter_class
71
- template <ctll::basic_fixed_string input, typename ForwardIt> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto match (ForwardIt first, ForwardIt last) noexcept {
72
- constexpr auto _input = input; // workaround for GCC 9 bug 88092
73
- using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
74
- static_assert (tmp (), " Regular Expression contains syntax error." );
75
- using re = decltype (ctll::front (typename tmp::output_type::stack_type ()));
76
- return ctre::regular_expression (re ()).match (first, last);
77
- }
78
- #else
79
- template <auto & input, typename ForwardIt> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto match (ForwardIt first, ForwardIt last) noexcept {
80
- constexpr auto & _input = input;
81
- using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
82
- static_assert (tmp (), " Regular Expression contains syntax error." );
83
- using re = decltype (ctll::front (typename tmp::output_type::stack_type ()));
84
- auto re_obj = ctre::regular_expression (re ());
85
- return re_obj.match (first,last);
86
- }
87
- #endif
88
-
89
-
90
69
#if __cpp_nontype_template_parameter_class
91
- template <ctll::basic_fixed_string input> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto search (std::string_view sv ) noexcept {
70
+ template <ctll::basic_fixed_string input, typename ... Args > CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto search (Args && ... args ) noexcept {
92
71
constexpr auto _input = input; // workaround for GCC 9 bug 88092
93
72
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
94
73
static_assert (tmp (), " Regular Expression contains syntax error." );
95
74
using re = decltype (ctll::front (typename tmp::output_type::stack_type ()));
96
75
auto re_obj = ctre::regular_expression (re ());
97
- return re_obj.search (sv );
76
+ return re_obj.search (std::forward<Args>(args)... );
98
77
}
99
78
#else
100
- template <auto & input> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto search (std::string_view sv ) noexcept {
79
+ template <auto & input, typename ... Args > CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto search (Args && ... args ) noexcept {
101
80
constexpr auto & _input = input;
102
81
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
103
82
static_assert (tmp (), " Regular Expression contains syntax error." );
104
83
using re = decltype (ctll::front (typename tmp::output_type::stack_type ()));
105
84
auto re_obj = ctre::regular_expression (re ());
106
- return re_obj.search (sv);
107
- }
108
- #endif
109
-
110
-
111
- #if __cpp_nontype_template_parameter_class
112
- template <ctll::basic_fixed_string input, typename ForwardIt> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto search (ForwardIt first, ForwardIt last) noexcept {
113
- constexpr auto _input = input; // workaround for GCC 9 bug 88092
114
- using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
115
- static_assert (tmp (), " Regular Expression contains syntax error." );
116
- using re = decltype (ctll::front (typename tmp::output_type::stack_type ()));
117
- auto re_obj = ctre::regular_expression (re ());
118
- return re_obj.search (first, last);
119
- }
120
- #else
121
- template <auto & input, typename ForwardIt> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto search (ForwardIt first, ForwardIt last) noexcept {
122
- constexpr auto & _input = input;
123
- using tmp = typename ctll::parser<ctre::pcre, input, ctre::pcre_actions>::template output<pcre_context<>>;
124
- static_assert (tmp (), " Regular Expression contains syntax error." );
125
- using re = decltype (ctll::front (typename tmp::output_type::stack_type ()));
126
- auto re_obj = ctre::regular_expression (re ());
127
- return re_obj.search (first, last);
85
+ return re_obj.search (std::forward<Args>(args)...);
128
86
}
129
87
#endif
130
88
0 commit comments