Talk:cpp/language/parameter pack
According to the syntax, the example is invalid. The syntax is missing "typename... name" in addition to "class... name".
- You're right, thank you for bringing it up. This page needs work. --Cubbi 05:31, 5 March 2013 (PST)
[edit] Parameter packs with "non-type parameters"
Are they allowed? if yes, how are they defined & used? --84.144.43.9 14:12, 3 December 2014 (PST)
- Yes of course, this page calls it "1) A non-type template parameter pack with an optional name". Very common use case is std::integer_sequence --Cubbi (talk) 14:38, 3 December 2014 (PST)
[edit] Function parameter pack in non-final position
This is accepted by GCC:
template<typename ...Ts, typename U, typename=void> void valid(Ts..., U);
However the article says that it "can't be used". GCC accepts "valid(1)" - I think according to the Standard, GCC is right: valid(1) leaves Ts empty, because it is not deduced and deduces U to be int. Clang rejects. Because of implementation divergence, and the apparent status of the snippet being valid, according to the Standard, I propose to delete the assertion that it "can't be used". 79.218.66.198 04:03, 7 July 2017 (PDT)
- clang accepts that too as of 4.0, I updated that mini-example. --Cubbi (talk) 05:34, 7 July 2017 (PDT)
- and then I changed it back. the discussion at https://stackoverflow.com/questions/40704605 seems to agree that it was a GCC extension --Cubbi (talk) 06:40, 7 July 2017 (PDT)