]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/test/functional/invoke/invoke_int_0_pass.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / thread / test / functional / invoke / invoke_int_0_pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // Copyright (C) 2014 Vicente J. Botet Escriba
11 //
12 // Distributed under the Boost Software License, Version 1.0. (See accompanying
13 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
14
15 // <boost/thread/detail/invoke.hpp>
16
17 #include <boost/thread/detail/invoke.hpp>
18 #include <boost/detail/lightweight_test.hpp>
19
20 int f()
21 {
22 return 1;
23 }
24
25 struct A_int_0
26 {
27 A_int_0()
28 {
29 }
30 int operator()()
31 {
32 return 4;
33 }
34 int operator()() const
35 {
36 return 5;
37 }
38 };
39
40
41 int main()
42 {
43 const A_int_0 ca;
44 A_int_0 a;
45
46 #if defined BOOST_THREAD_PROVIDES_INVOKE
47 BOOST_TEST_EQ(boost::detail::invoke(f), 1);
48 BOOST_TEST_EQ(boost::detail::invoke(&f), 1);
49 BOOST_TEST_EQ(boost::detail::invoke(A_int_0()), 4);
50 BOOST_TEST_EQ(boost::detail::invoke(a), 4);
51 BOOST_TEST_EQ(boost::detail::invoke(ca), 5);
52 #endif
53
54 BOOST_TEST_EQ(boost::detail::invoke<int>(f), 1);
55 BOOST_TEST_EQ(boost::detail::invoke<int>(&f), 1);
56 BOOST_TEST_EQ(A_int_0()(), 4);
57 #if defined BOOST_THREAD_PROVIDES_INVOKE || ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
58 BOOST_TEST_EQ(boost::detail::invoke<int>(A_int_0()), 4);
59 #else
60 //BOOST_TEST_EQ(boost::detail::invoke<int>(A_int_0()), 5);
61 #endif
62 BOOST_TEST_EQ(a(), 4);
63 BOOST_TEST_EQ(boost::detail::invoke<int>(a), 4);
64 BOOST_TEST_EQ(ca(), 5);
65 BOOST_TEST_EQ(boost::detail::invoke<int>(ca), 5);
66
67 return boost::report_errors();
68 }