#ifndef ALSK_ALSK_EDSL_OP_TRAITS_H #define ALSK_ALSK_EDSL_OP_TRAITS_H #include #include "impl/operand.h" namespace alsk { namespace edsl { /** * @brief true if the type is an operand for the EDSL */ template struct IsOperand: std::false_type {}; template struct IsOperand{}>>: std::true_type {}; template constexpr bool isOperand = IsOperand::value; /** * @brief true if all the types are operands for the EDSL */ template struct AllOperands; template struct AllOperands { static constexpr bool value = isOperand && AllOperands::value; }; template<> struct AllOperands<>: std::true_type {}; template constexpr bool allOperands = AllOperands::value; /** * @brief true if the type is a leaf */ template struct IsLeaf: std::false_type {}; template struct IsLeaf{}>>: std::true_type {}; template constexpr bool isLeaf = IsLeaf::value; /** * @brief true if the type is a branch */ template struct IsBranch: std::false_type {}; template struct IsBranch and not isLeaf>>: std::true_type {}; template constexpr bool isBranch = IsBranch::value; /** * @brief get the return value from an operand's signature */ template struct GetReturnTypeFromSignatureImpl; template struct GetReturnTypeFromSignatureImpl { using type = R; }; template using GetReturnTypeFromSignature = typename GetReturnTypeFromSignatureImpl::type; /** * @brief get the return value from an operand */ template using GetReturnType = GetReturnTypeFromSignature; } } #endif