Pair< T > Class Template Reference

An ordered pair of two objects of type <T> with first() and second() elements. More...

Inheritance diagram for Pair< T >:
[legend]

Classes

struct  SymmHash
 Symmetrical hashing for Pair data. More...
 

Public Member Functions

 Pair ()=default
 Construct null. More...
 
 Pair (const T &f, const T &s)
 Copy construct from components. More...
 
 Pair (T &&f, T &&s)
 Move construct from components. More...
 
 Pair (const std::pair< T, T > &vals)
 Copy construct from std::pair. More...
 
 Pair (std::pair< T, T > &&vals)
 Move construct from std::pair. More...
 
 Pair (const FixedList< T, 2 > &list)
 Copy construct FixedList of two items. More...
 
 Pair (const T &f, const T &s, const bool doSort)
 Copy construct, optionally sorted with first less-than second. More...
 
 Pair (const FixedList< T, 2 > &list, const bool doSort)
 Copy construct, optionally sorted with first less-than second. More...
 
 Pair (Istream &is)
 Construct from Istream. More...
 
const T & second () const noexcept
 Return second element, which is also the last element. More...
 
T & second () noexcept
 Return second element, which is also the last element. More...
 
const T & other (const T &a) const
 Return other element. More...
 
bool sorted () const
 True if first() is less-than second() More...
 
void flip ()
 Flip the Pair in-place. More...
 
void sort ()
 Sort so that first() is less-than second() More...
 

Static Public Member Functions

static int compare (const Pair< T > &a, const Pair< T > &b)
 Compare Pairs. More...
 

Detailed Description

template<class T>
class Foam::Pair< T >

An ordered pair of two objects of type <T> with first() and second() elements.

Source files
See also
Foam::Tuple2 for storing two objects of dissimilar types.

Definition at line 54 of file Pair.H.

Constructor & Destructor Documentation

◆ Pair() [1/9]

Pair ( )
default

Construct null.

◆ Pair() [2/9]

Pair ( const T &  f,
const T &  s 
)
inline

Copy construct from components.

Definition at line 51 of file PairI.H.

◆ Pair() [3/9]

Pair ( T &&  f,
T &&  s 
)
inline

Move construct from components.

Definition at line 59 of file PairI.H.

◆ Pair() [4/9]

Pair ( const std::pair< T, T > &  vals)
inline

Copy construct from std::pair.

Definition at line 67 of file PairI.H.

◆ Pair() [5/9]

Pair ( std::pair< T, T > &&  vals)
inline

Move construct from std::pair.

Definition at line 75 of file PairI.H.

◆ Pair() [6/9]

Pair ( const FixedList< T, 2 > &  list)
inline

Copy construct FixedList of two items.

Definition at line 83 of file PairI.H.

◆ Pair() [7/9]

Pair ( const T &  f,
const T &  s,
const bool  doSort 
)
inline

Copy construct, optionally sorted with first less-than second.

Definition at line 90 of file PairI.H.

◆ Pair() [8/9]

Pair ( const FixedList< T, 2 > &  list,
const bool  doSort 
)
inline

Copy construct, optionally sorted with first less-than second.

Definition at line 106 of file PairI.H.

◆ Pair() [9/9]

Pair ( Istream &  is)
inlineexplicit

Construct from Istream.

Definition at line 113 of file PairI.H.

Member Function Documentation

◆ second() [1/2]

const T & second ( ) const
inlinenoexcept

Return second element, which is also the last element.

Definition at line 122 of file PairI.H.

Referenced by globalIndexAndTransform::addToTransformIndex(), reconstructionSchemes::alreadyReconstructed(), meshRefinement::balance(), fieldMinMax::calcMinMaxFieldType(), Pair< word >::compare(), InterfaceCompositionPhaseChangePhaseSystem< BasePhaseSystem >::correctInterfaceThermo(), snappyRefineDriver::doRefine(), Foam::faceNij(), shellSurfaces::findDirectionalLevel(), phaseSystem::generatePairs(), ensightSurfaceReader::geometry(), InterfaceCompositionPhaseChangePhaseSystem< BasePhaseSystem >::iDmdt(), linearInterpolationWeights::integrationWeights(), slidingInterface::modifyMotionPoints(), Distribution< Type >::normalised(), multiphaseMixtureThermo::interfacePair::hash::operator()(), multiphaseMixture::interfacePair::hash::operator()(), multiphaseSystem::interfacePair::symmHash::operator()(), multiphaseSystem::interfacePair::hash::operator()(), Pair< T >::SymmHash< HashT >::operator()(), Hash< Pair< T > >::operator()(), Foam::operator<(), Foam::operator<<(), Foam::operator==(), Foam::operator>>(), PopulationBalancePhaseSystem< BasePhaseSystem >::PopulationBalancePhaseSystem(), globalIndexAndTransform::processor(), Distribution< Type >::raw(), ensightSurfaceReader::readGeometryHeader(), RectangularMatrix< complex >::RectangularMatrix(), lumpedPointMovement::setInterpolator(), meshRefinement::splitFacesUndo(), SquareMatrix< cmptType >::SquareMatrix(), globalIndexAndTransform::transformIndex(), globalIndexAndTransform::transformIndicesForPatches(), Distribution< Type >::validLimits(), ABAQUSsurfaceFormat< Face >::write(), and meshRefinement::zonify().

Here is the caller graph for this function:

◆ second() [2/2]

T & second ( )
inlinenoexcept

Return second element, which is also the last element.

Definition at line 129 of file PairI.H.

◆ other()

const T & other ( const T &  a) const
inline

Return other element.

Definition at line 136 of file PairI.H.

◆ sorted()

bool sorted ( ) const
inline

True if first() is less-than second()

Definition at line 167 of file PairI.H.

◆ flip()

void flip ( )
inline

Flip the Pair in-place.

Definition at line 160 of file PairI.H.

Referenced by patchEdgeFaceRegions::updateEdge(), patchEdgeFaceRegions::updateFace(), and meshRefinement::zonify().

Here is the caller graph for this function:

◆ sort()

void sort ( )
inline

Sort so that first() is less-than second()

Definition at line 174 of file PairI.H.

◆ compare()

int compare ( const Pair< T > &  a,
const Pair< T > &  b 
)
inlinestatic

Compare Pairs.

Returns
  • 0: different
  • +1: identical values and order used
  • -1: identical values, but in reversed order

Definition at line 33 of file PairI.H.

Referenced by Foam::operator==().

Here is the caller graph for this function:

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