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/config.hpp>
9 #ifdef BOOST_NO_CXX11_VARIADIC_MACROS
10 #   error "variadic macros required"
11 #else
12 
13 #include <boost/local_function.hpp>
14 #include <boost/typeof/typeof.hpp>
15 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
16 #include <boost/detail/lightweight_test.hpp>
17 
18 //[operator
19 struct point {
20     int x;
21     int y;
22 };
BOOST_TYPEOF_REGISTER_TYPE(point)23 BOOST_TYPEOF_REGISTER_TYPE(point) // Register for `NAME` below.
24 
25 int main(void) {
26     bool BOOST_LOCAL_FUNCTION(const point& p, const point& q) {
27         return p.x == q.x && p.y == q.y;
28     } BOOST_LOCAL_FUNCTION_NAME(equal) // OK: not using `operator==`.
29 
30     point a; a.x = 1; a.y = 2;
31     point b = a;
32     BOOST_TEST(equal(a, b));
33     return boost::report_errors();
34 }
35 //]
36 
37 #endif // VARIADIC_MACROS
38 
39