This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
Section: 22.214.171.124 [refwrap.helpers] Status: WP Submitter: Agustín K-ballo Bergé Opened: 2018-07-10 Last modified: 2021-10-17
View all issues with WP status.
The overloads of std::ref/cref that take a reference_wrapper as argument are defined as calling std::ref/cref recursively, whereas the return type is defined as unwrapping just one level. Calling these functions with arguments of multiple level of wrapping leads to ill-formed programs:
int i = 0; std::reference_wrapper<int> ri(i); std::reference_wrapper<std::reference_wrapper<int>> rri(ri); std::ref(rri); // error within 'std::ref'
[Note: these overloads were added by issue resolution 10.29 for TR1, which can be found at N1688, at Redmond 2004]
[2018-08-20 Priority set to 3 after reflector discussion]
[2021-05-22 Tim syncs wording to the current working draft]
[2021-08-20; LWG telecon]
Set status to Tentatively Ready after telecon review.
[2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP.]
This wording is relative to N4885.
Change 126.96.36.199 [refwrap.helpers] as indicated:
template<class T> constexpr reference_wrapper<T> ref(reference_wrapper<T> t) noexcept;[…]
ref(t.get()).template<class T> constexpr reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;