]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/local_function/test/transform_seq.cpp
2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/local_function
8 #include <boost/local_function.hpp>
9 #include <boost/detail/lightweight_test.hpp>
18 for(int i
= 1; i
<= 2; ++i
) v
.push_back(i
* 10);
19 BOOST_TEST(v
[0] == 10); BOOST_TEST(v
[1] == 20);
22 int BOOST_LOCAL_FUNCTION( (const bind
& offset
) (int i
) ) {
24 } BOOST_LOCAL_FUNCTION_NAME(inc
)
26 std::transform(v
.begin(), v
.end(), w
.begin(), inc
);
27 BOOST_TEST(w
[0] == 16); BOOST_TEST(w
[1] == 26);
29 int BOOST_LOCAL_FUNCTION( (bind
& inc
) (int i
) (int j
) ) {
31 } BOOST_LOCAL_FUNCTION_NAME(inc_sum
)
34 std::transform(v
.begin(), v
.end(), w
.begin(), v
.begin(), inc_sum
);
35 BOOST_TEST(v
[0] == 27); BOOST_TEST(v
[1] == 47);
37 return boost::report_errors();