ORIGINAL
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
original::tuple< TYPES > Class Template Referencefinal

Container for multiple heterogeneous elements. More...

#include <tuple.h>

Inheritance diagram for original::tuple< TYPES >:
Inheritance graph
Collaboration diagram for original::tuple< TYPES >:
Collaboration graph

Public Member Functions

 tuple (TYPES &&... e)
 Constructs a tuple with the given elements.
 
 tuple (const tuple &other)
 Copy constructor - creates a deep copy of another tuple.
 
tupleoperator= (const tuple &other)
 Copy assignment operator - assigns contents from another tuple.
 
 tuple (tuple &&other) noexcept
 Move constructor - transfers ownership from another tuple.
 
tupleoperator= (tuple &&other) noexcept
 Move assignment operator - transfers ownership from another tuple.
 
void swap (tuple &other) noexcept
 Swaps contents with another tuple.
 
template<u_integer IDX>
const autoget () const
 Gets the element at the specified index (const version)
 
template<u_integer IDX>
autoget ()
 Gets the element at the specified index (non-const version)
 
template<u_integer IDX, typename E >
tupleset (const E &e)
 Sets the element at the specified index.
 
template<u_integer BEGIN_IDX, u_integer N_ELEMS>
auto slice () const
 Extracts a sub-tuple from this tuple.
 
integer compareTo (const tuple &other) const override
 
std::string toString (bool enter) const override
 Converts the tuple to a human-readable string representation.
 
std::string className () const override
 Returns the class name identifier for this tuple type.
 
template<typename... O_TYPES>
tuple< TYPES..., O_TYPES... > operator+ (const tuple< O_TYPES... > &other) const
 Concatenates this tuple with another tuple.
 
template<typename... O_TYPES, original::u_integer... T_SIZE, original::u_integer... O_SIZE>
original::tuple< TYPES..., O_TYPES... > _concat (const tuple< O_TYPES... > &other, indexSequence< T_SIZE... >, indexSequence< O_SIZE... >) const
 
template<original::u_integer IDX, typename E >
original::tuple< TYPES... > & set (const E &e)
 
template<typename ... O_TYPES>
original::tuple< TYPES..., O_TYPES... > operator+ (const tuple< O_TYPES... > &other) const
 
- Public Member Functions inherited from original::printable
 operator std::string () const
 Explicit conversion to std::string.
 
 operator const char * () const
 Explicit conversion to C-style string.
 
const chartoCString (bool enter) const
 Direct C-string access with formatting control.
 
template<typename TYPE >
auto formatString (const TYPE &t) -> std::string
 
template<typename TYPE >
auto formatCString (const TYPE &t) -> const char *
 
template<typename TYPE >
auto formatEnum (const TYPE &t) -> std::string
 
template<typename TYPE >
auto formatString (TYPE *const &ptr) -> std::string
 
- Public Member Functions inherited from original::comparable< tuple< TYPES... > >
virtual integer compareTo (const tuple< TYPES... > &other) const=0
 Compares the current object with another of the same type.
 
bool operator== (const tuple< TYPES... > &other) const
 Checks if the current object is equal to another.
 
bool operator!= (const tuple< TYPES... > &other) const
 Checks if the current object is not equal to another.
 
bool operator< (const tuple< TYPES... > &other) const
 Checks if the current object is less than another.
 
bool operator> (const tuple< TYPES... > &other) const
 Checks if the current object is greater than another.
 
bool operator<= (const tuple< TYPES... > &other) const
 Checks if the current object is less than or equal to another.
 
bool operator>= (const tuple< TYPES... > &other) const
 Checks if the current object is greater than or equal to another.
 
virtual ~comparable ()=default
 Virtual destructor for proper cleanup of derived objects.
 

Static Public Member Functions

static consteval u_integer size () noexcept
 
- Static Public Member Functions inherited from original::printable
template<typename TYPE >
static std::string formatString (const TYPE &t)
 Universal value-to-string conversion with type-specific formatting.
 
template<Printable TYPE>
static std::string formatString (const TYPE &t)
 Specialization for types deriving from printable.
 
template<EnumType TYPE>
static std::string formatString (const TYPE &t)
 Specialization for enum types with type-safe formatting.
 
template<typename TYPE >
static std::string formatString (TYPE *const &ptr)
 Pointer-specific formatting with null safety.
 
template<typename TYPE >
static const charformatCString (const TYPE &t)
 C-string cache for temporary usage with static storage.
 
template<typename TYPE >
static std::string formatEnum (const TYPE &t)
 Enum formatting utility with underlying value extraction.
 
template<>
auto formatString (const char &t) -> std::string
 
template<>
auto formatString (const bool &t) -> std::string
 
template<>
auto formatString (const char *const &ptr) -> std::string
 

Friends

template<typename F_TYPE , typename S_TYPE >
tuple< F_TYPE, S_TYPEmakeTuple (const couple< F_TYPE, S_TYPE > &cp)
 Creates a tuple from a couple (copy version)
 
template<typename F_TYPE , typename S_TYPE >
tuple< F_TYPE, S_TYPEmakeTuple (couple< F_TYPE, S_TYPE > &&cp)
 Creates a tuple from a couple (move version)
 

Detailed Description

template<typename... TYPES>
class original::tuple< TYPES >

Container for multiple heterogeneous elements.

Template Parameters
TYPESVariadic template parameter list of element types

Stores a sequence of elements with type safety. Provides:

Examples
/home/runner/work/original/original/src/core/tuple.h.

Constructor & Destructor Documentation

◆ tuple() [1/3]

template<typename ... TYPES>
original::tuple< TYPES >::tuple ( TYPES &&...  e)
explicit

Constructs a tuple with the given elements.

Parameters
eElements to store in the tuple
Note
Uses perfect forwarding to preserve value categories.

◆ tuple() [2/3]

template<typename... TYPES>
original::tuple< TYPES >::tuple ( const tuple< TYPES > &  other)

Copy constructor - creates a deep copy of another tuple.

Parameters
otherTuple to copy from
Note
Performs element-wise copy construction of all stored elements. Each element's copy constructor is invoked.

◆ tuple() [3/3]

template<typename... TYPES>
original::tuple< TYPES >::tuple ( tuple< TYPES > &&  other)
noexcept

Move constructor - transfers ownership from another tuple.

Parameters
otherTuple to move from
Note
Performs element-wise move construction of all stored elements. The source tuple is left in a valid but unspecified state. Each element's move constructor is invoked.
noexcept qualified for compatibility with STL containers.

Member Function Documentation

◆ className()

template<typename... TYPES>
std::string original::tuple< TYPES >::className ( ) const
overridevirtual

Returns the class name identifier for this tuple type.

Returns
String "tuple" representing the class name
Note
Used for runtime type identification and debugging. Consistent naming allows for predictable serialization formats. All tuple specializations return the same class name.
See also
toString() Uses this method to prefix the string representation.

Reimplemented from original::printable.

Examples
/home/runner/work/original/original/src/core/tuple.h.

◆ get() [1/2]

template<typename... TYPES>
template<original::u_integer IDX>
auto & original::tuple< TYPES >::get ( )

Gets the element at the specified index (non-const version)

Template Parameters
IDXIndex of the element to retrieve
Returns
Reference to the element at index IDX
Note
Compile-time bounds checking is performed.

◆ get() [2/2]

template<typename... TYPES>
template<original::u_integer IDX>
const auto & original::tuple< TYPES >::get ( ) const

Gets the element at the specified index (const version)

Template Parameters
IDXIndex of the element to retrieve
Returns
Const reference to the element at index IDX
Note
Compile-time bounds checking is performed.
Examples
/home/runner/work/original/original/src/core/tuple.h.

◆ operator+()

template<typename... TYPES>
template<typename... O_TYPES>
tuple< TYPES..., O_TYPES... > original::tuple< TYPES >::operator+ ( const tuple< O_TYPES... > &  other) const

Concatenates this tuple with another tuple.

Template Parameters
O_TYPESElement types of the other tuple
Parameters
otherTuple to concatenate with this one
Returns
A new tuple containing all elements from both tuples
Note
The resulting tuple has type tuple<TYPES..., O_TYPES...>
Examples
/home/runner/work/original/original/src/core/tuple.h.

◆ operator=() [1/2]

template<typename... TYPES>
original::tuple< TYPES... > & original::tuple< TYPES >::operator= ( const tuple< TYPES > &  other)

Copy assignment operator - assigns contents from another tuple.

Parameters
otherTuple to assign from
Returns
Reference to this tuple
Note
Performs element-wise copy assignment of all stored elements. Self-assignment check is performed for safety. Each element's copy assignment operator is invoked.
Examples
/home/runner/work/original/original/src/core/tuple.h.

◆ operator=() [2/2]

template<typename... TYPES>
original::tuple< TYPES... > & original::tuple< TYPES >::operator= ( tuple< TYPES > &&  other)
noexcept

Move assignment operator - transfers ownership from another tuple.

Parameters
otherTuple to move from
Returns
Reference to this tuple
Note
Performs element-wise move assignment of all stored elements. Self-assignment check is performed for safety. The source tuple is left in a valid but unspecified state. Each element's move assignment operator is invoked.
noexcept qualified for compatibility with STL containers.

◆ set()

template<typename... TYPES>
template<u_integer IDX, typename E >
tuple & original::tuple< TYPES >::set ( const E e)

Sets the element at the specified index.

Template Parameters
IDXIndex of the element to set
EType of the value to assign (must be convertible to target type)
Parameters
eValue to assign
Returns
Reference to this tuple for chaining
Note
Compile-time type conversion validation is performed.
Examples
/home/runner/work/original/original/src/core/tuple.h.

◆ slice()

template<typename... TYPES>
template<original::u_integer BEGIN_IDX, original::u_integer N_ELEMS>
auto original::tuple< TYPES >::slice ( ) const

Extracts a sub-tuple from this tuple.

Template Parameters
BEGIN_IDXStarting index of the slice
N_ELEMSNumber of elements to extract
Returns
A new tuple containing the specified slice of elements
Note
Compile-time bounds checking ensures the slice is valid.
Examples
/home/runner/work/original/original/src/core/tuple.h.

◆ swap()

template<typename ... TYPES>
void original::tuple< TYPES >::swap ( tuple< TYPES > &  other)
noexcept

Swaps contents with another tuple.

Parameters
otherTuple to swap with
Note
Performs element-wise swap of all stored elements. Self-swap check is performed (no-op if same object). Each element's swap operation or move semantics are used.
noexcept qualified for compatibility with STL algorithms.
More efficient than copy-and-swap for large tuples.
Examples
/home/runner/work/original/original/src/core/tuple.h.

◆ toString()

template<typename... TYPES>
std::string original::tuple< TYPES >::toString ( bool  enter) const
overridevirtual

Converts the tuple to a human-readable string representation.

Parameters
enterIf true, includes newlines for formatting (currently unused)
Returns
String representation of the tuple in format "tuple(elem1, elem2, ...)"
Note
Delegates to individual element's toString/formatString methods. The output format is consistent and parseable. Example: tuple(1, "hello", 3.14)
The enter parameter is provided for interface consistency but may be used in future versions for pretty-printing with indentation.

Reimplemented from original::printable.

Examples
/home/runner/work/original/original/src/core/tuple.h.

Friends And Related Symbol Documentation

◆ makeTuple [1/2]

template<typename... TYPES>
tuple< F_TYPE, S_TYPE > makeTuple ( const couple< F_TYPE, S_TYPE > &  cp)
friend

Creates a tuple from a couple (copy version)

Template Parameters
F_TYPEFirst element type
S_TYPESecond element type
Parameters
cpCouple to convert to tuple
Returns
A new tuple containing the couple's elements
Note
Elements are copy-constructed from the couple.
Examples
/home/runner/work/original/original/src/core/tuple.h.

◆ makeTuple [2/2]

template<typename... TYPES>
tuple< F_TYPE, S_TYPE > makeTuple ( couple< F_TYPE, S_TYPE > &&  cp)
friend

Creates a tuple from a couple (move version)

Template Parameters
F_TYPEFirst element type
S_TYPESecond element type
Parameters
cpCouple to convert to tuple
Returns
A new tuple containing the couple's elements
Note
Elements are move-constructed from the couple.

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