]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/local_function/test/typeof_template.cpp
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
8 #include <boost/config.hpp>
9 #ifdef BOOST_NO_CXX11_VARIADIC_MACROS
10 # error "variadic macros required"
13 #include "addable.hpp"
14 #include <boost/local_function.hpp>
15 #include <boost/type_traits/remove_reference.hpp>
16 #include <boost/concept_check.hpp>
17 #include <boost/detail/lightweight_test.hpp>
22 T
calculate(const T
& factor
) {
25 void BOOST_LOCAL_FUNCTION_TPL(const bind factor
, bind
& sum
, T num
) {
26 // Local function `TYPEOF` does not need `typename`.
27 BOOST_CONCEPT_ASSERT((Addable
<typename
boost::remove_reference
<
28 BOOST_LOCAL_FUNCTION_TYPEOF(sum
)>::type
>));
30 } BOOST_LOCAL_FUNCTION_NAME_TPL(add
)
38 BOOST_TEST(calculate(10) == 60);
39 return boost::report_errors();
42 #endif // VARIADIC_MACROS