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/typeof/typeof.hpp> |
10 | #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() |
11 | #include <boost/detail/lightweight_test.hpp> |
12 | |
13 | struct point { |
14 | int x; |
15 | int y; |
16 | }; |
17 | BOOST_TYPEOF_REGISTER_TYPE(point) // Register for `NAME` below. |
18 | |
19 | int main(void) { |
20 | bool BOOST_LOCAL_FUNCTION( (const point& p) (const point& q) ) { |
21 | return p.x == q.x && p.y == q.y; |
22 | } BOOST_LOCAL_FUNCTION_NAME(equal) |
23 | |
24 | point a; a.x = 1; a.y = 2; |
25 | point b = a; |
26 | BOOST_TEST(equal(a, b)); |
27 | return boost::report_errors(); |
28 | } |
29 | |
30 |