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.
 
template<u_integer IDX>
auto get () const
 element access template method
 
template<u_integer IDX, typename T>
void set (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.
 
 ~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.
 
- 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
  • Lexicographical comparison (first element precedence)
  • Formatted string output through printable interface
  • Comparable interface implementation

Constructor & Destructor Documentation

◆ couple() [1/3]

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/3]

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/3]

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

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()

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

Access first element.

Returns
Mutable reference to first element

◆ get()

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

element access template method

Template Parameters
IDXelement index (0=1st element, 1=2nd element)
Returns
Constant reference to the corresponding element

◆ operator=()

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

◆ second()

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

Access second element.

Returns
Mutable reference to second element

◆ set()

template<typename F_TYPE, typename S_TYPE>
template<original::u_integer IDX, typename T>
void 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

◆ 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: