]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/tokenizer/char_sep_example_2.cpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / tokenizer / char_sep_example_2.cpp
CommitLineData
7c673cae
FG
1// (c) 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//
9// <> <> <Hello> <|> <world> <|> <> <|> <> <foo> <> <bar> <yow> <baz> <|> <>
10
11// char_sep_example_2.cpp
12#include <iostream>
13#include <boost/tokenizer.hpp>
14#include <string>
15
16int main()
17{
18 std::string str = ";;Hello|world||-foo--bar;yow;baz|";
19
20 typedef boost::tokenizer<boost::char_separator<char> >
21 tokenizer;
22 boost::char_separator<char> sep("-;", "|", boost::keep_empty_tokens);
23 tokenizer tokens(str, sep);
24 for (tokenizer::iterator tok_iter = tokens.begin();
25 tok_iter != tokens.end(); ++tok_iter)
26 std::cout << "<" << *tok_iter << "> ";
27 std::cout << "\n";
28 return EXIT_SUCCESS;
29}