Declaring a member function with a typedef coming from a metafunction

可紊 提交于 2019-11-30 20:07:05

[temp.spec]/8:

If a function declaration acquired its function type through a dependent type without using the syntactic form of a function declarator, the program is ill-formed.

This makes your last line decidedly ill-formed. Which makes sense, since, as in other cases of dependent constructs, we don't want the meaning of a phrase to depend too strongly on template arguments.

However, [dcl.fct]/13:

A typedef of function type may be used to declare a function but shall not be used to define a function.

This makes your first three lines well-formed---the first two directly, and for the third one, note that

When a template-id refers to the specialization of an alias template, it is equivalent to the associated type obtained by substitution of its template-arguments for the template-parameters in the type-id of the alias template.

by [temp.alias].

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