I was wondering whether … was considered an operator in C++11. And if it’s the case, what’s its precedence?
For instance consider this pretty bad example and assume … is an operator.
template<typename T, typename...Args>
void foo(T _elm, Args... _args)
{
bar(something,_args...);
}
How can I know whether bar will be run with its first parameter being something and args... expanded, or if its gonna be run on the result of operator,(something, _args...) ? (bonus question: can operators be overloaded with variadic templates ?)
I was wondering whether … was considered an operator in C++11
No,
...is definitely not considered an operator in C++ 11. If you remember, it was also used in the previous standard in error handlingand though I am not sure how the
...is analysed and parsed internally, it is definitely not treated as an operator.Can operators be overloaded with variadic templates ?
I’m not sure, but I don’t think so. Operators have to take a specified set of parameters like:
I don’t think it would work with variadic templates.