ORIGINAL
Loading...
Searching...
No Matches
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 (const TYPES &... e)
 Constructs a tuple with given elements.
 
 tuple (const tuple &other)
 Copy constructor.
 
tupleoperator= (const tuple &other)
 Copy assignment operator.
 
 tuple (tuple &&other) noexcept
 Move constructor.
 
tupleoperator= (tuple &&other) noexcept
 Move assignment operator.
 
template<u_integer IDX>
const auto & get () const
 Access element by index (const lvalue-reference version)
 
template<u_integer IDX>
auto & get ()
 Access element by index (non const lvalue-reference version)
 
template<u_integer IDX, typename E>
tupleset (const E &e)
 Set (modify) the value of the element at the specified index.
 
template<u_integer BEGIN_IDX, u_integer N_ELEMS>
auto slice () const
 Slice the tuple from a specific index.
 
integer compareTo (const tuple &other) const override
 Compare two tuples lexicographically.
 
std::string toString (bool enter) const override
 Generate formatted string representation.
 
std::string className () const override
 Get class name identifier.
 
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, std::integer_sequence< u_integer, T_SIZE... >, std::integer_sequence< u_integer, O_SIZE... >) const
 
template<original::u_integer IDX, typename E>
original::tuple< TYPES... > & set (const E &e)
 
- 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 char * toCString (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 constexpr u_integer size ()
 Get the number of elements in the tuple.
 
- Static Public Member Functions inherited from original::printable
template<typename TYPE>
static std::string formatString (const TYPE &t)
 Universal value-to-string conversion.
 
template<typename TYPE>
static std::string formatString (TYPE *const &ptr)
 Pointer-specific formatting.
 
template<typename TYPE>
static const char * formatCString (const TYPE &t)
 C-string cache for temporary usage.
 
template<typename TYPE>
static std::string formatEnum (const TYPE &t)
 Enum formatting utility.
 
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_TYPE > makeTuple (const couple< F_TYPE, S_TYPE > &cp)
 Create a tuple from a couple.
 
template<typename... L_TYPES, typename... R_TYPES>
tuple< L_TYPES..., R_TYPES... > operator+ (const tuple< L_TYPES... > &lt, const tuple< R_TYPES... > &rt)
 Concatenate two tuples (friend function)
 

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:

  • Compile-time fixed size container
  • Element access via index (compile-time checked)
  • Element modification via index
  • Deep copy/move operations
  • Lexicographical comparison
  • String serialization through printable interface
  • Comparable interface implementation
  • Structured binding support via std::tuple_size and std::tuple_element specializations
  • Tuple concatenation and slicing operations
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

Constructor & Destructor Documentation

◆ tuple() [1/3]

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

Constructs a tuple with given elements.

Parameters
eElements to initialize the tuple with

◆ tuple() [2/3]

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

Copy constructor.

Parameters
otherTuple to copy from

◆ tuple() [3/3]

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

Move constructor.

Parameters
otherTuple to move from

Member Function Documentation

◆ className()

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

Get class name identifier.

Returns
"tuple" string literal

Reimplemented from original::printable.

Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

◆ compareTo()

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

Compare two tuples lexicographically.

Parameters
otherTuple to compare with
Returns
Comparison result:
  • Negative if this tuple is smaller
  • Positive if this tuple is larger
  • Zero if tuples are equal

Comparison rules:

  1. Compares elements pairwise from first to last
  2. Stops at first unequal element pair
  3. Elements must be comparable using < operator
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

◆ get() [1/2]

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

Access element by index (non const lvalue-reference version)

Template Parameters
IDXZero-based index of the element
Returns
Lvalue-reference to the element at the specified index
Warning
The return type is a reference, which affects structured bindings if used directly in tuple_element. Use value type in tuple_element to avoid type deduction issues.

◆ get() [2/2]

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

Access element by index (const lvalue-reference version)

Template Parameters
IDXZero-based index of the element
Returns
Const lvalue-reference to the element at the specified index
Warning
The return type is a reference, which affects structured bindings if used directly in tuple_element. Use value type in tuple_element to avoid type deduction issues.
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/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.

Parameters
otherTuple to copy from
Returns
Reference to this tuple
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/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.

Parameters
otherTuple to move from
Returns
Reference to this tuple

◆ set()

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

Set (modify) the value of the element at the specified index.

Template Parameters
IDXIndex of the element to modify (zero-based)
EType of the new value (auto-deduced)
Parameters
eValue to assign to the element at position IDX
Returns
Reference to the current tuple instance (for chaining)
Note
This method uses a static check to ensure type safety: the value e must be convertible to the element type T at index IDX.
Invoking this method on a const tuple is not allowed.
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

◆ size()

template<typename... TYPES>
original::u_integer original::tuple< TYPES >::size ( )
staticconstexpr

Get the number of elements in the tuple.

Returns
The size of the tuple (number of elements)
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/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

Slice the tuple from a specific index.

Template Parameters
BEGIN_IDXThe starting index for slicing
N_ELEMSThe number of elements to slice
Returns
A new tuple with the sliced elements
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

◆ toString()

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

Generate formatted string representation.

Parameters
enterWhether to add newline (implementation specific)
Returns
String in format "tuple(element1, element2, ...)"

Reimplemented from original::printable.

Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

Friends And Related Symbol Documentation

◆ makeTuple

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

Create a tuple from a couple.

Template Parameters
F_TYPEType of the first element
S_TYPEType of the second element
Parameters
cpThe couple to convert
Returns
A new tuple with the couple's elements
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

◆ operator+

template<typename... TYPES>
template<typename... L_TYPES, typename... R_TYPES>
tuple< L_TYPES..., R_TYPES... > operator+ ( const tuple< L_TYPES... > & lt,
const tuple< R_TYPES... > & rt )
friend

Concatenate two tuples (friend function)

Template Parameters
L_TYPESTypes of the left tuple's elements
R_TYPESTypes of the right tuple's elements
Parameters
ltThe left tuple
rtThe right tuple
Returns
A new tuple combining elements from both tuples
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

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