【问题标题】:Creating alias for a class's member [duplicate]为类的成员创建别名[重复]
【发布时间】:2019-02-16 03:19:15
【问题描述】:

假设有一个类test 有一个成员void test::foo(),我们知道我们可以通过typedef test alt(或using 命令)为这个类创建一个别名。

c++ 是否支持以下意义上的类成员别名:typedef test::foo() alt::fooatl();,即alt.fooalt() 调用应该对应于对test.foo() 的调用?

【问题讨论】:

  • A typedef 只能给类型取别名,不能给值取别名。

标签: c++ class templates typedef


【解决方案1】:

没有。 p0945r0: "Generalizing alias declarations" 将允许您这样做,但在最近的会议 (Rapperswil) 上尚未推进。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-17
    • 2022-01-11
    • 2012-05-30
    • 1970-01-01
    相关资源
    最近更新 更多