]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/local_function/test/add_seq.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / local_function / test / add_seq.cpp
1
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
7
8 #include <boost/local_function.hpp>
9 #include <boost/detail/lightweight_test.hpp>
10 #include <algorithm>
11
12 //[add_seq
13 int main(void) {
14 int sum = 0, factor = 10;
15
16 void BOOST_LOCAL_FUNCTION( (const bind factor) (bind& sum) (int num) ) {
17 sum += factor * num;
18 } BOOST_LOCAL_FUNCTION_NAME(add)
19
20 add(1);
21 int nums[] = {2, 3};
22 std::for_each(nums, nums + 2, add);
23
24 BOOST_TEST(sum == 60);
25 return boost::report_errors();
26 }
27 //]
28