3.0.0
Freundlich's C++ toolkit
Public Types | Public Member Functions | Public Attributes
fcppt::homogenous_pair< T > Class Template Reference

Detailed Description

template<typename T>
class fcppt::homogenous_pair< T >

A pair like std::pair with both elements of the same type.

A homogenous pair of type T is like an std::pair<T,T>. A short example:

#include <fcppt/homogenous_pair.hpp>
#include <fcppt/text.hpp>
#include <fcppt/io/cout.hpp>
int main()
{
int
> int_pair;
int_pair test1(
5,
10
);
test1.first = 42;
<< test1
<< FCPPT_TEXT('\n');
}
Template Parameters
TCan be any type

Public Types

typedef T value_type
 The value type. More...
 
typedef T first_type
 
typedef T second_type
 

Public Member Functions

 homogenous_pair (value_type const &first, value_type const &second)
 Initializes a pair. More...
 
 homogenous_pair (value_type &&first, value_type &&second)
 Initializes a pair by moving. More...
 
void swap (homogenous_pair &other)
 Swaps two pairs. More...
 

Public Attributes

value_type first
 The first element. More...
 
value_type second
 The second element. More...
 

Member Typedef Documentation

◆ first_type

template<typename T>
typedef T fcppt::homogenous_pair< T >::first_type

◆ second_type

template<typename T>
typedef T fcppt::homogenous_pair< T >::second_type

◆ value_type

template<typename T>
typedef T fcppt::homogenous_pair< T >::value_type

The value type.

Constructor & Destructor Documentation

◆ homogenous_pair() [1/2]

template<typename T>
fcppt::homogenous_pair< T >::homogenous_pair ( value_type const &  first,
value_type const &  second 
)

Initializes a pair.

Initializes the pair with the values provided by first and second.

Parameters
firstThe value for the first member
secondThe value for the second member

◆ homogenous_pair() [2/2]

template<typename T>
fcppt::homogenous_pair< T >::homogenous_pair ( value_type &&  first,
value_type &&  second 
)

Initializes a pair by moving.

Member Function Documentation

◆ swap()

template<typename T>
void fcppt::homogenous_pair< T >::swap ( homogenous_pair< T > &  other)

Swaps two pairs.

Swaps this pair with other. Swaps this->first with other.first and this->second with other.second.

Parameters
otherThe pair to swap with

Member Data Documentation

◆ first

template<typename T>
value_type fcppt::homogenous_pair< T >::first

The first element.

◆ second

template<typename T>
value_type fcppt::homogenous_pair< T >::second

The second element.