These are chat archives for boostorg/hana

20th
Feb 2016
Jason Rice
@ricejasonf
Feb 20 2016 01:38
Would it be a huge change to have hana::decltype_ strip cv-qualifiers or is there something that does that?
Louis Dionne
@ldionne
Feb 20 2016 01:39
If you need to strip cv-qualifiers, you can use hana::traits::remove_cv. Why would you like hana::decltype_ to remove them?
By the way, the reason why hana::decltype_ strips references is because it couldn’t be implemented consistently when keeping references. So it was decided that stripping references completely, while arbitrary and limiting, was the simplest choice.
Jason Rice
@ricejasonf
Feb 20 2016 01:42
I know I am misusing optional here, but...
hana::decltype_(hana::nothing) != hana::decltype_(hana::optional<>{})
ricejasonf/nbdl@aa64103
Louis Dionne
@ldionne
Feb 20 2016 01:48
One’s const and the other one is non-const?
nothing is const because it’s a constexpr optional<>?
Whereas the other one falls through the T&& of hana::decltype_ since it’s a temporary, and it’s then transformed into optional<> after removing rvalue reference.
Jason Rice
@ricejasonf
Feb 20 2016 01:50
I think so. I get bit by the const - not const thing a lot. With hana::hash and mpdef::Map too I had to use std::add_const.
Louis Dionne
@ldionne
Feb 20 2016 01:52
Do you remember the exact problem with hash?
Jason Rice
@ricejasonf
Feb 20 2016 01:54
I think I had specializations for const but you simplified it with remove_cv.
Louis Dionne
@ldionne
Feb 20 2016 01:54
Regarding this whole optional thing; while I’ll probably specify its template parameters, it feels like you’re doing something wrong. I’ll try to take a deeper look at your code.
Jason Rice
@ricejasonf
Feb 20 2016 01:54
You mean like with the tuple with optionals in it?
Louis Dionne
@ldionne
Feb 20 2016 01:55
Yes. I feel like it might be easier to define the tuple once you have the values themselves.
Regarding hash: I just checked and you had const specializations for char and unsigned char only.
Jason Rice
@ricejasonf
Feb 20 2016 01:58
I don't remember why exactly
lol
Louis Dionne
@ldionne
Feb 20 2016 01:58
There were probably problems with char not being comparable to other integral types, but that was fixed separately.
What I do now for hash is simply discard the cv-qualifiers of the value in the IntegralConstant, for the cv-qualifier does not change whether two IntegralConstants are equal.
Jason Rice
@ricejasonf
Feb 20 2016 02:00
ah right
Louis Dionne
@ldionne
Feb 20 2016 02:02
I’m looking at your mpdef::Map right now and I see the add_const, but I don’t understand why it would ever be needed.
Jason Rice
@ricejasonf
Feb 20 2016 02:10
If the map was made with a key of hana::int_c<1> that would be of type const hana::integral_constant<int> and it wouldn't match hana::integral_constant<int>
Louis Dionne
@ldionne
Feb 20 2016 02:11
Oh shit, right.
But that’s an issue you run into when you use values for their type instead of “properly” storing them into hana::type or a similar container.
Jason Rice
@ricejasonf
Feb 20 2016 02:16
Yeah, it's probably not something Hana needs to solve, but I run into the problem often. gtg eat ttyl