1/*<-
2Copyright Barrett Adair 2016-2017
3Distributed under the Boost Software License, Version 1.0.
4(See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt)
5->*/
6
7#include <boost/callable_traits/detail/config.hpp>
8#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
9int main(){}
10#else
11
12//[ overview
13#include <boost/callable_traits.hpp>
14
15#include <type_traits>
16#include <tuple>
17
18using std::is_same;
19using std::tuple;
20
21using namespace boost::callable_traits;
22
23struct number {
24 int value;
25 int add(int n) const { return value + n; }
26};
27
28using pmf = decltype(&number::add);
29
30//` Manipulate member functions pointers with ease:
31static_assert(is_same<
32 remove_member_const_t<pmf>,
33 int(number::*)(int)
34>{}, "");
35
36static_assert(is_same<
37 add_member_volatile_t<pmf>,
38 int(number::*)(int) const volatile
39>{}, "");
40
41static_assert(is_same<
42 class_of_t<pmf>,
43 number
44>{}, "");
45
46//` INVOKE-aware metafunctions:
47
48static_assert(is_same<
49 args_t<pmf>,
50 tuple<const number&, int>
51>{}, "");
52
53static_assert(is_same<
54 return_type_t<pmf>,
55 int
56>{}, "");
57
58static_assert(is_same<
59 function_type_t<pmf>,
60 int(const number&, int)
61>{}, "");
62
63static_assert(is_same<
64 qualified_class_of_t<pmf>,
65 const number&
66>{}, "");
67
68//` Here are a few other trait examples:
69static_assert(is_const_member<pmf>{}, "");
70static_assert(!is_volatile_member<pmf>{}, "");
71static_assert(!has_void_return<pmf>{}, "");
72static_assert(!has_varargs<pmf>{}, "");
73
74//]
75
76int main() {}
77
78#endif
79

source code of boost/libs/callable_traits/example/overview.cpp