These are chat archives for boostorg/hana

18th
Sep 2017
Jason Rice
@ricejasonf
Sep 18 2017 17:06
static_assert(sizeof(hana::tuple<hana::int_<42>>) == 1); Is that expected?
Louis Dionne
@ldionne
Sep 18 2017 18:11
Yes. What would you expect? That’s the smallest size it can have, right?
An object can’t have 0 bytes in C++.
Jason Rice
@ricejasonf
Sep 18 2017 18:26

Ah, that's right. How about this then:

  static_assert(std::is_empty<hana::tuple<>>{});
  static_assert(!std::is_empty<hana::tuple<hana::int_<42>>>{});

Intuitively, I was expecting the latter to be empty because of ebo. Perhaps I need my own has_runtime_state<T> thing.

Louis Dionne
@ldionne
Sep 18 2017 18:29
Ehm, I would expect it to be empty.
I think this would be fixed by boostorg/hana#333
Jason Rice
@ricejasonf
Sep 18 2017 18:32
Oh, maybe it's not using ebo. ??
    template <typename ...Xn>
    struct tuple
        : detail::operators::adl<tuple<Xn...>>
        , detail::iterable_operators<tuple<Xn...>>
    {
        basic_tuple<Xn...> storage_;
        using hana_tag = tuple_tag;
Louis Dionne
@ldionne
Sep 18 2017 18:36
basic_tuple is using EBO, but it’s missing some opportunities for it. I forgot the exact details since it’s been a while.
Jason Rice
@ricejasonf
Sep 18 2017 18:37
Would it make sense to put basic_tuple in a storage wrapper and derive from that in tuple?
Also, would promoting basic_tuple to Sequence be a welcome as a PR?
Jason Rice
@ricejasonf
Sep 18 2017 18:43
err not sure if that would be very valuable
Louis Dionne
@ldionne
Sep 18 2017 19:24

Also, would promoting basic_tuple to Sequence be a welcome as a PR?

It already is.

Would it make sense to put basic_tuple in a storage wrapper and derive from that in tuple?

Hmm. Interactions with EBO are extremely complex due to the conversions they suddenly enable. I’ll have to dive into it again to fix the issue properly.

If, however, you can make the test cases added in #333 pass with a simpler implementation, I think I’d be happy.