rcolyer.net
RC Lib  Version 202403231100
Public Member Functions | List of all members
RC::Tuple< Types > Class Template Reference

An efficient Tuple class with Set, Get, and an Apply function to pass the tuple contents on to any function. More...

#include <Tuple.h>

Inheritance diagram for RC::Tuple< Types >:

Public Member Functions

 Tuple ()
 Default constructor, elements use default constructors.
 
template<int ResolveAmbiguity = 0>
 Tuple (const typename std::add_lvalue_reference< typename std::remove_reference< Types >::type >::type... types)
 Construct by const reference.
 
template<bool ResolveAmbiguity = 0>
 Tuple (typename std::add_rvalue_reference< typename std::remove_reference< Types >::type >::type... types)
 Construct by moving elements in.
 
std::tuple< Types... > GetStdTuple ()
 Returns a std::tuple of the same contents.
 
template<size_t N>
auto Get () -> decltype(this->GetHelper< N >(*this))
 Return element N in the Tuple.
 
template<size_t N>
auto Get () const -> decltype(this->GetHelper< N >(*this))
 Return element N in the Tuple.
 
template<size_t N, class Val >
void Set (Val val)
 Set element N in the Tuple.
 
template<class Func >
auto Apply (Func f) -> decltype(this->ApplyHelper(f,(typename SequenceGenerator< sizeof...(Types)>::Sequence())))
 Call function f with each element of the Tuple as an argument. More...
 
template<class T >
Data1D< T > AsData () const
 Return a Data1D array with each element constructed as type T.
 
void Get (Types &... types)
 Get all elements at once, by reference.
 
template<class... OtherTypes>
Tuple< Types..., OtherTypes... > operator+ (Tuple< OtherTypes... > &other)
 Forms a new Tuple by concatenating two Tuples.
 

Detailed Description

template<class... Types>
class RC::Tuple< Types >

An efficient Tuple class with Set, Get, and an Apply function to pass the tuple contents on to any function.

Member Function Documentation

◆ Apply()

template<class... Types>
template<class Func >
auto RC::Tuple< Types >::Apply ( Func  f) -> decltype(this->ApplyHelper(f, (typename SequenceGenerator<sizeof...(Types)>::Sequence())))
inline

Call function f with each element of the Tuple as an argument.

Returns
The return value of function f for the given arguments.

The documentation for this class was generated from the following file:
email address
— (c) 2015