summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/function_types/test/decomposition/result_type.cpp
blob: f55eb854d11b7619b05d8e8208a893f6cbfafd9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).

//------------------------------------------------------------------------------

#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>

#include <boost/function_types/result_type.hpp>


namespace ft = boost::function_types;

class C; 
typedef C func();
typedef C const c_func();
typedef C (*func_ptr)();
typedef C const (*c_func_ptr)();
typedef C (&func_ref)();
typedef C const (&c_func_ref)();
typedef C (C::*mem_func_ptr)();
typedef C const (C::*c_mem_func_ptr)();
typedef C (C::*mem_func_ptr_c)() const;
typedef C const (C::*c_mem_func_ptr_c)() const;
typedef C (C::*mem_func_ptr_v)() volatile;
typedef C const (C::*c_mem_func_ptr_v)() volatile;
typedef C (C::*mem_func_ptr_cv)() const volatile;
typedef C const (C::*c_mem_func_ptr_cv)() const volatile;
typedef int C::* mem_ptr;
typedef int const C::* c_mem_ptr;

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<func>::type,C>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<c_func>::type,C const>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<func_ptr>::type,C>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<c_func_ptr>::type,C const>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<func_ref>::type,C>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<c_func_ref>::type,C const>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<mem_func_ptr>::type,C>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<c_mem_func_ptr>::type,C const>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<mem_func_ptr_c>::type,C>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<c_mem_func_ptr_c>::type,C const>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<mem_func_ptr_v>::type,C>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<c_mem_func_ptr_v>::type,C const>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<mem_func_ptr_cv>::type,C>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<c_mem_func_ptr_cv>::type,C const>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<mem_ptr>::type,int&>
));

BOOST_MPL_ASSERT((
  boost::is_same<ft::result_type<c_mem_ptr>::type,int const&>
));