These are chat archives for boostorg/hana

27th
Apr 2017
Jason Rice
@ricejasonf
Apr 27 2017 17:01
Are there any plans for range-based for loops to support tuples in C++? I only see it allowing different types for begin and end.
Jason Rice
@ricejasonf
Apr 27 2017 17:07
... or really any kind of heterogeneous iterable
Shreyans
@shreyans800755
Apr 27 2017 20:09
@ricejasonf
It would be really difficult to use range-based for loops even if we implement it.
For ex:
auto het = <some heterogeneous container>;
for(auto i : het)
{
i.some_function();
}
Its not usually a case where we want to perform common or same operation for all the members of the containers since they are heterogeneous.
Jason Rice
@ricejasonf
Apr 27 2017 20:16
I do it all of the time with hana::for_each.
Shreyans
@shreyans800755
Apr 27 2017 20:20
@ricejasonf I'm curious, what kind of operations do you perform in for_each.
Jason Rice
@ricejasonf
Apr 27 2017 20:21
Let's say you have a tuple of Printable objects, and you want to print all of them
They have different types that all can be used with some print function or maybe they have a print member function.
Shreyans
@shreyans800755
Apr 27 2017 20:24
@ricejasonf That sounds good example. I think its quite useful in serialization/deserialization, too.
Thanks
Jason Rice
@ricejasonf
Apr 27 2017 20:25
any kind of side effects