tuple-like, pair-like
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Utilities library
Type support (basic types, RTTI)
Library feature-test macros (C++20)
(C++11)
(C++20)
(C++26)
(C++20)
Coroutine support (C++20)
Contract support (C++26)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
General utilities
Relational operators (deprecated in C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
(C++20)
Swap and type operations
Common vocabulary types
std::tuple
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20)
tuple-like
(C++23)
(C++23)
(C++23)
Deduction guides (C++17)
template< class T >
concept tuple-like = /* see below */;
(1)
(since C++23) concept tuple-like = /* see below */;
(exposition only*)
template< class T >
(2)
(since C++23) concept pair-like =
(exposition only*)
1) A type
T
models and satisfies the concept tuple-like
if std::remove_cvref_t <T> is a specialization of
(since C++26)
- std::pair ,
- std::tuple , or
- std::ranges::subrange .
2)
pair-like
objects are tuple-like
objects with exactly 2 elements.[edit] Notes
tuple-like
types implement the tuple protocol, i.e., such types can be used with std::get, std::tuple_element and std::tuple_size.
Elements of tuple-like
types can be bound with structured binding.
[edit] See also
tuple-like
and pair-like
are used in the following standard library components:
(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(C++20)
(function template) [edit]
determines the common reference type of a
(class template specialization) [edit]
tuple
and a tuple-like
type (class template specialization) [edit]
(C++23)
tuple
and a tuple-like
type (class template specialization) [edit]
converts the
(public member function of
subrange
to a pair-like type (public member function of
std::ranges::subrange<I,S,K>
) [edit]