]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // istreambuf_test - test lambda function objects with istreambuf_iterator |
2 | // | |
3 | // Copyright (c) 2007 Peter Dimov | |
4 | // | |
5 | // Distributed under the Boost Software License, Version 1.0. | |
6 | // See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt | |
8 | ||
9 | #include <boost/lambda/lambda.hpp> | |
10 | #include <boost/detail/lightweight_test.hpp> | |
11 | #include <iterator> | |
12 | #include <sstream> | |
13 | #include <algorithm> | |
14 | ||
15 | int main() | |
16 | { | |
17 | using namespace boost::lambda; | |
18 | ||
19 | std::stringstream is( "ax2" ); | |
20 | ||
21 | std::istreambuf_iterator<char> b2( is ); | |
22 | std::istreambuf_iterator<char> e2; | |
23 | ||
24 | std::istreambuf_iterator<char> i = std::find_if( b2, e2, _1 == 'x' ); | |
25 | ||
26 | BOOST_TEST( *i == 'x' ); | |
27 | BOOST_TEST( std::distance( i, e2 ) == 2 ); | |
28 | ||
29 | return boost::report_errors(); | |
30 | } |