有人可以解释这里的含糊不清吗?
template <typename...> struct thing;
template <typename... Rest>
struct thing<int&, Rest&...> {
thing(int&, Rest&...) { }
};
template <typename First, typename... Rest>
struct thing<First&, Rest&...> {
thing(First&, Rest&...) { }
};
int main() {
int myint;
char mychar;
thing<int&, char&> t(myint, mychar);
}
答案 0 :(得分:0)
如果您专注于int
而不是int&
,那么它会起作用
template <typename...> struct thing;
template <typename... Rest>
struct thing<int, Rest...> {
thing(int&, Rest&...) { }
};
template <typename First, typename... Rest>
struct thing<First, Rest...> {
thing(First&, Rest&...) { }
};