MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / is_set

Function is_set

3rd/wildcards/include/wildcards/match.hpp:104–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103template <typename PatternIterator>
104constexpr bool is_set(
105 PatternIterator p, PatternIterator pend,
106 const cards<iterated_item_t<PatternIterator>>& c = cards<iterated_item_t<PatternIterator>>(),
107 is_set_state state = is_set_state::open)
108{
109#if cfg_HAS_CONSTEXPR14
110
111 if (!c.set_enabled)
112 {
113 return false;
114 }
115
116 while (p != pend)
117 {
118 switch (state)
119 {
120 case is_set_state::open:
121 if (*p != c.set_open)
122 {
123 return false;
124 }
125
126 state = is_set_state::not_or_first;
127 break;
128
129 case is_set_state::not_or_first:
130 if (*p == c.set_not)
131 {
132 state = is_set_state::first;
133 }
134 else
135 {
136 state = is_set_state::next;
137 }
138
139 break;
140
141 case is_set_state::first:
142 state = is_set_state::next;
143 break;
144
145 case is_set_state::next:
146 if (*p == c.set_close)
147 {
148 return true;
149 }
150
151 break;
152
153 default:
154#if cfg_HAS_FULL_FEATURED_CONSTEXPR14
155 throw std::logic_error(
156 "The program execution should never end up here throwing this exception");
157#else
158 return throw_logic_error(
159 "The program execution should never end up here throwing this exception");
160#endif
161 }

Callers 5

performMethod · 0.85
is_altFunction · 0.85
alt_endFunction · 0.85
alt_sub_endFunction · 0.85
matchFunction · 0.85

Calls 2

throw_logic_errorFunction · 0.85
nextFunction · 0.85

Tested by

no test coverage detected