@@ -343,21 +343,21 @@ namespace mamba::util
343
343
{
344
344
// TODO(C++20): After allocating tokens and depths here, call an impl function using
345
345
// std::span defined in .cpp
346
- static constexpr auto npos = std::string_view::npos;
346
+ static constexpr auto sv_npos = std::string_view::npos;
347
347
348
348
const auto tokens = detail_parsers::concat_array<char >(open, close);
349
349
const auto tokens_str = std::string_view (tokens.data (), tokens.size ());
350
350
351
351
auto depths = std::array<int , P + 1 >{}; // Plus one for branchless depths code
352
352
353
353
const auto start = searcher.find_first (text, tokens_str);
354
- if (start == npos )
354
+ if (start == sv_npos )
355
355
{
356
- return { npos, npos };
356
+ return { sv_npos, sv_npos };
357
357
}
358
358
359
359
auto pos = start;
360
- while (pos != npos )
360
+ while (pos != sv_npos )
361
361
{
362
362
// Change depth of corresponding open/close pair, writing in index P for
363
363
// the one not matching.
@@ -390,7 +390,7 @@ namespace mamba::util
390
390
}
391
391
392
392
err = ParseError::InvalidInput;
393
- return { start, npos };
393
+ return { start, sv_npos };
394
394
}
395
395
396
396
template <std::size_t P, typename Str, typename Searcher>
@@ -405,12 +405,12 @@ namespace mamba::util
405
405
{
406
406
// TODO(C++20): After allocating tokens and depths here, call an impl function using
407
407
// std::span defined in .cpp
408
- static constexpr auto npos = std::string_view::npos;
408
+ static constexpr auto sv_npos = std::string_view::npos;
409
409
410
410
if (detail_parsers::empty (val))
411
411
{
412
412
err = ParseError::InvalidInput;
413
- return npos ;
413
+ return sv_npos ;
414
414
}
415
415
416
416
const auto tokens = detail_parsers::concat_array<char >(
@@ -421,9 +421,9 @@ namespace mamba::util
421
421
const auto tokens_str = std::string_view (tokens.data (), tokens.size ());
422
422
423
423
auto depths = std::array<int , P + 1 >{}; // last for easy branchless access
424
- auto first_val_pos = npos ;
424
+ auto first_val_pos = sv_npos ;
425
425
auto pos = searcher.find_first (text, tokens_str);
426
- while (pos != npos )
426
+ while (pos != sv_npos )
427
427
{
428
428
const auto open_pos = detail_parsers::find (open, text[pos]);
429
429
const auto close_pos = detail_parsers::find (close, text[pos]);
@@ -441,7 +441,7 @@ namespace mamba::util
441
441
err = if_else (d < 0 , ParseError::InvalidInput, err);
442
442
}
443
443
const bool match = starts_with (text.substr (pos), val);
444
- first_val_pos = if_else (match && (pos == npos ), pos, first_val_pos);
444
+ first_val_pos = if_else (match && (pos == sv_npos ), pos, first_val_pos);
445
445
if (match && (depths == decltype (depths){}))
446
446
{
447
447
return pos;
@@ -454,7 +454,7 @@ namespace mamba::util
454
454
err = ParseError::InvalidInput;
455
455
return first_val_pos;
456
456
}
457
- return npos ; // not found
457
+ return sv_npos ; // not found
458
458
}
459
459
}
460
460
0 commit comments