simple_example_3.cpp 684 B

12345678910111213141516171819202122232425
  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_3.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 = "12252001";
  14. int offsets[] = {2,2,4};
  15. offset_separator f(offsets, offsets+3);
  16. tokenizer<offset_separator> tok(s,f);
  17. for(tokenizer<offset_separator>::iterator beg=tok.begin(); beg!=tok.end();++beg){
  18. cout << *beg << "\n";
  19. }
  20. return 0;
  21. }