AsmGrader 0.0.0
Loading...
Searching...
No Matches
decomposer.hpp File Reference

Basic decomposition implementation, intended for use with the REQUIRE macro Inspired by Catch2, or whomever first came up with the idea. More...

#include <asmgrader/common/class_traits.hpp>
#include <asmgrader/common/static_string.hpp>
#include <asmgrader/meta/always_false.hpp>
#include <cstddef>
#include <string_view>
#include <tuple>
#include <utility>
Include dependency graph for decomposer.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  asmgrader::Decomposer
 Just a tag type for operator overloading purposes Intended use is on the lhs of operator<= e.g. Decomposer{} <= a < b + 1 Decomposes the expression "a < b + 1" into the subexpressions "a" and "b + 1". More...
 
struct  asmgrader::DecomposedExpr< Op, Types >
 Stores references to rhs and lhs of a comparison expression, serving as an interface to the "decomposed" expression. More...
 

Namespaces

namespace  asmgrader
 

Macros

#define STATIC_ASSERT_PRE
 
#define STATIC_ASSERT_POST
 
#define STATIC_ASSERT_CHAINED_POST
 
#define DISABLE_OPERATOR(op)
 
#define DISABLE_CHAINED_OPERATOR(op)
 
#define COMMA   ,
 

Functions

template<typename T >
constexpr DecomposedExpr<"", T > asmgrader::operator<= (Decomposer, T &&expr_lhs)
 
template<typename T , typename U >
constexpr DecomposedExpr<"==", T, U > asmgrader::operator== (DecomposedExpr<"", T > &&expr_lhs, U &&expr_rhs)
 
template<typename T , typename U >
constexpr DecomposedExpr<"!=", T, U > asmgrader::operator!= (DecomposedExpr<"", T > &&expr_lhs, U &&expr_rhs)
 
template<typename T , typename U >
constexpr DecomposedExpr<">=", T, U > asmgrader::operator>= (DecomposedExpr<"", T > &&expr_lhs, U &&expr_rhs)
 
DISABLE_OPERATOR & asmgrader::DISABLE_OPERATOR (|);DISABLE_OPERATOR(^
 
DISABLE_OPERATOR && asmgrader::DISABLE_OPERATOR (||);DISABLE_OPERATOR(+=
 
 asmgrader::DISABLE_OPERATOR (-=)
 
DISABLE_OPERATOR * asmgrader::DISABLE_OPERATOR (/=);DISABLE_OPERATOR(%=
 
 asmgrader::DISABLE_OPERATOR (<<=)
 
 asmgrader::DISABLE_OPERATOR (> >=)
 
DISABLE_OPERATOR & asmgrader::DISABLE_OPERATOR (^=);DISABLE_OPERATOR(|=
 
 asmgrader::DISABLE_OPERATOR (COMMA)
 
 asmgrader::DISABLE_CHAINED_OPERATOR (==)
 
 asmgrader::DISABLE_CHAINED_OPERATOR (!=)
 
 asmgrader::DISABLE_CHAINED_OPERATOR (<=)
 
 asmgrader::DISABLE_CHAINED_OPERATOR (>=)
 

Detailed Description

Basic decomposition implementation, intended for use with the REQUIRE macro Inspired by Catch2, or whomever first came up with the idea.

Macro Definition Documentation

◆ COMMA

#define COMMA   ,

◆ DISABLE_CHAINED_OPERATOR

#define DISABLE_CHAINED_OPERATOR ( op)
Value:
template <StaticString Op, typename... Ts, typename U> \
constexpr void operator op(DecomposedExpr<Op, Ts...>&& /*expr_lhs*/, U&& /*expr_rhs*/) { \
static_assert(always_false_v<U>, STATIC_ASSERT_PRE #op STATIC_ASSERT_CHAINED_POST); \
}
#define STATIC_ASSERT_CHAINED_POST
Definition decomposer.hpp:101
#define STATIC_ASSERT_PRE
Definition decomposer.hpp:88

◆ DISABLE_OPERATOR

#define DISABLE_OPERATOR ( op)
Value:
template <StaticString Op, typename... Ts, typename U> \
constexpr void operator op(DecomposedExpr<Op, Ts...>&& /*expr_lhs*/, U&& /*expr_rhs*/) { \
static_assert(always_false_v<U>, STATIC_ASSERT_PRE #op STATIC_ASSERT_POST); \
}
#define STATIC_ASSERT_POST
Definition decomposer.hpp:94

◆ STATIC_ASSERT_CHAINED_POST

#define STATIC_ASSERT_CHAINED_POST
Value:
" is not supported to be chained with decomposition. Wrap it in parentheses, or fix the logic error." \
" !!!!!!!!!!!!!!!!! " \
"=====================================================================================================" \
"=========================================================== "

◆ STATIC_ASSERT_POST

#define STATIC_ASSERT_POST
Value:
" is not supported for decomposition! Wrap it in parentheses." \
" !!!!!!!!!!!!!!!!! " \
"=====================================================================================================" \
"=========================================================== "

◆ STATIC_ASSERT_PRE

#define STATIC_ASSERT_PRE
Value:
"=====================================================================================================" \
"=========================================================== !!!!!!!!!!!!!!!!! " \
"Operator "