ORIGINAL
Loading...
Searching...
No Matches
original::couple< F_TYPE, S_TYPE > Class Template Referencefinal

Container for two heterogeneous elements. More...

#include <couple.h>

Inheritance diagram for original::couple< F_TYPE, S_TYPE >:
Inheritance graph
Collaboration diagram for original::couple< F_TYPE, S_TYPE >:
Collaboration graph

Public Member Functions

 couple ()
 Default constructs both elements.
 
 couple (F_TYPE *first, S_TYPE *second)
 Constructs from pointer elements.
 
 couple (const F_TYPE &first, const S_TYPE &second)
 Constructs from element copies.
 
 couple (const couple &other)
 Copy constructor.
 
coupleoperator= (const couple &other)
 Copy assignment operator.
 
 couple (couple &&other) noexcept
 Move constructor.
 
coupleoperator= (couple &&other) noexcept
 Move assignment operator.
 
template<u_integer IDX>
auto & get ()
 Element access template method (non-const version)
 
template<u_integer IDX>
const auto & get () const
 Element access template method (const version)
 
template<u_integer IDX, typename T>
coupleset (const T &e)
 element modifies the template method
 
integer compareTo (const couple &other) const override
 Lexicographical comparison operation.
 
F_TYPE & first ()
 Access first element.
 
S_TYPE & second ()
 Access second element.
 
const F_TYPE & first () const
 Access first element (const version)
 
const S_TYPE & second () const
 Access second element (const version)
 
 ~couple () override
 Default destructor.
 
std::string className () const override
 Gets class name identifier.
 
std::string toString (bool enter) const override
 Formats pair elements as string.
 
template<original::u_integer IDX, typename T>
original::couple< F_TYPE, S_TYPE > & set (const T &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< couple< F_TYPE, S_TYPE > >
bool operator== (const couple< F_TYPE, S_TYPE > &other) const
 Checks if the current object is equal to another.
 
bool operator!= (const couple< F_TYPE, S_TYPE > &other) const
 Checks if the current object is not equal to another.
 
bool operator< (const couple< F_TYPE, S_TYPE > &other) const
 Checks if the current object is less than another.
 
bool operator> (const couple< F_TYPE, S_TYPE > &other) const
 Checks if the current object is greater than another.
 
bool operator<= (const couple< F_TYPE, S_TYPE > &other) const
 Checks if the current object is less than or equal to another.
 
bool operator>= (const couple< F_TYPE, S_TYPE > &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.
 

Additional Inherited Members

- 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
 

Detailed Description

template<typename F_TYPE, typename S_TYPE>
class original::couple< F_TYPE, S_TYPE >

Container for two heterogeneous elements.

Template Parameters
F_TYPEType of the first element
S_TYPEType of the second element

Stores a pair of elements with type safety. Provides:

  • Element access and copy operations
  • Move construction and assignment
  • Lexicographical comparison (first element precedence)
  • Formatted string output through printable interface
  • Comparable interface implementation
  • Structured binding support via std::tuple_size and std::tuple_element specializations
Examples
D:/FrozenLemonTee/Arbeit/PracticeProject/original/src/core/tuple.h.

Constructor & Destructor Documentation

◆ couple() [1/4]

template<typename F_TYPE, typename S_TYPE>
original::couple< F_TYPE, S_TYPE >::couple ( F_TYPE * first,
S_TYPE * second )

Constructs from pointer elements.

Parameters
firstPointer to first element
secondPointer to second element

◆ couple() [2/4]

template<typename F_TYPE, typename S_TYPE>
original::couple< F_TYPE, S_TYPE >::couple ( const F_TYPE & first,
const S_TYPE & second )

Constructs from element copies.

Parameters
firstFirst element to copy
secondSecond element to copy

◆ couple() [3/4]

template<typename F_TYPE, typename S_TYPE>
original::couple< F_TYPE, S_TYPE >::couple ( const couple< F_TYPE, S_TYPE > & other)

Copy constructor.

Parameters
othercouple to copy from

◆ couple() [4/4]

template<typename F_TYPE, typename S_TYPE>
original::couple< F_TYPE, S_TYPE >::couple ( couple< F_TYPE, S_TYPE > && other)
noexcept

Move constructor.

Parameters
othercouple to move from
Note
noexcept qualified for compatibility with STL containers

Member Function Documentation

◆ className()

template<typename F_TYPE, typename S_TYPE>
auto original::couple< F_TYPE, S_TYPE >::className ( ) const
nodiscardoverridevirtual

Gets class name identifier.

Returns
"couple" string constant

Reimplemented from original::printable.

◆ compareTo()

template<typename F_TYPE, typename S_TYPE>
auto original::couple< F_TYPE, S_TYPE >::compareTo ( const couple< F_TYPE, S_TYPE > & other) const
overridevirtual

Lexicographical comparison operation.

Parameters
othercouple to compare with
Returns
integer Negative if less, positive if greater, zero if equal

Compares first elements first, then second elements if firsts are equal

Implements original::comparable< couple< F_TYPE, S_TYPE > >.

◆ first() [1/2]

template<typename F_TYPE, typename S_TYPE>
auto original::couple< F_TYPE, S_TYPE >::first ( )

Access first element.

Returns
Mutable reference to first element

◆ first() [2/2]

template<typename F_TYPE, typename S_TYPE>
const F_TYPE & original::couple< F_TYPE, S_TYPE >::first ( ) const

Access first element (const version)

Returns
Mutable reference to first element

◆ get() [1/2]

template<typename F_TYPE, typename S_TYPE>
template<original::u_integer IDX>
auto & original::couple< F_TYPE, S_TYPE >::get ( )

Element access template method (non-const version)

Template Parameters
IDXelement index (0=1st element, 1=2nd element)
Returns
Reference to the corresponding element
Exceptions
outOfBoundErrorif IDX > 1
Note
For non-const objects, returns a mutable reference

◆ get() [2/2]

template<typename F_TYPE, typename S_TYPE>
template<original::u_integer IDX>
const auto & original::couple< F_TYPE, S_TYPE >::get ( ) const

Element access template method (const version)

Template Parameters
IDXelement index (0=1st element, 1=2nd element)
Returns
Const reference to the corresponding element
Exceptions
outOfBoundErrorif IDX > 1
Note
For const objects, returns a read-only reference

◆ operator=() [1/2]

template<typename F_TYPE, typename S_TYPE>
auto original::couple< F_TYPE, S_TYPE >::operator= ( const couple< F_TYPE, S_TYPE > & other)

Copy assignment operator.

Parameters
othercouple to copy from
Returns
Reference to this object

◆ operator=() [2/2]

template<typename F_TYPE, typename S_TYPE>
original::couple< F_TYPE, S_TYPE > & original::couple< F_TYPE, S_TYPE >::operator= ( couple< F_TYPE, S_TYPE > && other)
noexcept

Move assignment operator.

Parameters
othercouple to move from
Returns
Reference to this object
Note
noexcept qualified for compatibility with STL containers

◆ second() [1/2]

template<typename F_TYPE, typename S_TYPE>
auto original::couple< F_TYPE, S_TYPE >::second ( )

Access second element.

Returns
Mutable reference to second element

◆ second() [2/2]

template<typename F_TYPE, typename S_TYPE>
const S_TYPE & original::couple< F_TYPE, S_TYPE >::second ( ) const

Access second element (const version)

Returns
Mutable reference to second element

◆ set()

template<typename F_TYPE, typename S_TYPE>
template<u_integer IDX, typename T>
couple & original::couple< F_TYPE, S_TYPE >::set ( const T & e)

element modifies the template method

Template Parameters
IDXelement index (0=1st element, 1=2nd element)
TElement type (auto-derivation)
Parameters
enew element value
Returns
Reference to this object for method chaining

◆ toString()

template<typename F_TYPE, typename S_TYPE>
auto original::couple< F_TYPE, S_TYPE >::toString ( bool enter) const
nodiscardoverridevirtual

Formats pair elements as string.

Parameters
enterAdd newline at end if true
Returns
Formatted string "(first: value, second: value)"

Reimplemented from original::printable.


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