• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*<-
2 Copyright (c) 2016 Barrett Adair
3 
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6 ->*/
7 
8 #include <boost/callable_traits/detail/config.hpp>
9 #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
main()10 int main(){ return 0; }
11 #else
12 
13 //[ args
14 #include <type_traits>
15 #include <memory>
16 #include <boost/callable_traits.hpp>
17 
18 namespace ct = boost::callable_traits;
19 
20 template<typename T, typename Expect>
test()21 void test(){
22     using args_t = ct::args_t<T>;
23     static_assert(std::is_same<args_t, Expect>::value, "");
24 }
25 
main()26 int main() {
27 
28     {
29         auto lamda = [](int, float&, const char*){};
30         using lam = decltype(lamda);
31         using expect = std::tuple<int, float&, const char*>;
32 
33         test<lam, expect>();
34     }
35 
36     {
37         struct foo;
38         using pmf = void(foo::*)(int, float&, const char*);
39         using expect = std::tuple<foo&, int, float&, const char*>;
40 
41         test<pmf, expect>();
42     }
43 
44     {
45         using function_ptr = void(*)(int, float&, const char*);
46         using expect = std::tuple<int, float&, const char*>;
47         test<function_ptr, expect>();
48     }
49 
50     {
51         using function_ref = void(&)(int, float&, const char*);
52         using expect = std::tuple<int, float&, const char*>;
53         test<function_ref, expect>();
54     }
55 
56     {
57         using function = void(int, float&, const char*);
58         using expect = std::tuple<int, float&, const char*>;
59         test<function, expect>();
60     }
61 
62     {
63         using abominable = void(int, float&, const char*) const;
64         using expect = std::tuple<int, float&, const char*>;
65         test<abominable, expect>();
66     }
67 }
68 //]
69 #endif //#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
70