]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/local_function/example/gcc_square.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / local_function / example / gcc_square.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
11 int add_square(int a, int b) {
12 int BOOST_LOCAL_FUNCTION(int z) {
13 return z * z;
14 } BOOST_LOCAL_FUNCTION_NAME(square)
15
16 return square(a) + square(b);
17 }
18
19 int main(void) {
20 BOOST_TEST(add_square(2, 4) == 20);
21 return boost::report_errors();
22 }
23