These are chat archives for boostorg/hana

24th
Dec 2015
Jason Rice
@ricejasonf
Dec 24 2015 00:12
hmm.. That makes unpack kind of weird.
What exactly gets unpacked? hana::pairs?
That makes me think that maybe it should store whatever Product the user gives it
...because it appears that unpack typically supports references
Jason Rice
@ricejasonf
Dec 24 2015 07:54
/usr/local/src/hana/include/boost/hana/map.hpp:82:40: error: no viable conversion from 'boost::hana::tuple<boost::hana::map<boost::hana::test::product_t<boost::hana::test::integer<1, 17, void>, boost::hana::test::integer<-1, 17, void> > > >' to 'boost::hana::test::Tracked'
                : map_elt<index, Pair>{static_cast<Xn&&>(xn)}...
                                       ^~~~~~~~~~~~~~~~~~~~~
wrt to #223, test.map.part3
Louis Dionne
@ldionne
Dec 24 2015 07:55

That makes me think that maybe it should store whatever Product the user gives it

The problem is that in general, such Products may or may not support empty-base optimisation.

Jason Rice
@ricejasonf
Dec 24 2015 07:56
ruh roh
I could probably just convert it to hana::pair if that is a problem.
Louis Dionne
@ldionne
Dec 24 2015 07:58
Right, so basically whatever is being held by the map must be a Product, since we must be able to provide a reference to it in unpack.
Jason Rice
@ricejasonf
Dec 24 2015 07:59
oh yeah
Louis Dionne
@ldionne
Dec 24 2015 07:59
That’s a fairly major challenge, since we would like to have whatever representation we want.
Like map_elt. What about making map_elt a Product?
Jason Rice
@ricejasonf
Dec 24 2015 07:59
        template <int index, typename Pair>
        struct map_elt { Pair storage_; };
That is how I have it right now.
Louis Dionne
@ldionne
Dec 24 2015 08:01
Ah right, and then unpack gives the underlying storage_ to the function.
Seems to work.
Yes, this is the best approach AFAICS.
Jason Rice
@ricejasonf
Dec 24 2015 08:04
To pass test.map.part4 I added a default constructor. It was trying to call the constructor with no args on a map with an element (like map<pair>)
So my constructors are messed up, but everything else passes.
...in test.map.*
Louis Dionne
@ldionne
Dec 24 2015 08:08
Whatever about the constructors, I’ll check it out when you open the PR. There seems to be a need for decent constructors anyway, so we probably want to add them and document them. But one step at a time; for now let’s consider it an implementation detail.
Jason Rice
@ricejasonf
Dec 24 2015 08:10
Do a PR eventhough it doesn't pass the tests?
Jason Rice
@ricejasonf
Dec 24 2015 08:16
I might have a little time tomorrow to give it a second look and do a PR. Happy holidays! :bell: