Bug 1679987 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

At the moment, using `nsTCharSeparatedTokenizer` (and its specializations) requires custom `while` loops like
```
      nsCCharSeparatedTokenizer tokenizer(headerValue, ';');
      while (tokenizer.hasMoreTokens()) {
        const nsDependentCSubstring& token = tokenizer.nextToken();

        // do something with token
      }
```
With an appropriate adapter, C++11 range-based for loops could be used instead, which would provide a simpler syntax, reduce scope of the tokenizer and increase regularity:
```
      for (const nsDependentCSubstring& token :
           nsTokenizedRange{nsCCharSeparatedTokenizer(headerValue, ';')}) {
        // do something with token
      }
```

Also, several uses of `strtok` could be transformed to use the tokenizers in a range-based way.

Back to Bug 1679987 Comment 0