About
Contact
QtCreator
KDevelop
Solarized
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
struct
point
{
19
int
x
;
20
int
y
;
21
};
22
BOOST_TYPEOF_REGISTER_TYPE
(point)
// Register for `NAME` below.
23
24
int
main
(
void
) {
25
//[operator_error
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
(
operator
==
)
// Error: Cannot use `operator...`.
29
//]
30
31
point
a
;
a
.
x
=
1
;
a
.
y
=
2
;
32
point
b
=
a
;
33
BOOST_TEST
(
a
==
b
);
34
return
boost::
report_errors
();
35
}
36
37
#
endif
// VARIADIC_MACROS
38
39