Saturday 15 March 2014

c++ - Is it possible to use typenames after an unpacked list as templates arguments? -



c++ - Is it possible to use typenames after an unpacked list as templates arguments? -

in basic sense, want this:

template<typename ... args> struct{ typedef std::tuple<args ..., int> mytuple; }

but msvc (in visualstudio 2013) gives me quite unusual syntax error:

error c2143: syntax error : missing ';' before 'int'

is possible utilize regular typename after unpacked list template arguments? if yes, how? if no, why not?

is possible utilize regular typename after unpacked list template arguments?

yes, absolutely. can insert arguments before , after pack expansion in argument list, , done how showed it. simply illustration of how useless vc++ (or in case, it's error messages) when comes templates , introduces features.

by experimenting online compiler found problem missing semicolon after struct definition. reason compiler error produced vc++ refers tuple instead of end of struct. so, check missing semicolons.

c++ templates c++11 variadic-templates

No comments:

Post a Comment