#include <Corrade/Containers/Triple.h>
template<class F, class S, class T>
Triple class new in Git master
A tuple of three values.
Like Pair, but for three elements. Also a lightweight alternative to a threeelement std::constexpr
contexts even in C++11. On the other hand, to simplify both the implementation and usage semantics, the type doesn't support references — wrap them in a Reference in order to store them in a Triple. Such type composition allows you to both rebind the reference and update the referenced value and the intent is clear.
Similarly to other containers and equivalently to std::
auto a = Containers::Triple<float, int, bool>{35.0f, 7, true}; auto b = Containers::triple(35.0f, 7, true);
Similarly to a Pair, access to the triple elements is done using first(), second() and third() member functions, direct access to the members isn't provided. This is done in order to futureproof the design and have extra flexibility in how the internals are defined.
C++17 structured bindings
If Corrade/get<i>()
overloads are defined inside Triple itself, a separate header is used for the std::#include <utility>
on some STL implementations. Example:
#include <Corrade/Containers/StructuredBindings.h> … auto [first, second, third] = Containers::triple(42, false, 3.14f);
STL compatibility
Instances of Triple are implicitly copy and moveconvertible to and from a threeelement std::#include <tuple>
. Additionally, the triple(T&&) overload also allows for such a conversion. Example:
#include <Corrade/Containers/TripleStl.h> … std::tuple<float, int, bool> a{35.0f, 7, true}; Containers::Triple<float, int, bool> b{a}; std::tuple<bool, int*, bool> c(Containers::triple(false, &b.second(), true)); auto d = Containers::triple(std::tuple<char, double, bool>{'p', 3.14, true}); // d is Containers::triple<char, double, bool>
Public types
 using FirstType = F
 First type.
 using SecondType = S
 Second type.
 using ThirdType = T
 Second type.
Constructors, destructors, conversion operators

Triple(Corrade::
DefaultInitT ) explicit constexpr noexcept(…)  Construct a defaultinitialized triple.

Triple(Corrade::
ValueInitT ) explicit constexpr noexcept(…)  Construct a valueinitialized triple.

Triple(Corrade::
NoInitT ) explicit noexcept  Construct a triple without initializing its contents.
 Triple() constexpr noexcept(…)
 Default constructor.
 Triple(const F& first, const S& second, const T& third) constexpr noexcept(…)
 Constructor.
 Triple(const F& first, const S& second, T&& third) constexpr noexcept(…)
 Triple(const F& first, S&& second, const T& third) constexpr noexcept(…)
 Triple(F&& first, const S& second, const T& third) constexpr noexcept(…)
 Triple(const F& first, S&& second, T&& third) constexpr noexcept(…)
 Triple(F&& first, const S& second, T&& third) constexpr noexcept(…)
 Triple(F&& first, S&& second, const T& third) constexpr noexcept(…)
 Triple(F&& first, S&& second, T&& third) constexpr noexcept(…)

template<class OtherF, class OtherS, class OtherT, class = typename std::Triple(const Triple<OtherF, OtherS, OtherT>& other) explicit constexpr noexcept(…)
enable_if <std::is_constructible <F, const OtherF&>::value&& std::is_constructible <S, const OtherS&>::value&& std::is_constructible <T, const OtherT&>::value>::type>  Copyconstruct a triple from another of different type.

template<class OtherF, class OtherS, class OtherT, class = typename std::Triple(Triple<OtherF, OtherS, OtherT>&& other) explicit constexpr noexcept(…)
enable_if <std::is_constructible <F, OtherF && >::value&& std::is_constructible <S, OtherS && >::value&& std::is_constructible <T, OtherT && >::value>::type>  Moveconstruct a triple from another of different type.

template<class U, class = decltype(Implementation::TripleConverter<F, S, T, U>::from(std::Triple(const U& other) noexcept(…)
declval <const U&>()))>  Copyconstruct a triple from external representation.

template<class U, class = decltype(Implementation::TripleConverter<F, S, T, U>::from(std::Triple(U&& other) noexcept(…)
declval <U && >()))>  Moveconstruct a triple from external representation.

template<class U, class = decltype(Implementation::TripleConverter<F, S, T, U>::to(std::operator U() const &
declval <const Triple<F, S, T>&>()))>  Copyconvert the triple to external representation.

template<class U, class = decltype(Implementation::TripleConverter<F, S, T, U>::to(std::operator U() &&
declval <Triple<F, S, T> && >()))>  Moveconvert the triple to external representation.
Public functions
 auto operator==(const Triple<F, S, T>& other) const > bool constexpr
 Equality comparison.
 auto operator!=(const Triple<F, S, T>& other) const > bool constexpr
 Nonequality comparison.
 auto first() & > F&
 First element.
 auto first() && > F
 auto first() const & > const F& constexpr
 auto second() & > S&
 Second element.
 auto second() && > S
 auto second() const & > const S& constexpr
 auto third() & > T&
 Third element.
 auto third() && > T
 auto third() const & > const T& constexpr
Function documentation
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(Corrade::DefaultInitT ) explicit constexpr noexcept(…)
Construct a defaultinitialized triple.
Trivial types are not initialized, default constructor called otherwise. Because of the differing behavior for trivial types it's better to explicitly use either the Triple(ValueInitT) or the Triple(NoInitT) variant instead.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(Corrade::ValueInitT ) explicit constexpr noexcept(…)
Construct a valueinitialized triple.
Trivial types are zeroinitialized, default constructor called otherwise. This is the same as the default constructor.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(Corrade::NoInitT ) explicit noexcept
Construct a triple without initializing its contents.
Enabled only for trivial types and types that implement the NoInit constructor. The contents are not initialized. Useful if you will be overwriting both members later anyway or if you need to initialize in a way that's not expressible via any other Triple constructor.
For trivial types is equivalent to Triple(DefaultInitT).
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple() constexpr noexcept(…)
Default constructor.
Alias to Triple(ValueInitT).
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(const F& first,
const S& second,
const T& third) constexpr noexcept(…)
Constructor.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(const F& first,
const S& second,
T&& third) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(const F& first,
S&& second,
const T& third) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(F&& first,
const S& second,
const T& third) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(const F& first,
S&& second,
T&& third) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(F&& first,
const S& second,
T&& third) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(F&& first,
S&& second,
const T& third) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
Corrade::Containers::Triple<F, S, T>:: Triple(F&& first,
S&& second,
T&& third) constexpr noexcept(…)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
template<class U, class = decltype(Implementation::TripleConverter<F, S, T, U>::from(std::declval <const U&>()))>
Corrade::Containers::Triple<F, S, T>:: Triple(const U& other) noexcept(…)
Copyconstruct a triple from external representation.
template<class F, class S, class T>
template<class U, class = decltype(Implementation::TripleConverter<F, S, T, U>::from(std::declval <U && >()))>
Corrade::Containers::Triple<F, S, T>:: Triple(U&& other) noexcept(…)
Moveconstruct a triple from external representation.
template<class F, class S, class T>
template<class U, class = decltype(Implementation::TripleConverter<F, S, T, U>::to(std::declval <const Triple<F, S, T>&>()))>
Corrade::Containers::Triple<F, S, T>:: operator U() const &
Copyconvert the triple to external representation.
template<class F, class S, class T>
template<class U, class = decltype(Implementation::TripleConverter<F, S, T, U>::to(std::declval <Triple<F, S, T> && >()))>
Corrade::Containers::Triple<F, S, T>:: operator U() &&
Moveconvert the triple to external representation.
template<class F, class S, class T>
F Corrade::Containers::Triple<F, S, T>:: first() &&
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
const F& Corrade::Containers::Triple<F, S, T>:: first() const & constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
S Corrade::Containers::Triple<F, S, T>:: second() &&
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
const S& Corrade::Containers::Triple<F, S, T>:: second() const & constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
T Corrade::Containers::Triple<F, S, T>:: third() &&
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
const T& Corrade::Containers::Triple<F, S, T>:: third() const & constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class F, class S, class T>
template<class F, class S, class T>
Triple<typename std::decay <F>::type, typename std::decay <S>::type, typename std::decay <T>::type> triple(F&& first,
S&& second,
T&& third) constexpr
Make a triple.
Convernience alternative to Triple::
auto a = Containers::Triple<float, int, bool>{35.0f, 7, true}; auto b = Containers::triple(35.0f, 7, true);
template<class F, class S, class T>
template<class T>
auto triple(T&& other)
Make a triple from external representation.
template<class F, class S, class T>
template<class F, class S, class T>
Utility::Debug & operator<<(Utility::Debug & debug,
const Triple<F, S, T>& value)
Debug output operator.