oneOrTmp< Type > Class Template Reference

Variant type that either contains and behaves as tmp object or represents a value of one. Provides multiplication and scaling operations which are optimised away if representing a value of one. More...

Public Member Functions

 oneOrTmp ()
 Construct as one. More...
 
 oneOrTmp (const Type &)
 Construct from an object. More...
 
 oneOrTmp (const tmp< Type > &)
 Construct from a temporary object. More...
 
 oneOrTmp (const oneOrTmp< Type > &)
 Copy construct. More...
 
 ~oneOrTmp ()
 Destructor. More...
 
template<class Other >
void scale (Other &o) const
 Scale an object by this value. More...
 
void operator= (const one &)
 Assign to one. More...
 
void operator= (const tmp< Type > &)
 Assign to a temporary object. More...
 
oneOrTmp< Type > operator() () const
 Return an instance of the class which refers to this one. Used in. More...
 
template<class Other >
tmp< Other > operator* (const Other &)
 Multiply with an object. More...
 
template<class Other >
tmp< Other > operator* (const tmp< Other > &)
 Multiply with a temporary object. More...
 
void operator= (const oneOrTmp< Type > &)=delete
 Disallow default bitwise assignment. More...
 
template<class Other >
Foam::tmp< Other > operator* (const Other &o)
 
template<class Other >
Foam::tmp< Other > operator* (const tmp< Other > &to)
 

Detailed Description

template<class Type>
class Foam::oneOrTmp< Type >

Variant type that either contains and behaves as tmp object or represents a value of one. Provides multiplication and scaling operations which are optimised away if representing a value of one.

Source files

Definition at line 52 of file oneOrTmp.H.

Constructor & Destructor Documentation

◆ oneOrTmp() [1/4]

oneOrTmp
inline

Construct as one.

Definition at line 31 of file oneOrTmpI.H.

◆ oneOrTmp() [2/4]

oneOrTmp ( const Type &  t)
inline

Construct from an object.

Definition at line 39 of file oneOrTmpI.H.

◆ oneOrTmp() [3/4]

oneOrTmp ( const tmp< Type > &  tt)
inline

Construct from a temporary object.

Definition at line 46 of file oneOrTmpI.H.

References tmp< T >::clear().

Here is the call graph for this function:

◆ oneOrTmp() [4/4]

oneOrTmp ( const oneOrTmp< Type > &  oot)
inline

Copy construct.

Definition at line 56 of file oneOrTmpI.H.

◆ ~oneOrTmp()

Destructor.

Definition at line 66 of file oneOrTmpI.H.

Member Function Documentation

◆ scale()

void scale ( Other &  o) const

Scale an object by this value.

Definition at line 74 of file oneOrTmpI.H.

◆ operator=() [1/3]

void operator= ( const one )
inline

Assign to one.

Definition at line 86 of file oneOrTmpI.H.

◆ operator=() [2/3]

void operator= ( const tmp< Type > &  tt)
inline

Assign to a temporary object.

Definition at line 94 of file oneOrTmpI.H.

◆ operator()()

Foam::oneOrTmp< Type > operator()
inline

Return an instance of the class which refers to this one. Used in.

the same way as tmp::operator() to prevent the tmp being consumed.

Definition at line 102 of file oneOrTmpI.H.

◆ operator*() [1/4]

tmp<Other> operator* ( const Other &  )
inline

Multiply with an object.

◆ operator*() [2/4]

tmp<Other> operator* ( const tmp< Other > &  )
inline

Multiply with a temporary object.

◆ operator=() [3/3]

void operator= ( const oneOrTmp< Type > &  )
delete

Disallow default bitwise assignment.

◆ operator*() [3/4]

Foam::tmp<Other> operator* ( const Other &  o)

Definition at line 117 of file oneOrTmpI.H.

◆ operator*() [4/4]

Foam::tmp<Other> operator* ( const tmp< Other > &  to)

Definition at line 132 of file oneOrTmpI.H.

References tmp< T >::clear().

Here is the call graph for this function:

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