3 ms·
Because there is yet no proper for loop for argument packs or tuple-like objects, fold expressions over the comma operators are unfortunately the next best thin
by gpderetta 7y ago
Because there is yet no proper for loop for argument packs or tuple-like objects, fold expressions over the comma operators are unfortunately the next best thing.
Edit: also the default comma operator discards its lhs, it is pretty much always used for its side effects.
- klibertp 7y agoYeah, I figured it might not be currently possible. I was thinking about something like Scala HList[1], which provides a map/flatMap (which enables for-loop) method for tuples (among other functionality). [1] https://github.com/milessabin/shapeless/wiki/Feature-overview%3A-shapeless-2.0.0#heterogenous-lists https://github.com/milessabin/shapeless/wiki/Feature-overvie...
- gpderetta 7y agoboost.fusion, boost.hana provide similar functionality (i.e. arbitrary runtime or compile time transformations over tuple-like objects) but they are relatively large dependencies and it is not worth it just for a tuple for-each.