5 #ifndef LODESTAR_BINOPCHECK_HPP
6 #define LODESTAR_BINOPCHECK_HPP
16 using void_t =
typename voider<Ts...>::type;
18 template<
class T,
class U,
class BinaryOperation,
class Enable =
void>
21 template<
class T,
class U,
class BinOp>
23 decltype(std::declval<BinOp>()(
24 std::declval<T>(), std::declval<U>()))>> :
28 template<
class T,
class U,
class BinOp>
31 #define RETURNS(...) \
32 noexcept(noexcept(__VA_ARGS__)) \
33 ->decltype(__VA_ARGS__) { \
34 return (__VA_ARGS__); \
38 template<
class T,
class U>
39 auto operator()(T t, U u) RETURNS(t + u)
42 template<
class T,
class U = T>
43 using is_addable = is_binop_able<T, U, plus>;
46 template<
class T,
class U>
47 auto operator()(T t, U u) RETURNS(t * u)
50 template<
class T,
class U = T>
51 using is_multiplicable = is_binop_able<T, U, multiplies>;
55 #endif //LODESTAR_BINOPCHECK_HPP