File triple.hpp

template<typename T>
struct Triple
#include <triple.hpp>

A triple that consists of three values of the same type.

Template Parameters:

T – The type of the values

Public Functions

inline Triple()
inline Triple(T first, T second, T third)
Parameters:
  • first – The first value

  • second – The second value

  • third – The third value

inline Triple<T> &operator=(const T &rhs)

Assigns a specific value to the first, second and third value of this triple.

Parameters:

rhs – A reference to the value to be assigned

Returns:

A reference to the modified triple

inline Triple<T> &operator+=(const T &rhs)

Adds a specific value to the first, second and third value of this triple.

Parameters:

rhs – A reference to the value to be added

Returns:

A reference to the modified triple

inline Triple<T> &operator+=(const Triple<T> &rhs)

Adds the first, second and third value of a given triple to the first, second and third value of this triple, respectively,

Parameters:

rhs – A reference to the triple, whose first, second and third value should be added

Returns:

A reference to the modified triple

inline Triple<T> &operator-=(const T &rhs)

Subtracts a specific value from the first, second and third value of this triple.

Parameters:

rhs – A reference to the value to be subtracted

Returns:

A reference to the modified triple

inline Triple<T> &operator-=(const Triple<T> &rhs)

Subtracts the first, second and third value of a given triple from the first, second and third value of this triple, respectively.

Parameters:

rhs – A reference to the triple, whose first, second and third value should be subtracted

Returns:

A reference to the modified triple

inline Triple<T> &operator*=(const T &rhs)

Multiplies the first, second and third value of this triple with a specific value.

Parameters:

rhs – A reference to the value to be multiplied by

Returns:

A reference to the modified triple

Public Members

T first

The first value.

T second

The second value.

T third

The third value.

Friends

inline friend Triple<T> operator+(Triple<T> lhs, const T &rhs)

Creates and returns a new triple that results from adding a specific value to the first, second and third value of an existing triple.

Parameters:
  • lhs – The original triple

  • rhs – A reference to the value to be added

Returns:

The triple that has been created

inline friend Triple<T> operator+(Triple<T> lhs, const Triple<T> &rhs)

Creates and returns a new triple that results from adding the first, second and third value of a specific triple to the first, second and third value of an existing triple, respectively.

Parameters:
  • lhs – The original triple

  • rhs – A reference to the triple, whose first, second and third value should be added

Returns:

The triple that has been created

inline friend Triple<T> operator-(Triple<T> lhs, const T &rhs)

Creates and returns a new triple that results from subtracting a specific value from the first, second and third value of an existing triple, respectively.

Parameters:
  • lhs – The original triple

  • rhs – A reference to the value to be subtracted

Returns:

The triple that has been created

inline friend Triple<T> operator-(Triple<T> lhs, const Triple<T> &rhs)

Creates and returns a new triple that results from subtracting the first, second and third value of a specific triple from the first, second and third value of an existing triple, respectively.

Parameters:
  • lhs – The original triple

  • rhs – A reference to the value to be subtracted

Returns:

The triple that has been created

inline friend Triple<T> operator*(Triple<T> lhs, const T &rhs)

Creates and returns a new triple that results from multiplying the first, second and third value of an existing triple with a specific value.

Parameters:
  • lhs – The original triple

  • rhs – A reference to the value to be multiplied by

Returns:

The triple that has been created