Imported Upstream version 1.51.0
[platform/upstream/boost.git] / libs / range / doc / reference / adaptors / examples / adjacent_filtered.cpp
1 // Boost.Range library
2 //
3 //  Copyright Thorsten Ottosen 2003-2004. Use, modification and
4 //  distribution is subject to the Boost Software License, Version
5 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 //  http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // For more information, see http://www.boost.org/libs/range/
9 //
10 #include <boost/range/adaptor/adjacent_filtered.hpp>
11 #include <boost/range/algorithm/copy.hpp>
12 #include <boost/assign.hpp>
13 #include <algorithm>
14 #include <functional>
15 #include <iostream>
16 #include <vector>
17
18 int main(int argc, const char* argv[])
19 {
20     using namespace boost::assign;
21     using namespace boost::adaptors;
22     
23     std::vector<int> input;
24     input += 1,1,2,2,2,3,4,5,6;
25     
26     boost::copy(
27         input | adjacent_filtered(std::not_equal_to<int>()),
28         std::ostream_iterator<int>(std::cout, ","));
29         
30    return 0;
31 }
32