Boost logo

Boost :

Subject: Re: [boost] [compressed_pair] [hof] [hana] What's the story with compressed_pair?
From: Tom Westerhout (kot.tom97_at_[hidden])
Date: 2018-05-30 23:15:09

On 30/05/2018, Louis Dionne <ldionne.cpp_at_[hidden]> wrote:
> On Wed, May 30, 2018 at 4:10 AM, Tom Westerhout via Boost <
> boost_at_[hidden]> wrote:
>> Hello!
>> It looks like there are at least three different implementations of a
>> "std::pair with EBO" in Boost:
>> boost/utility/compressed_pair.hpp
>> boost/hof/detail/compressed_pair.hpp
>> boost/hana/pair.hpp
>> Finally, there is also std::tuple which seems to also make use of EBO. I
>> need similar functionality for a GSoC project I'm working on this
>> year. So I'm wondering, is compressed pair considered a simple
>> technicality that should be implemented from scratch every time I need
>> it or shall I stick to one of the four mentioned implementations?
> If you're able to, I would suggest you use an existing implementation.
> They tend to be very tricky to implement, especially the constructor
> SFINAE required on them. If you can find one that works for your
> use case, just stick to it. That's just my opinion.

Thanks, Louis.

>> I would much prefer to use Boost.Utility's one, but unfortunately it's
>> neither constexpr-friendly nor noexcept-friendly... Is there some reason
>> why it cannot be annotated with macros which expand to constexpr and
>> noexcept when compiled with C++11 support? Or has no one just gotten
>> around to do it?
> I think we've just never had this discussion of whether it would be
> possible/desirable to share a common implementation of a compressed
> pair throughout these new libraries (HOF and Hana).

Could this thread perhaps serve as a start for such a discussion?


Boost list run by bdawes at, gregod at, cpdaniel at, john at