C++ Logo


Advanced search

Re: [std-proposals] Add [[no_unique_address]] attribute to std::pair

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 25 Aug 2023 16:03:54 -0700
On Friday, 25 August 2023 08:07:50 PDT Hewill Kang via Std-Proposals wrote:
> boost::compressed_pair is widely used as a replacement for std::pair in
> order to save storage when one of the data members is an empty class.
> The __compressed_pair helper class, which is similar to
> boost::compressed_pair, is also widely used in libc++.
> I wonder if we could get this compression optimization at almost no cost if
> add the C++ [[no_unique_address]] attribute to the members of std::pair:

Can't you get those benefits by using std::tuple instead of std::pair?

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-08-25 23:03:56