simple_example_4.cpp 652 B

123456789101112131415161718192021222324
  1. // (c) Copyright John R. Bandela 2001.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/tokenizer for documenation
  6. // simple_example_4.cpp
  7. #include<iostream>
  8. #include<boost/tokenizer.hpp>
  9. #include<string>
  10. int main(){
  11. using namespace std;
  12. using namespace boost;
  13. string s = "This is, a test";
  14. tokenizer<char_delimiters_separator<char> > tok(s);
  15. for(tokenizer<char_delimiters_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg){
  16. cout << *beg << "\n";
  17. }
  18. return 0;
  19. }