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...

Inheritance diagram for zero:
Collaboration diagram for zero:

Public Types

typedef zero value_type
 The value type. More...
 

Public Member Functions

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

Static Public Attributes

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

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]

constexpr zero ( )
inlinenoexcept

Default construct.

Definition at line 74 of file zero.H.

◆ zero() [2/2]

constexpr zero ( Istream )
inlineexplicitnoexcept

Construct from Istream consumes no content.

Definition at line 79 of file zero.H.

Member Function Documentation

◆ operator bool()

constexpr operator bool ( ) const
inlinenoexcept

Return false (0) for bool.

Definition at line 85 of file zero.H.

◆ operator label()

constexpr operator label ( ) const
inlinenoexcept

Return 0 for label.

Definition at line 90 of file zero.H.

◆ operator float()

constexpr operator float ( ) const
inlinenoexcept

Return 0 for float.

Definition at line 95 of file zero.H.

◆ operator double()

constexpr operator double ( ) const
inlinenoexcept

Return 0 for double.

Definition at line 100 of file zero.H.

◆ operator[]()

zero operator[] ( const label  ) const
inlinenoexcept

Component-wise or element-wise access returns zero.

Definition at line 105 of file zero.H.

◆ operator()()

constexpr zero operator() ( const T ) const
inlinenoexcept

Unary functor returns zero.

Definition at line 115 of file zero.H.

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(), and HashTableSingle< K >::val().


The documentation for this class was generated from the following files: