OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
olb::util::minus< T > Struct Template Reference

Wrapper of function object std::minus with special handling for bool. More...

#include <arithmetic.h>

+ Collaboration diagram for olb::util::minus< T >:

Public Member Functions

constexpr T operator() (const T &lhs, const T &rhs) const
 
constexpr bool operator() (const bool &lhs, const bool &rhs) const
 Operator specialization for boolean without operation.
 

Static Public Attributes

static const char symbol = '-'
 symbol character for functor naming
 

Detailed Description

template<typename T>
struct olb::util::minus< T >

Wrapper of function object std::minus with special handling for bool.

Template Parameters
TDomain of the substraction operation, without operation is performed for boolean inputs.

Note that specialization is not required for boolean union (add) and intersection (multiply) functors as their behavior is implicitly defined by the corresponding arithmetic operation on the integer representation.

Definition at line 44 of file arithmetic.h.

Member Function Documentation

◆ operator()() [1/2]

constexpr bool olb::util::minus< bool >::operator() ( const bool & lhs,
const bool & rhs ) const
constexpr

Operator specialization for boolean without operation.

i.e. implements what one reasonably expects to happen when substracting indicator functors.

Definition at line 60 of file arithmetic.h.

61{
62 return lhs && !rhs;
63}

◆ operator()() [2/2]

template<typename T >
constexpr T olb::util::minus< T >::operator() ( const T & lhs,
const T & rhs ) const
inlineconstexpr

Definition at line 48 of file arithmetic.h.

49 {
50 return std::minus<T>()(lhs, rhs);
51 }

Member Data Documentation

◆ symbol

template<typename T >
const char olb::util::minus< T >::symbol = '-'
static

symbol character for functor naming

Definition at line 46 of file arithmetic.h.


The documentation for this struct was generated from the following file: