以下文章是我为模板参数包找到的第一个提案.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1603.pdf
在第16页,它讨论了引入两个新的运算符[]和<>来访问参数包元素和参数包类型.
The suggested syntax for such an operator involves two new operators: .[] to access values and .<> to access types. For instance:
template<int N, typename Tuple> struct tuple_element;
template<int N, ... Elements>
struct tuple_element<tuple<Elements...> >
{
typedef Elements.<N> type;
};
template<int N, ... Elements>
Elements.<N>& get(tuple<Elements...>& t)
{ return t.[N]; }
template<int N, ... Elements>
const Elements.<N>& get(const tuple<Elements...>& t)
{ return t.[N]; }
Run Code Online (Sandbox Code Playgroud)
那么这些运营商在哪里?如果没有,他们的替代品是什么?