Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
TupleBase< S, N > Class Template Referenceabstract

#include <TupleBase.h>

Inheritance diagram for TupleBase< S, N >:
Inheritance graph
[legend]

Public Types

typedef TupleBase< S, N > tuplebase_t
 
typedef S value_type
 
typedef S * iterator
 
typedef S const * const_iterator
 

Public Member Functions

virtual const_iterator begin () const =0
 
virtual const_iterator end () const =0
 
virtual iterator begin ()=0
 
virtual iterator end ()=0
 
const S & at (size_t i) const
 Return const reference to element i. More...
 
const S & operator[] (size_t i) const
 
S & at (size_t i)
 Return reference to element i. More...
 
S & operator[] (size_t i)
 
bool operator== (const tuplebase_t &t) const
 Equality operator.
 
bool operator!= (const tuplebase_t &t) const
 Inequality operator.
 
template<class T >
T & toSequence (T &sequence) const
 Copy elements to a Sequence, like stl::list, stl::set or stl::vector.
 
void set (const tuplebase_t &t)
 
template<class T2 , size_t N2 = 2>
void set (const TupleBase< T2, N2 > &t)
 Assign tuple of different type and/or size.
 
void set (const S &arg)
 
template<typename ... SS>
void set (const S &arg, const SS &... rest)
 Set element(s).
 
template<typename T >
void set (std::initializer_list< T > l)
 
template<class T >
tuplebase_tassignSequence (T &sequence, bool LENIENT=false)
 Proposed for tuples only; derived classes should not shadow this. More...
 
void fill (S i)
 Set all the elements to i.
 
void clear ()
 
virtual std::ostream & toStream (std::ostream &ostr, char separator=',') const
 
std::string toStr (char separator=',') const
 
virtual void updateTuple ()
 

Static Public Member Functions

static size_t size ()
 Return the number of elements. More...
 

Static Public Attributes

static const size_t storageTypeSize = sizeof(S)
 

Protected Member Functions

void setIndexed (size_t i)
 Argument stack endpoint function; final step of variadic argument set(arg, ...) .
 
template<typename T2 , typename ... TT>
void setIndexed (size_t i, T2 arg, const TT &... rest)
 Worker called by set(T2 arg, T2 arg2, ...)
 

Detailed Description

template<typename S, size_t N = 2>
class drain::TupleBase< S, N >

Template Parameters
S- storage class of members (int, double, char)
N- number of the members included

Member Function Documentation

◆ assignSequence()

tuplebase_t& assignSequence ( T &  sequence,
bool  LENIENT = false 
)
inline

Proposed for tuples only; derived classes should not shadow this.

Copy elements from a Sequence, like stl::list, stl::set or stl::vector. If lenient, accepts sequences of different lengths, stopping at the shorter.

◆ at() [1/2]

S& at ( size_t  i)
inline

Return reference to element i.

Checks index overflow, but does not check if the actual members have been declared. Use in check() in derived constructors to ensure total size of the object.

◆ at() [2/2]

const S& at ( size_t  i) const
inline

Return const reference to element i.

Checks index overflow, but does not check if the actual members have been declared. Use in check() in derived constructors to ensure total size of the object.

◆ size()

static size_t size ( )
inlinestatic

Return the number of elements.

Can be static, as any object has the same size.

◆ toStream()

virtual std::ostream& toStream ( std::ostream &  ostr,
char  separator = ',' 
) const
inlinevirtual

Derived classes may change the layout.


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