JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
jh::pod::pair< T1, T2 > Struct Template Referencefinal

POD-compatible aggregate of two values, equivalent in layout to a plain struct. More...

#include <jh/pods/pair.h>

Public Types

using first_type = T1
 Alias for first element type.
using second_type = T2
 Alias for second element type.

Public Member Functions

constexpr bool operator== (const pair &) const =default
 Member-wise equality comparison.

Public Attributes

T1 first
 First element.
T2 second
 Second element.

Detailed Description

template<cv_free_pod_like T1, cv_free_pod_like T2>
struct jh::pod::pair< T1, T2 >

POD-compatible aggregate of two values, equivalent in layout to a plain struct.

Template Parameters
T1First element type. Must satisfy pod_like<T1> and be free of const/volatile qualifiers (i.e. satisfy cv_free_pod_like<T1>). Using const or volatile qualified inner members would break POD layout and trivial assignment guarantees.
T2Second element type. Must satisfy pod_like<T2> and be free of const/volatile qualifiers (i.e. satisfy cv_free_pod_like<T2>).

This type provides the simplest form of a pair:

  • Two inline members: first and second
  • Strictly POD — trivial, standard layout, memcpy-safe
  • Equality comparison via operator==

Notes

  • Intended as the POD-only building block for pair-like objects
  • Optimized for raw containers (pod::array, pod::tuple, etc.)
  • For generic pair creation, prefer jh::utils::make_pair, which will automatically select pod::pair when both arguments are POD

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