summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/function_types/test/synthesis/mem_func_ptr_cv2.cpp
blob: 007efa03894c63f87f9b00a03069182402cccc3f (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
// (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/mpl/vector.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/function_types/member_function_pointer.hpp>

namespace ft = boost::function_types;
namespace mpl = boost::mpl;
using boost::is_same;

class C;

typedef int (C::* expected1)(int);
typedef int (C::* expected2)(int) const;
typedef int (C::* expected3)(int) volatile;
typedef int (C::* expected4)(int) const volatile;

// implicitly specified cv qualification

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< mpl::vector<int,C &,int> >::type
         , expected1 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< mpl::vector<int,C const &,int> >::type
         , expected2 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< 
              mpl::vector<int,C volatile &,int> >::type
         , expected3 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< 
              mpl::vector<int,C const volatile &,int> >::type
         , expected4 >
));

// implicit & explicit/overrides

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< 
              mpl::vector<int,C const volatile &,int>
            , ft::tag<ft::non_const, ft::non_volatile> >::type
         , expected1 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< mpl::vector<int,C volatile &,int>,
              ft::tag<ft::const_qualified, ft::non_volatile> >::type
         , expected2 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< mpl::vector<int,C const &,int>,
              ft::tag<ft::non_const, ft::volatile_qualified> >::type
         , expected3 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< mpl::vector<int,C const &,int>,
              ft::tag<ft::const_qualified, ft::volatile_qualified> >::type
         , expected4 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< mpl::vector<int,C volatile &,int>,
              ft::tag<ft::const_qualified, ft::volatile_qualified> >::type
         , expected4 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< mpl::vector<int,C volatile &,int> 
                                      , ft::const_qualified    >::type
         , expected4 >
));

BOOST_MPL_ASSERT((
  is_same< ft::member_function_pointer< mpl::vector<int,C const &,int>
                                      , ft::volatile_qualified >::type
         , expected4 >
));