| Line |   | 
|---|
| 1 | // © Copyright Jeremy Siek 2002.  | 
|---|
| 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 | // Sample output: | 
|---|
| 8 | // <This> <is> <,> <a> <test>  | 
|---|
| 9 |  | 
|---|
| 10 | // char_sep_example_3.cpp | 
|---|
| 11 | #include <iostream> | 
|---|
| 12 | #include <boost/tokenizer.hpp> | 
|---|
| 13 | #include <string> | 
|---|
| 14 |  | 
|---|
| 15 | int main() | 
|---|
| 16 | { | 
|---|
| 17 |    std::string str = "This is,  a test"; | 
|---|
| 18 |    typedef boost::tokenizer<boost::char_separator<char> > Tok; | 
|---|
| 19 |    boost::char_separator<char> sep; // default constructed | 
|---|
| 20 |    Tok tok(str, sep); | 
|---|
| 21 |    for(Tok::iterator tok_iter = tok.begin(); tok_iter != tok.end(); ++tok_iter) | 
|---|
| 22 |      std::cout << "<" << *tok_iter << "> "; | 
|---|
| 23 |    std::cout << "\n"; | 
|---|
| 24 |    return EXIT_SUCCESS; | 
|---|
| 25 | } | 
|---|
| 26 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.