Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::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
 

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

template<class T1, class T2>
elm::Pair< T1, T2 >::Pair ( void  )

Build a pair with uninitialized content.

template<class T1, class T2>
elm::Pair< T1, T2 >::Pair ( const T1 &  _fst,
const T2 &  _snd 
)

Build a pair from two values.

Parameters
_fstFirst value.
_sndSecond value.
template<class T1, class T2>
elm::Pair< T1, T2 >::Pair ( const Pair< T1, T2 > &  pair)

Build a pair by copying another pair.

Parameters
pairPair to copy.

Member Function Documentation

template<class T1, class T2>
Pair< T1, T2 > & elm::Pair< T1, T2 >::operator= ( const Pair< T1, T2 > &  pair)

Assignment overload for pairs.

Parameters
pairPair to assign.
Returns
Current pair.
template<class T1, class T2>
bool elm::Pair< T1, T2 >::operator== ( const Pair< T1, T2 > &  pair) const

Member Data Documentation


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