-
Notifications
You must be signed in to change notification settings - Fork 2
noneOfValue
Igor Zarzycki edited this page Jan 23, 2022
·
2 revisions
Defined in "crap/algorithm.d/noneofvalue.h".
Defined in "crap/algorithm".
template <class Type, template <Type> class Operator, Type ... Values> struct noneOfValue;
Returns if none of Values...
satisfies Operator
acting on each of them.
-
Type
- type of values to be checked. -
Operator
- functor transforming each ofValues...
element into logical (or logicaly interpretable) value. Must give its answer in field namedvalue
. -
Values...
- set of values to operate on. If this set is empty whole operation is evaluated to true. If set is single element then whole operation is evaluated to negation of result ofOperator
acting on that element.
value
- holds result of operation. If Values...
is empty it will be evaluated as true
.
value_type
- type of field value
. May not be bool
but should be castable to this type.
constexpr operator value_type () const noexcept
- casts whole object to its value_type
returning value
.
#include <crap/algorithm.d/noneofvalue.h>
#include <type_traits>
template <class T, std :: size_t ... Dims> class MyAwsomeMultiArray
{
template <std :: size_t Dim> using isZero = std :: integral_constant<bool, (Dim == 0u)>;
public:
static_assert(crap :: noneOfValue<std :: size_t, isZero, Dims...>{}, "Non of dimension may be zero.");
/*Some more code.*/
};