line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
// Copyright Catch2 Authors |
3
|
|
|
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. |
4
|
|
|
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at |
5
|
|
|
|
|
|
|
// https://www.boost.org/LICENSE_1_0.txt) |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
// SPDX-License-Identifier: BSL-1.0 |
8
|
|
|
|
|
|
|
// Adapted from donated nonius code. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#ifndef CATCH_COMPLETE_INVOKE_HPP_INCLUDED |
11
|
|
|
|
|
|
|
#define CATCH_COMPLETE_INVOKE_HPP_INCLUDED |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#include |
14
|
|
|
|
|
|
|
#include |
15
|
|
|
|
|
|
|
#include |
16
|
|
|
|
|
|
|
#include |
17
|
|
|
|
|
|
|
#include |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#include |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
namespace Catch { |
22
|
|
|
|
|
|
|
namespace Benchmark { |
23
|
|
|
|
|
|
|
namespace Detail { |
24
|
|
|
|
|
|
|
template |
25
|
|
|
|
|
|
|
struct CompleteType { using type = T; }; |
26
|
|
|
|
|
|
|
template <> |
27
|
|
|
|
|
|
|
struct CompleteType { struct type {}; }; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
template |
30
|
|
|
|
|
|
|
using CompleteType_t = typename CompleteType::type; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
template |
33
|
|
|
|
|
|
|
struct CompleteInvoker { |
34
|
|
|
|
|
|
|
template |
35
|
0
|
|
|
|
|
|
static Result invoke(Fun&& fun, Args&&... args) { |
36
|
0
|
|
|
|
|
|
return CATCH_FORWARD(fun)(CATCH_FORWARD(args)...); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
template <> |
40
|
|
|
|
|
|
|
struct CompleteInvoker { |
41
|
|
|
|
|
|
|
template |
42
|
0
|
|
|
|
|
|
static CompleteType_t invoke(Fun&& fun, Args&&... args) { |
43
|
0
|
|
|
|
|
|
CATCH_FORWARD(fun)(CATCH_FORWARD(args)...); |
44
|
0
|
|
|
|
|
|
return {}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
// invoke and not return void :( |
49
|
|
|
|
|
|
|
template |
50
|
0
|
|
|
|
|
|
CompleteType_t> complete_invoke(Fun&& fun, Args&&... args) { |
51
|
0
|
|
|
|
|
|
return CompleteInvoker>::invoke(CATCH_FORWARD(fun), CATCH_FORWARD(args)...); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} // namespace Detail |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
template |
57
|
0
|
|
|
|
|
|
Detail::CompleteType_t> user_code(Fun&& fun) { |
58
|
0
|
|
|
|
|
|
return Detail::complete_invoke(CATCH_FORWARD(fun)); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} // namespace Benchmark |
61
|
|
|
|
|
|
|
} // namespace Catch |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#endif // CATCH_COMPLETE_INVOKE_HPP_INCLUDED |