Date
2024-01-24.00:00:00
Message id
13932

Content

P2165R4 (Compatibility between tuple, pair and tuple-like objects) added two new constructors to std::tuple:


  template<tuple-likeUTuple>
    constexpr explicit(see below ) tuple(UTuple&& u);

and the allocator-extended equivalent. Unlike the existing constructors taking a single parameter of tuple type, these new constructors are not defined as deleted if they would create a dangling reference to a temporary. The existing constructors gained that restriction from P2255R2 (A type trait to detect reference binding to temporary) which was approved one meeting before P2165R4 so LWG seem to have missed the inconsistency.

The proposal also added a new constructor for std::pair:


  template<pair-like P> constexpr explicit(see below) pair(P&& p);

This is deleted if it would create a dangling reference, although that seems to be an almost accidental consequence of adding the new signature after existing ones which already have the Remarks: about being deleted.