Created
February 5, 2019 11:50
-
-
Save revsic/e1e54035d9eba80f17db394bdfba2ea3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#define REQUIRE(method, ...) \ | |
template <typename Cont, typename = void> \ | |
struct require_##method : std::false_type {}; \ | |
template <typename Cont> \ | |
struct require_##method< \ | |
Cont, \ | |
std::void_t<decltype(std::declval<Cont>().method(__VA_ARGS__))>> \ | |
: std::true_type {}; \ | |
template <typename T> \ | |
constexpr bool require_##method##_v = valid_##method<T>::value; | |
#define VAL(T) std::declval<T>() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment