Library of Assembled Shared Sources
lass::stde::triple< T1, T2, T3 > Class Template Reference

extension of std::pair to three values, trait three values as a single unit. More...

#include <triple.h>

Public Member Functions

 triple ()
 default constructor The default constructor creates a vlaue triple with triples that are initialized by the default constructor of their type.
 
 triple (typename util::CallTraits< T1 >::TParam a, typename util::CallTraits< T2 >::TParam b, typename util::CallTraits< T3 >::TParam c)
 constructor for three values
 
template<typename U1, typename U2, typename U3>
 triple (const triple< U1, U2, U3 > &other)
 copy constructor with implicit conversions This template version of the copy constructor provided here is ussed when implicit conversions are necessary.
 

Related Symbols

(Note that these are not member symbols.)

template<typename T1, typename T2, typename T3, typename U1, typename U2, typename U3>
bool operator== (const triple< T1, T2, T3 > &x, const triple< U1, U2, U3 > &y)
 two triples are identical if all elements (first, second, third) are identical.
 
template<typename T1, typename T2, typename T3, typename U1, typename U2, typename U3>
bool operator< (const triple< T1, T2, T3 > &x, const triple< U1, U2, U3 > &y)
 return true if x is "less" than y.
 
template<typename T1, typename T2, typename T3, typename U1, typename U2, typename U3>
bool operator!= (const triple< T1, T2, T3 > &x, const triple< U1, U2, U3 > &y)
 equivalent to !(x == y), see operator<
 
template<typename T1, typename T2, typename T3, typename U1, typename U2, typename U3>
bool operator> (const triple< T1, T2, T3 > &x, const triple< U1, U2, U3 > &y)
 equivalent to y < x, see operator<
 
template<typename T1, typename T2, typename T3, typename U1, typename U2, typename U3>
bool operator<= (const triple< T1, T2, T3 > &x, const triple< U1, U2, U3 > &y)
 equivalent to !(y < x), see operator<
 
template<typename T1, typename T2, typename T3, typename U1, typename U2, typename U3>
bool operator>= (const triple< T1, T2, T3 > &x, const triple< U1, U2, U3 > &y)
 equivalent to !(x < y), see operator<
 
template<typename T1, typename T2, typename T3>
triple< T1, T2, T3 > make_triple (const T1 &a, const T2 &b, const T3 &c)
 convenience function to create a lass::stde::triple.
 

Detailed Description

template<typename T1, typename T2, typename T3>
class lass::stde::triple< T1, T2, T3 >

extension of std::pair to three values, trait three values as a single unit.

Author
Bram de Greve [Bramz]

we'd like to refer to the C++ standard library for info on std::pair. triple is an extension of this to three values. As std::pair, triple is declared as a struct, the default constructor will initialize all elements with their default constructor, and implicit conversions between triples of different type are allowed, provided that the conversions between the element types are possible.

As for std::pair, the "less than" comparison is implemented for triple in a similar way. The first value has higher priority than the second and third, and the second value has higher priority than the third. Thus, if the first values of two pairs differ, the result of their comparison is used as the result of the comparison of the whole triples. If the first values are equal, the comparison of the second values yields the result if they differ. If the second values are equal too, the comparison of the third values finally yields the result.

Definition at line 72 of file triple.h.

Constructor & Destructor Documentation

◆ triple()

template<typename T1, typename T2, typename T3>
lass::stde::triple< T1, T2, T3 >::triple ( )

default constructor The default constructor creates a vlaue triple with triples that are initialized by the default constructor of their type.

Because of language rules, an explicit call of a default constructor also initializes fundamental data types such as int.

Definition at line 57 of file triple.inl.

Referenced by make_triple(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), and triple().

Friends And Related Symbol Documentation

◆ operator<()

template<typename T1, typename T2, typename T3, typename U1, typename U2, typename U3>
bool operator< ( const triple< T1, T2, T3 > & x,
const triple< U1, U2, U3 > & y )
related

return true if x is "less" than y.

As for std::pair, the "less than" comparison is implemented for Triples in a similar way. The first value has higher priority than the second and third, and the second value has higher priority than the third. Thus, if the first values of two pairs differ, the result of their comparison is used as the result of the comparison of the whole triples. If the first values are equal, the comparison of the second values yields the result if they differ. If the second values are equal too, the comparison of the third values finally yields the result.

Definition at line 125 of file triple.inl.

References triple().

◆ make_triple()

template<typename T1, typename T2, typename T3>
triple< T1, T2, T3 > make_triple ( const T1 & a,
const T2 & b,
const T3 & c )
related

convenience function to create a lass::stde::triple.

The make_triple template function enables you to create a value triple without writing the types explicitly. In particular the make_triple function makes it convenient to pass three values of a triple directly to a function that requires a triple as its argument. It works even when the types do not match exactly becuase the template copy constructor provides implicit type conversion.

using make_triple should cost no runtime. The compiler should always optimize any implied overhead.

Definition at line 193 of file triple.inl.

References triple().


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