"vscode:/vscode.git/clone" did not exist on "7bc134d7c12768634a99ea75dfdc2780822ef9e0"
requires.hpp 536 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
3
4
5
6
7
#ifndef RTG_GUARD_RTGLIB_REQUIRES_HPP
#define RTG_GUARD_RTGLIB_REQUIRES_HPP

#include <type_traits>

namespace rtg {

Paul's avatar
Paul committed
8
template <bool... Bs>
Paul's avatar
Paul committed
9
struct and_ : std::is_same<and_<Bs...>, and_<(Bs || true)...>> // NOLINT
Paul's avatar
Paul committed
10
11
{
};
Paul's avatar
Paul committed
12

Paul's avatar
Paul committed
13
14
15
template<bool B>
using bool_c = std::integral_constant<bool, B>;

Paul's avatar
Paul committed
16
#ifdef CPPCHECK
Paul's avatar
Paul committed
17
#define RTG_REQUIRES(...) class = void
Paul's avatar
Paul committed
18
#else
Paul's avatar
Paul committed
19
#define RTG_REQUIRES(...) bool PrivateRequires ## __LINE__ = true, class = typename std::enable_if<and_<__VA_ARGS__, PrivateRequires ## __LINE__>{}>::type
Paul's avatar
Paul committed
20
#endif
Paul's avatar
Paul committed
21
22
23
24

} // namespace rtg

#endif