Why does this variadic template specialization definition not compile?

笑着哭i 提交于 2019-12-06 13:23:11

§ 14.8.2.5 (Deducing template arguments from a type) paragraph 5 lists the contexts in which template arguments cannot be deduced. The relevant one is the last one in the list:

— A function parameter pack that does not occur at the end of the parameter-declaration-clause.

So in:

struct Erase<ToErase, TypeList<Head..., ToErase, Tail...>>

Head cannot be deduced; it does not occur at the end of a parameter list.

By contrast, in:

struct Append<TypeList<ToAppend...>, TypeList<List...>>

Both ToAppend and List appear at the end of their respective parameter lists, and hence they can be deduced.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!