Commit | Line | Data |
---|---|---|
557acf4c PP |
1 | /* |
2 | * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: MIT | |
5 | */ | |
6 | ||
7 | #ifndef BABELTRACE_CPP_COMMON_BT2C_CALL_HPP | |
8 | #define BABELTRACE_CPP_COMMON_BT2C_CALL_HPP | |
9 | ||
10 | #include <functional> | |
11 | #include <utility> | |
12 | ||
13 | namespace bt2c { | |
14 | ||
15 | /* | |
16 | * Partial implementation of INVOKE. | |
17 | * | |
18 | * As found in | |
19 | * <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0312r1.html>. | |
20 | */ | |
21 | template <typename FuncT, typename... ArgTs> | |
22 | auto call(FuncT func, ArgTs&&...args) -> decltype(std::ref(func)(std::forward<ArgTs>(args)...)) | |
23 | { | |
24 | return std::ref(func)(std::forward<ArgTs>(args)...); | |
25 | } | |
26 | ||
27 | } /* namespace bt2c */ | |
28 | ||
29 | #endif /* BABELTRACE_CPP_COMMON_BT2C_CALL_HPP */ |