@@ -66,7 +66,7 @@ class StringSwitch {
6666
6767 // Case-sensitive case matchers
6868 StringSwitch &Case (StringLiteral S, T Value) {
69- CaseImpl (Value, S );
69+ CaseImpl (S, Value );
7070 return *this ;
7171 }
7272
@@ -86,68 +86,68 @@ class StringSwitch {
8686
8787 StringSwitch &Cases (std::initializer_list<StringLiteral> CaseStrings,
8888 T Value) {
89- return CasesImpl (Value, CaseStrings );
89+ return CasesImpl (CaseStrings, Value );
9090 }
9191
9292 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, T Value) {
93- return CasesImpl (Value, {S0, S1});
93+ return CasesImpl ({S0, S1}, Value );
9494 }
9595
9696 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
9797 T Value) {
98- return CasesImpl (Value, {S0, S1, S2});
98+ return CasesImpl ({S0, S1, S2}, Value );
9999 }
100100
101101 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
102102 StringLiteral S3, T Value) {
103- return CasesImpl (Value, {S0, S1, S2, S3});
103+ return CasesImpl ({S0, S1, S2, S3}, Value );
104104 }
105105
106106 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
107107 StringLiteral S3, StringLiteral S4, T Value) {
108- return CasesImpl (Value, {S0, S1, S2, S3, S4});
108+ return CasesImpl ({S0, S1, S2, S3, S4}, Value );
109109 }
110110
111111 [[deprecated(" Pass cases in std::initializer_list instead" )]]
112112 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
113113 StringLiteral S3, StringLiteral S4, StringLiteral S5,
114114 T Value) {
115- return CasesImpl (Value, {S0, S1, S2, S3, S4, S5});
115+ return CasesImpl ({S0, S1, S2, S3, S4, S5}, Value );
116116 }
117117
118118 [[deprecated(" Pass cases in std::initializer_list instead" )]]
119119 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
120120 StringLiteral S3, StringLiteral S4, StringLiteral S5,
121121 StringLiteral S6, T Value) {
122- return CasesImpl (Value, {S0, S1, S2, S3, S4, S5, S6});
122+ return CasesImpl ({S0, S1, S2, S3, S4, S5, S6}, Value );
123123 }
124124
125125 [[deprecated(" Pass cases in std::initializer_list instead" )]]
126126 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
127127 StringLiteral S3, StringLiteral S4, StringLiteral S5,
128128 StringLiteral S6, StringLiteral S7, T Value) {
129- return CasesImpl (Value, {S0, S1, S2, S3, S4, S5, S6, S7});
129+ return CasesImpl ({S0, S1, S2, S3, S4, S5, S6, S7}, Value );
130130 }
131131
132132 [[deprecated(" Pass cases in std::initializer_list instead" )]]
133133 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
134134 StringLiteral S3, StringLiteral S4, StringLiteral S5,
135135 StringLiteral S6, StringLiteral S7, StringLiteral S8,
136136 T Value) {
137- return CasesImpl (Value, {S0, S1, S2, S3, S4, S5, S6, S7, S8});
137+ return CasesImpl ({S0, S1, S2, S3, S4, S5, S6, S7, S8}, Value );
138138 }
139139
140140 [[deprecated(" Pass cases in std::initializer_list instead" )]]
141141 StringSwitch &Cases (StringLiteral S0, StringLiteral S1, StringLiteral S2,
142142 StringLiteral S3, StringLiteral S4, StringLiteral S5,
143143 StringLiteral S6, StringLiteral S7, StringLiteral S8,
144144 StringLiteral S9, T Value) {
145- return CasesImpl (Value, {S0, S1, S2, S3, S4, S5, S6, S7, S8, S9});
145+ return CasesImpl ({S0, S1, S2, S3, S4, S5, S6, S7, S8, S9}, Value );
146146 }
147147
148148 // Case-insensitive case matchers.
149149 StringSwitch &CaseLower (StringLiteral S, T Value) {
150- CaseLowerImpl (Value, S );
150+ CaseLowerImpl (S, Value );
151151 return *this ;
152152 }
153153
@@ -167,26 +167,26 @@ class StringSwitch {
167167
168168 StringSwitch &CasesLower (std::initializer_list<StringLiteral> CaseStrings,
169169 T Value) {
170- return CasesLowerImpl (Value, CaseStrings );
170+ return CasesLowerImpl (CaseStrings, Value );
171171 }
172172
173173 StringSwitch &CasesLower (StringLiteral S0, StringLiteral S1, T Value) {
174- return CasesLowerImpl (Value, {S0, S1});
174+ return CasesLowerImpl ({S0, S1}, Value );
175175 }
176176
177177 StringSwitch &CasesLower (StringLiteral S0, StringLiteral S1, StringLiteral S2,
178178 T Value) {
179- return CasesLowerImpl (Value, {S0, S1, S2});
179+ return CasesLowerImpl ({S0, S1, S2}, Value );
180180 }
181181
182182 StringSwitch &CasesLower (StringLiteral S0, StringLiteral S1, StringLiteral S2,
183183 StringLiteral S3, T Value) {
184- return CasesLowerImpl (Value, {S0, S1, S2, S3});
184+ return CasesLowerImpl ({S0, S1, S2, S3}, Value );
185185 }
186186
187187 StringSwitch &CasesLower (StringLiteral S0, StringLiteral S1, StringLiteral S2,
188188 StringLiteral S3, StringLiteral S4, T Value) {
189- return CasesLowerImpl (Value, {S0, S1, S2, S3, S4});
189+ return CasesLowerImpl ({S0, S1, S2, S3, S4}, Value );
190190 }
191191
192192 [[nodiscard]] R Default (T Value) {
@@ -207,7 +207,7 @@ class StringSwitch {
207207
208208private:
209209 // Returns true when `Str` matches the `S` argument, and stores the result.
210- bool CaseImpl (T &Value, StringLiteral S ) {
210+ bool CaseImpl (StringLiteral S, T &Value ) {
211211 if (!Result && Str == S) {
212212 Result = std::move (Value);
213213 return true ;
@@ -217,28 +217,28 @@ class StringSwitch {
217217
218218 // Returns true when `Str` matches the `S` argument (case-insensitive), and
219219 // stores the result.
220- bool CaseLowerImpl (T &Value, StringLiteral S ) {
220+ bool CaseLowerImpl (StringLiteral S, T &Value ) {
221221 if (!Result && Str.equals_insensitive (S)) {
222222 Result = std::move (Value);
223223 return true ;
224224 }
225225 return false ;
226226 }
227227
228- StringSwitch &CasesImpl (T &Value ,
229- std::initializer_list<StringLiteral> Cases ) {
228+ StringSwitch &CasesImpl (std::initializer_list<StringLiteral> Cases ,
229+ T &Value ) {
230230 // Stop matching after the string is found.
231231 for (StringLiteral S : Cases)
232- if (CaseImpl (Value, S ))
232+ if (CaseImpl (S, Value ))
233233 break ;
234234 return *this ;
235235 }
236236
237- StringSwitch &CasesLowerImpl (T &Value ,
238- std::initializer_list<StringLiteral> Cases ) {
237+ StringSwitch &CasesLowerImpl (std::initializer_list<StringLiteral> Cases ,
238+ T &Value ) {
239239 // Stop matching after the string is found.
240240 for (StringLiteral S : Cases)
241- if (CaseLowerImpl (Value, S ))
241+ if (CaseLowerImpl (S, Value ))
242242 break ;
243243 return *this ;
244244 }
0 commit comments