我有一个模板采用在结构上可绑定到两个别名的类型(可以是元组,也可以是结构)。我需要别名指向的这两个变量的类型。
template <typename T>
T obj;
// type of a/b in auto&& [a, b] = obj ?
在实际使用结构化绑定之前,我需要知道类型:
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;
}
}
}