Loading...
Searching...
No Matches
zero Class Reference

A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to be zero at compile-time. It is also used for tagged dispatch. More...

#include <zero.H>

Inheritance diagram for zero:
Collaboration diagram for zero:

Public Types

typedef zero value_type
 The value type.

Public Member Functions

constexpr zero () noexcept
 Default construct.
constexpr zero (Istream &) noexcept
 Construct from Istream consumes no content.
constexpr operator bool () const noexcept
 Return false (0) for bool.
constexpr operator label () const noexcept
 Return 0 for label.
constexpr operator float () const noexcept
 Return 0 for float.
constexpr operator double () const noexcept
 Return 0 for double.
zero operator[] (const label) const noexcept
 Component-wise or element-wise access returns zero.
template<class T>
constexpr zero operator() (const T &) const noexcept
 Unary functor returns zero.

Static Public Attributes

static zero dummy
 A static instance, when modifiable reference is required by an API.

Detailed Description

A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to be zero at compile-time. It is also used for tagged dispatch.

Source files
See also
Foam::one

Definition at line 57 of file zero.H.

Member Typedef Documentation

◆ value_type

typedef zero value_type

The value type.

Definition at line 64 of file zero.H.

Constructor & Destructor Documentation

◆ zero() [1/2]

zero ( )
inlineconstexprnoexcept

Default construct.

Definition at line 74 of file zero.H.

References Foam::noexcept.

Referenced by operator()(), operator[](), and zeroFieldField::operator[]().

Here is the caller graph for this function:

◆ zero() [2/2]

zero ( Istream & )
inlineexplicitconstexprnoexcept

Construct from Istream consumes no content.

Definition at line 79 of file zero.H.

Member Function Documentation

◆ operator bool()

operator bool ( ) const
inlineconstexprnoexcept

Return false (0) for bool.

Definition at line 85 of file zero.H.

References Foam::noexcept.

◆ operator label()

operator label ( ) const
inlineconstexprnoexcept

Return 0 for label.

Definition at line 90 of file zero.H.

References Foam::noexcept.

◆ operator float()

operator float ( ) const
inlineconstexprnoexcept

Return 0 for float.

Definition at line 95 of file zero.H.

References Foam::noexcept.

◆ operator double()

operator double ( ) const
inlineconstexprnoexcept

Return 0 for double.

Definition at line 100 of file zero.H.

References Foam::noexcept.

◆ operator[]()

zero operator[] ( const label ) const
inlinenoexcept

Component-wise or element-wise access returns zero.

Definition at line 105 of file zero.H.

References zero().

Here is the call graph for this function:

◆ operator()()

template<class T>
zero operator() ( const T & ) const
inlineconstexprnoexcept

Unary functor returns zero.

Definition at line 115 of file zero.H.

References Foam::T(), and zero().

Here is the call graph for this function:

Member Data Documentation

◆ dummy

Foam::zero dummy
static

A static instance, when modifiable reference is required by an API.

Definition at line 69 of file zero.H.

Referenced by HashTableSingle< K >::cval(), HashTableSingle< K >::val(), and HashTableSingle< K >::val().


The documentation for this class was generated from the following files:
  • src/OpenFOAM/primitives/traits/zero.H
  • src/OpenFOAM/primitives/traits/zero.C