[compressed_pair] [hof] [hana] What's the story with compressed_pair?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[compressed_pair] [hof] [hana] What's the story with compressed_pair?

Boost - Dev mailing list
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?

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?


Thanks in advance,
Tom

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [compressed_pair] [hof] [hana] What's the story with compressed_pair?

Boost - Dev mailing list
On Wed, May 30, 2018 at 4:10 AM, Tom Westerhout via Boost <
[hidden email]> 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.


>
> 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).

I'd have to take a look at HOF's and Utility's compressed pairs to see
whether they fulfill the requirements that Hana has (which are mainly
related to compile-time performance).

Louis

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [compressed_pair] [hof] [hana] What's the story with compressed_pair?

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Tom Westerhout wrote:

> 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 suppose that no one has gotten around to do it. :-)


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [compressed_pair] [hof] [hana] What's the story with compressed_pair?

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 30/05/2018, Louis Dionne <[hidden email]> wrote:

> On Wed, May 30, 2018 at 4:10 AM, Tom Westerhout via Boost <
> [hidden email]> 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?


Tom

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost