c++ - std::regex_token_iterator with empty regex -
my understanding std::regex_token_iterator documentation empty iterator equal end iterator:
for (std::regex_token_iterator = ...; != regex_token_iterator{}; ++it) { ... }
but when create std::regex_token_iterator non-matching regex empty regex seems never reaches end iterator:
auto str = std::string{"any string"}; auto regex = std::regex{""}; auto = std::regex_token_iterator{str.cbegin(), str.cend(), regex, -1}; auto const end = std::regex_token_iterator{}; // following loop goes infinite while (it != end) { ++it; }
why? missing something?
i'm using xcode's clang (apple llvm 8.1)
edit: seems doesn't matter if non-matching or matching regex (even if last argument zero
Comments
Post a Comment