Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Pair< T1, T2 > Class Template Reference

#include <>>

Public Member Functions

 Pair (void)
 
 Pair (const T1 &_fst, const T2 &_snd)
 
 Pair (const Pair< T1, T2 > &pair)
 
Pair< T1, T2 > & operator= (const Pair< T1, T2 > &pair)
 
bool operator== (const Pair< T1, T2 > &pair) const
 
bool operator!= (const Pair< T1, T2 > &pair) const
 
bool operator< (const Pair< T1, T1 > &pair) const
 
bool operator<= (const Pair< T1, T1 > &pair) const
 
bool operator> (const Pair< T1, T1 > &pair) const
 
bool operator>= (const Pair< T1, T1 > &pair) const
 

Public Attributes

T1 fst
 
T2 snd
 

Detailed Description

template<class T1, class T2>
class elm::Pair< T1, T2 >

This template class is mainly useful for returning or passing in parameter a data item composed of two values.

Pairs are useful to avoid developing specific structures or classes to group two data. To help using pairs, some shortcut functions are provided:

  • pair(v1, v2) – allows to build a pair of type Pair<T1, T2> with T1 type of v1, T2 type of v2.
  • let(r1, r2) = pair – assign quickly a pair to a pair of variables r1 and r2.

A common use of the last function is:

T1 v1;
T2 v2;
let(v1, v2) = my_pair;
Parameters
T1First value type.
T2Second value type.

Constructor & Destructor Documentation

◆ Pair() [1/3]

Pair ( void  )
inline

Build a pair with uninitialized content.

◆ Pair() [2/3]

Pair ( const T1 &  _fst,
const T2 &  _snd 
)
inline

Build a pair from two values.

Parameters
_fstFirst value.
_sndSecond value.

◆ Pair() [3/3]

Pair ( const Pair< T1, T2 > &  pair)
inline

Build a pair by copying another pair.

Parameters
pairPair to copy.

Member Function Documentation

◆ operator!=()

bool operator!= ( const Pair< T1, T2 > &  pair) const
inline

◆ operator<()

bool operator< ( const Pair< T1, T1 > &  pair) const
inline

◆ operator<=()

bool operator<= ( const Pair< T1, T1 > &  pair) const
inline

◆ operator=()

Pair< T1, T2 > & operator= ( const Pair< T1, T2 > &  pair)
inline

Assignment overload for pairs.

Parameters
pairPair to assign.
Returns
Current pair.

◆ operator==()

bool operator== ( const Pair< T1, T2 > &  pair) const
inline

◆ operator>()

bool operator> ( const Pair< T1, T1 > &  pair) const
inline

◆ operator>=()

bool operator>= ( const Pair< T1, T1 > &  pair) const
inline

Member Data Documentation

◆ fst

◆ snd


The documentation for this class was generated from the following files:
elm::let
RefPair< T1, T2 > let(T1 &v1, T2 &v2)
Definition: Pair.h:65