On this page
std::basic_common_reference<std::reference_wrapper>
Defined in header <functional> |
||
|---|---|---|
|
(1) | (since C++23) |
|
(2) | (since C++23) |
| Helper concepts | ||
|
(3) | (exposition only*) |
The common reference type of a reference_wrapper (denoted as R) and a type T, correspondingly applied with cv and reference qualifiers (denoted as RQ and TQ respectively), is equivalent to a common reference type of underlying type of R applied with lvalue reference and the TQ.
The common reference type is defined only if R is the only reference_wrapper, the underlying type of R applied with lvalue reference and the TQ have a common reference type to which RQ must be convertible.
The exposition-only constant /*is-ref-wrapper*/<R> is true if and only if R is a specialization of std::reference_wrapper.
Member types
| Member type | Definition |
|---|---|
type |
std::common_reference_t<typename R::type&, TQual<T>> (1,2) |
Notes
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_common_reference_wrapper |
202302L | (C++23) | Make std::common_reference_t of std::reference_wrapper a reference type |
Example
#include <concepts>
#include <functional>
static_assert(std::same_as<std::common_reference_t<int&,
std::reference_wrapper<int>>,
int&>);
static_assert(std::same_as<std::common_reference_t<std::reference_wrapper<int>&,
int&>,
int&>);
static_assert(std::same_as<std::common_reference_t<int&,
const std::reference_wrapper<int>&>,
int&>);
int main() {}
See also
|
(C++20)
|
determines the common reference type of a group of types (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/utility/functional/reference_wrapper/basic_common_reference