Arl*_*len 2 d operator-overloading
struct Foo{
int _a;
this(int a){ _a = a; }
int opCall(int b){ return b * b; }
}
Foo f;
int rt = f(33); //Error: cannot implicitly convert expression ((Foo __ctmp1294 = 0;
//, __ctmp1294).this(33)) of type Foo to int
Run Code Online (Sandbox Code Playgroud)
我opCall在TDPL或网站上找不到足够的信息.
我需要this()和opCall(),但是,当this()它存在时,上面的代码不起作用.我是否必须摆脱构造函数?
| 归档时间: |
|
| 查看次数: |
259 次 |
| 最近记录: |