I have a template taking a type that is structurally-bindable to two aliases (could be a tuple but also a struct). I need the type of those two variables the aliases point to.
template <typename T>
T obj;
// type of a/b in auto&& [a, b] = obj ?
I need to know the type before I actually use the structured binding:
template <typename S>
void fn(ranges::any_view<S> range_of_tuple_or_struct_or_pair) {
last_from = std::numeric_limits<?????>::max();
// ????? should be the type of from (or to, they should be the same types) of:
// auto&& [from, to] = <range element>
for (auto&& [from, to] : range_of_tuple_or_struct_or_pair) {
if (from != last_from) {
...;
last_from = from;
}
}
}