@@ -225,13 +225,13 @@ class Bankswitch
225225
226226 // Convert string to BSType enum via binary search on sorted constexpr table
227227 static Bankswitch::Type nameToType (string_view name) {
228- const auto it = std::lower_bound (
229- ourNameToTypes. begin (), ourNameToTypes. end () , name,
230- [](const auto & entry , string_view val ) {
231- return BSPF::compareIgnoreCase (entry. first , val ) < 0 ;
232- });
233- if (it != ourNameToTypes. end () &&
234- BSPF::compareIgnoreCase (it->first , name) == 0 )
228+ const auto it = std::ranges:: lower_bound ( // NOLINT(readability-qualified-auto)
229+ ourNameToTypes, name,
230+ [](string_view a , string_view b ) {
231+ return BSPF::compareIgnoreCase (a, b ) < 0 ;
232+ },
233+ &TypeEntry::first); // projection: extract the key from each element
234+ if (it != ourNameToTypes. end () && BSPF::compareIgnoreCase (it->first , name) == 0 )
235235 return it->second ;
236236
237237 return Bankswitch::Type::AUTO;
@@ -244,11 +244,12 @@ class Bankswitch
244244 const auto idx = path.find_last_of (' .' );
245245 if (idx != string_view::npos)
246246 {
247- const auto it = std::lower_bound (
248- ourExtensions.begin (), ourExtensions.end (), path.substr (idx + 1 ),
249- [](const auto & entry, string_view val) {
250- return BSPF::compareIgnoreCase (entry.first , val) < 0 ;
251- });
247+ const auto it = std::ranges::lower_bound ( // NOLINT(readability-qualified-auto)
248+ ourExtensions, path.substr (idx + 1 ),
249+ [](string_view a, string_view b) {
250+ return BSPF::compareIgnoreCase (a, b) < 0 ;
251+ },
252+ &TypeEntry::first);
252253 if (it != ourExtensions.end () &&
253254 BSPF::compareIgnoreCase (it->first , path.substr (idx + 1 )) == 0 )
254255 return it->second ;
@@ -268,13 +269,13 @@ class Bankswitch
268269 if (idx != string_view::npos)
269270 {
270271 const auto e = name.substr (idx + 1 );
271- const auto it = std::lower_bound (
272- ourExtensions. begin (), ourExtensions. end () , e,
273- [](const auto & entry , string_view val ) {
274- return BSPF::compareIgnoreCase (entry. first , val ) < 0 ;
275- });
276- if (it != ourExtensions. end () &&
277- BSPF::compareIgnoreCase (it->first , e) == 0 )
272+ const auto it = std::ranges:: lower_bound ( // NOLINT(readability-qualified-auto)
273+ ourExtensions, e,
274+ [](string_view a , string_view b ) {
275+ return BSPF::compareIgnoreCase (a, b ) < 0 ;
276+ },
277+ &TypeEntry::first);
278+ if (it != ourExtensions. end () && BSPF::compareIgnoreCase (it->first , e) == 0 )
278279 {
279280 ext = e;
280281 return true ;
0 commit comments