I am trying to tokenize a string into character using boost
The present boost tokenizer will tokenize based on space
typedef boost::tokenizer<boost::char_separator<char> >
tokenizer;
boost::char_separator<char> sep("");
tokenizer tokens(str, sep);
I expect output to be j e f but the the actual output is jef
This
is string literal with no characters ended by null terminator. Whereas
is string literal which contains one character - space also ended by null terminator. If you want to split
str = "j e f"by space you need to write something like this:As the name
char_separatorsuggests it takes characters, your string""contains no chars. Splitting is realized by comparing separator character with input string. How do you want to do this comparison when there is no character to do it, i.e.""?