// SPDX-FileCopyrightText: 2018 Kitsune Ral // SPDX-License-Identifier: LGPL-2.1-or-later #include "function_traits.h" // Tests for function_traits<> using namespace Quotient; int f_(); static_assert(std::is_same_v, int>, "Test fn_return_t<>"); void f1_(int, float); static_assert(std::is_same_v, float>, "Test fn_arg_t<>"); struct Fo { int operator()(); static constexpr auto l = [] { return 0.0f; }; bool memFn(); void constMemFn() const&; double field; const double field2; }; static_assert(std::is_same_v, int>, "Test return type of function object"); static_assert(std::is_same_v, float>, "Test return type of lambda"); static_assert(std::is_same_v, Fo>, "Test first argument type of member function"); static_assert(std::is_same_v, bool>, "Test return type of member function"); static_assert(std::is_same_v, const Fo&>, "Test first argument type of const member function"); static_assert(std::is_void_v>, "Test return type of const member function"); static_assert(std::is_same_v, double&>, "Test return type of a class member"); static_assert(std::is_same_v, const double&>, "Test return type of a const class member"); struct Fo1 { void operator()(int); }; static_assert(std::is_same_v, int>, "Test fn_arg_t defaulting to first argument"); template static void ft(const std::vector&); static_assert( std::is_same)>, const std::vector&>(), "Test function templates"); 1652d6550ceebecdb52df424'/>
blob: 85c298e034b3bb53d980795f794bc14a704e0457 (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