1// (c) Copyright John R. Bandela 2001.
2
3// Distributed under the Boost Software License, Version 1.0. (See
4// accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7// See http://www.boost.org/libs/tokenizer for documenation
8
9/// simple_example_5.cpp
10#include<iostream>
11#include<boost/token_iterator.hpp>
12#include<string>
13
14#ifdef BOOST_BORLANDC
15// compiler bug fix:
16template class boost::token_iterator_generator<boost::offset_separator>::type;
17#endif
18
19int main(){
20 using namespace std;
21 using namespace boost;
22 string s = "12252001";
23 int offsets[] = {2,2,4};
24 offset_separator f(offsets, offsets+3);
25 typedef token_iterator_generator<offset_separator>::type Iter;
26 Iter beg = make_token_iterator<string>(begin: s.begin(),end: s.end(),fun: f);
27 Iter end = make_token_iterator<string>(begin: s.end(),end: s.end(),fun: f);
28 // The above statement could also have been what is below
29 // Iter end;
30 for(;beg!=end;++beg){
31 cout << *beg << "\n";
32 }
33 return 0;
34}
35

source code of boost/libs/tokenizer/test/simple_example_5.cpp