noneOfValue - HaxyM/crap GitHub Wiki

crap :: noneOfValue

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.

Template parameters

  • Type - type of values to be checked.
  • Operator - functor transforming each of Values... element into logical (or logicaly interpretable) value. Must give its answer in field named value.
  • 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 of Operator acting on that element.

Layout

Member constants

value - holds result of operation. If Values... is empty it will be evaluated as true.

Member types

value_type - type of field value. May not be bool but should be castable to this type.

Member functions

constexpr operator value_type () const noexcept - casts whole object to its value_type returning value.

Usage example

#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.*/
};

See also:

⚠️ **GitHub.com Fallback** ⚠️