Evo C++ Library v0.5.1
Public Types | Public Member Functions | Public Attributes | List of all members
Pair< TA, TB > Struct Template Reference

#include <evo/pair.h>

Detailed Description

template<class TA, class TB>
struct evo::Pair< TA, TB >

Stores a key/value pair of independent objects or values.

C++11:

Template Parameters
TAFirst (key) type
TBSecond (value) type

Public Types

typedef TA A
 First value type (same as Key) More...
 
typedef TB B
 Second value type (same as Value) More...
 
typedef TA First
 First value type (same as Key) More...
 
typedef TA Key
 Pair key type (same as A) More...
 
typedef TB Second
 Second value type (same as Value) More...
 
typedef Pair< TA, TB > This
 This type. More...
 
typedef TB Value
 Pair value type (same as B) More...
 

Public Member Functions

 Pair ()
 Constructor. More...
 
 Pair (const TA &a)
 Constructor. More...
 
 Pair (const TA &a, const TB &b)
 Constructor. More...
 
 Pair (const This &src)
 Copy constructor. More...
 
 Pair (This &&src)
 Move constructor (C++11). More...
 
const Aa () const
 Get first value (const). More...
 
Aa ()
 Get first value. More...
 
const Bb () const
 Get second value (const). More...
 
Bb ()
 Get second value. More...
 
int compare (const This &src) const
 Compare with another instance. More...
 
ulong hash (ulong seed=0) const
 Get hash value for both values in pair. More...
 
const Keykey () const
 Get key for pair (first value) (const). More...
 
Keykey ()
 Get key for pair (first value). More...
 
bool operator!= (const This &src) const
 Compare for inequality. More...
 
bool operator< (const This &src) const
 Compare whether less than given pair. More...
 
bool operator<= (const This &src) const
 Compare whether less than or equal to given pair. More...
 
Thisoperator= (const This &src)
 Assignment operator. More...
 
Thisoperator= (This &&src)
 Move assignment operator (C++11). More...
 
bool operator== (const This &src) const
 Compare for equality. More...
 
bool operator> (const This &src) const
 Compare whether greater than given pair. More...
 
bool operator>= (const This &src) const
 Compare whether greater than or equal to given pair. More...
 
const Valuevalue () const
 Get value for pair (second value) (const). More...
 
Valuevalue ()
 Get value for pair (second value). More...
 

Public Attributes

TA first
 First value (same as a() and key()) More...
 
TB second
 Second value (same as b() and value()) More...
 

Member Typedef Documentation

◆ A

typedef TA A

First value type (same as Key)

◆ B

typedef TB B

Second value type (same as Value)

◆ First

typedef TA First

First value type (same as Key)

◆ Key

typedef TA Key

Pair key type (same as A)

◆ Second

typedef TB Second

Second value type (same as Value)

◆ This

typedef Pair<TA, TB> This

This type.

◆ Value

typedef TB Value

Pair value type (same as B)

Constructor & Destructor Documentation

◆ Pair() [1/5]

Pair ( )
inline

Constructor.

◆ Pair() [2/5]

Pair ( const TA &  a)
inline

Constructor.

Parameters
aFirst value (pair key)

◆ Pair() [3/5]

Pair ( const TA &  a,
const TB &  b 
)
inline

Constructor.

Parameters
aFirst value (pair key)
bSecond value (pair value)

◆ Pair() [4/5]

Pair ( const This src)
inline

Copy constructor.

Parameters
srcPair to copy

◆ Pair() [5/5]

Pair ( This &&  src)
inline

Move constructor (C++11).

Parameters
srcSource to move

Member Function Documentation

◆ a() [1/2]

const A& a ( ) const
inline

Get first value (const).

Returns
First value

◆ a() [2/2]

A& a ( )
inline

Get first value.

Returns
First value

◆ b() [1/2]

const B& b ( ) const
inline

Get second value (const).

Returns
Second value

◆ b() [2/2]

B& b ( )
inline

Get second value.

Returns
Second value

◆ compare()

int compare ( const This src) const
inline

Compare with another instance.

  • Values are compared in order as a group: This first compares a, and if a is equal then compares b for final result
Parameters
srcPair to compare to
Returns
Result (<0 if this is less, 0 if equal, >0 if this is greater)

◆ hash()

ulong hash ( ulong  seed = 0) const
inline

Get hash value for both values in pair.

Parameters
seedSeed value for hashing multiple values, 0 if none
Returns
Hash value

◆ key() [1/2]

const Key& key ( ) const
inline

Get key for pair (first value) (const).

Returns
First value

◆ key() [2/2]

Key& key ( )
inline

Get key for pair (first value).

Returns
First value

◆ operator!=()

bool operator!= ( const This src) const
inline

Compare for inequality.

  • Values are compared as a group: They are inequal if either a or b don't match
Parameters
srcPair to compare to
Returns
Whether not equal

◆ operator<()

bool operator< ( const This src) const
inline

Compare whether less than given pair.

  • Values are compared in order as a group: This first compares a, and if a is equal then compares b for final result
Parameters
srcPair to compare to
Returns
Whether less than src

◆ operator<=()

bool operator<= ( const This src) const
inline

Compare whether less than or equal to given pair.

  • Values are compared in order as a group: This first compares a, and if a is equal then compares b for final result
Parameters
srcPair to compare to
Returns
Whether less than or equal to src

◆ operator=() [1/2]

This& operator= ( const This src)
inline

Assignment operator.

Parameters
srcPair to copy
Returns
This

◆ operator=() [2/2]

This& operator= ( This &&  src)
inline

Move assignment operator (C++11).

Parameters
srcSource to move
Returns
This

◆ operator==()

bool operator== ( const This src) const
inline

Compare for equality.

  • Values are compared as a group: They are equal if a and b match with src
Parameters
srcPair to compare to
Returns
Whether equal

◆ operator>()

bool operator> ( const This src) const
inline

Compare whether greater than given pair.

  • Values are compared in order as a group: This first compares a, and if a is equal then compares b for final result
Parameters
srcPair to compare to
Returns
Whether greater than src

◆ operator>=()

bool operator>= ( const This src) const
inline

Compare whether greater than or equal to given pair.

  • Values are compared in order as a group: This first compares a, if a is equal then compares b instead
    Parameters
    srcPair to compare to
    Returns
    Whether greater than or equal to src

◆ value() [1/2]

const Value& value ( ) const
inline

Get value for pair (second value) (const).

Returns
Second value

◆ value() [2/2]

Value& value ( )
inline

Get value for pair (second value).

Returns
Second value

Member Data Documentation

◆ first

TA first

First value (same as a() and key())

◆ second

TB second

Second value (same as b() and value())


The documentation for this struct was generated from the following file: