All Classes Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
gears::utility::triple< T, U, V > Struct Template Reference

Implements a three-element tuple. More...

Public Types

using first_type = T
 
using second_type = U
 
using third_type = V
 

Public Member Functions

void swap (triple &t) noexcept(noexcept(std::swap(first, t.first))&&noexcept(std::swap(second, t.second))&&noexcept(std::swap(third, t.third)))
 Swaps the three elements of the triple. More...
 

Public Attributes

first
 
second
 
third
 

Related Functions

(Note that these are not member functions.)

template<typename T , typename U , typename V >
constexpr bool operator== (const triple< T, U, V > &lhs, const triple< T, U, V > &rhs)
 Checks if two triple objects are equivalent. More...
 
template<typename T , typename U , typename V >
constexpr bool operator< (const triple< T, U, V > &lhs, const triple< T, U, V > &rhs)
 Checks if two triple objects are lexicographically less than each other. More...
 
template<typename T , typename U , typename V >
constexpr bool operator!= (const triple< T, U, V > &lhs, const triple< T, U, V > &rhs)
 Checks if two triple objects are not equivalent. More...
 
template<typename T , typename U , typename V >
constexpr bool operator> (const triple< T, U, V > &lhs, const triple< T, U, V > &rhs)
 Checks if two triple objects are lexicographically greater than each other. More...
 
template<typename T , typename U , typename V >
constexpr bool operator>= (const triple< T, U, V > &lhs, const triple< T, U, V > &rhs)
 Compares both triple objects to see if they're greater than or equal to each other. More...
 
template<typename T , typename U , typename V >
constexpr bool operator<= (const triple< T, U, V > &lhs, const triple< T, U, V > &rhs)
 Compares both triple objects to see if they're less than or equal to each other. More...
 
template<typename T , typename U , typename V >
void swap (triple< T, U, V > &lhs, triple< T, U, V > &rhs) noexcept(noexcept(lhs.swap(rhs)))
 Swaps the elements of the triple objects. More...
 
template<typename T , typename U , typename V >
constexpr triple< meta::Decay
< T >, meta::Decay< U >
, meta::Decay< V > > 
make_triple (T &&t, U &&u, V &&v)
 Creates a triple object. More...
 

Detailed Description

template<typename T, typename U, typename V>
struct gears::utility::triple< T, U, V >

Implements a three-element tuple. This class has std::get, std::tuple_element, and std::tuple_size defined for generic usage. For example:

constexpr utility::triple<int, int, int> x = { 1, 2, 3 };
static_assert(std::is_same<std::tuple_element<0, decltype(x)>::value, "...");
static_assert(std::get<0>(x) == 1, "...");
static_assert(std::tuple_size<decltype(x)>::value == 3, "...");

triple is also an aggregate, so it could be created using curly bracket syntax.

constexpr utility::triple<int, char, double> x = { 10, 'a', 12.0 };
Template Parameters
TFirst type of the triple.
USecond type of the triple.
VThird type of the triple.

Definition at line 55 of file triple.hpp.

Member Function Documentation

template<typename T, typename U, typename V>
void gears::utility::triple< T, U, V >::swap ( triple< T, U, V > &  t)
inlinenoexcept

Swaps the three elements of the triple.

Parameters
tOther triple to swap with

Definition at line 70 of file triple.hpp.

Friends And Related Function Documentation

template<typename T , typename U , typename V >
constexpr triple< meta::Decay< T >, meta::Decay< U >, meta::Decay< V > > make_triple ( T &&  t,
U &&  u,
V &&  v 
)
related

Creates a triple object. The template parameters are passed through std::decay for storage purposes. THis function is useful for auto purposes, e.g.

auto t = utility::make_triple(10, 'a', 1.f);
// decltype(t) == utility::triple<int, char, float>
Parameters
tFirst element of the triple.
uSecond element of the triple.
vThird element of the triple.
Returns
A triple containing the three elements provided.

Definition at line 204 of file triple.hpp.

template<typename T , typename U , typename V >
constexpr bool operator!= ( const triple< T, U, V > &  lhs,
const triple< T, U, V > &  rhs 
)
related

Checks if two triple objects are not equivalent. This is the negation of operator==.

Parameters
lhsLeft hand side of the expression.
rhsRight hand side of the expression.
Returns
true if they're not equal, false otherwise.

Definition at line 125 of file triple.hpp.

template<typename T , typename U , typename V >
constexpr bool operator< ( const triple< T, U, V > &  lhs,
const triple< T, U, V > &  rhs 
)
related

Checks if two triple objects are lexicographically less than each other.

Parameters
lhsLeft hand side of the expression.
rhsRight hand side of the expression.
Returns
true if lhs is lexicographically less than rhs, false otherwise.

Definition at line 106 of file triple.hpp.

template<typename T , typename U , typename V >
constexpr bool operator<= ( const triple< T, U, V > &  lhs,
const triple< T, U, V > &  rhs 
)
related

Checks if two triple objects are lexicographically less than or equal to each other.

Parameters
lhsLeft hand side of the expression.
rhsRight hand side of the expression.
Returns
true if lhs is lexicographically less than or equal to rhs, false otherwise.

Definition at line 169 of file triple.hpp.

template<typename T , typename U , typename V >
constexpr bool operator== ( const triple< T, U, V > &  lhs,
const triple< T, U, V > &  rhs 
)
related

Checks if two triple objects are equivalent. In order for it to reach equivalence all members must be equal to each other.

Parameters
lhsLeft hand side of the expression.
rhsRight hand side of the expression.
Returns
true if both are equal, false otherwise.

Definition at line 92 of file triple.hpp.

template<typename T , typename U , typename V >
constexpr bool operator> ( const triple< T, U, V > &  lhs,
const triple< T, U, V > &  rhs 
)
related

Checks if two triple objects are lexicographically greater than each other.

Parameters
lhsLeft hand side of the expression.
rhsRight hand side of the expression.
Returns
true if lhs is lexicographically greater than rhs, false otherwise.

Definition at line 139 of file triple.hpp.

template<typename T , typename U , typename V >
constexpr bool operator>= ( const triple< T, U, V > &  lhs,
const triple< T, U, V > &  rhs 
)
related

Checks if two triple objects are lexicographically greater than or equal to each other.

Parameters
lhsLeft hand side of the expression.
rhsRight hand side of the expression.
Returns
true if lhs is lexicographically greater than or equal to rhs, false otherwise.

Definition at line 154 of file triple.hpp.

template<typename T , typename U , typename V >
void swap ( triple< T, U, V > &  lhs,
triple< T, U, V > &  rhs 
)
related

Swaps the elements of the triple objects.

Parameters
lhsLeft hand side to swap with.
rhsRight hand side to swap with.

Definition at line 182 of file triple.hpp.