4 ms·
Didn't check whether it hardcodes support for std::pair and std::tuple, but the "correct" way to do this is to rely on `std::tuple_size` and `std::tuple_element
by MauranKilom 3y ago
Didn't check whether it hardcodes support for std::pair and std::tuple, but the "correct" way to do this is to rely on `std::tuple_size` and `std::tuple_element` for all tuple-like types. User types may well have these customizations defined already for e.g. structured binding support.
- quietbritishjim 3y agoIt just hardcodes std::pair and std::tuple https://github.com/philip82148/cpp-dump/blob/main/hpp/export_tuple_like.hpp https://github.com/philip82148/cpp-dump/blob/main/hpp/export...
- philip82148 3y agoIt supports both std::pair and std::tuple. But I used std::get instead of std::tuple_element. I'll change it. Thank you for your advice!
- MauranKilom 3y agoI actually initially also wrote "std::get and std::tuple_size", until I double-checked. :D Is there a reason not to just handle/accept everything that has a valid `std::tuple_size` specialization?
- philip82148 3y agoOh, I forgot to mention this, but I am already using std::tuple_size. There is no reason not to handle/accept everything that has a valid `std::tuple_size` specialization. (I am not a native speaker, so I might have misunderstood your reply.)
- philip82148 3y agoSorry, plz ignore this comment. I just changed the source. I used std::tuple_size to handle everything that has a valid `std::tuple_size` specialization.