27. Splitting a string into tokens with a list of possible delimiters

Write a function that, given a string and a list of possible delimiter characters, splits the string into tokens separated by any of the delimiters and returns them in an std::vector.

Example: input: "this,is.a sample!!" with delimiters ",.! ", output: {"this", "is", "a", "sample"}.

Get The Modern C++ Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.