当前位置:网站首页>D omit parameter name
D omit parameter name
2022-06-25 00:13:00 【fqbqrr】
import std.conv;
class Foo
{
int i;
// v=== Derivation type
this(int)//(T i)
{
this.i = i;//.to!int;
}
string test()
{
return i.to!string;
}
}
void main()
{
long bar = 42;
auto foo = new Foo(bar);
assert(foo.test == "42"); // error
// Cannot pass ` Long ` to ` whole `.
}
Parameter names are not required at all , Because this is just an unimplemented declaration , Therefore, the parameter name is not required .
just as Ali said , Parameter not used ( That is to say Template specialization , Virtual function covering , Virtual parameters for overload resolution purposes etc. )
TYPE foo(TYPE)() {
return 42; }
// Function argument list required `()`
TYPE foo(TYPE)() {
int r = 42;
return r; // Can't convert ` whole ` to ` short `
}
void main() {
foo!short();
}
struct S(TYPE) {
TYPE foo(TYPE) {
// This is a function , It's not a template , The type is known , Omit the parameter name
return 42;
}
// Function templates
TYPE bar(TYPE2)() {
// ...
}
}
边栏推荐
- ∞ symbol line animation canvasjs special effect
- wx小程序跳转页面
- linux 系统redis常用命令
- [interview question] what is a transaction? What are dirty reads, unrepeatable reads, phantom reads, and how to deal with several transaction isolation levels of MySQL
- Difficult and miscellaneous problems: A Study on the phenomenon of text fuzziness caused by transform
- Hello C (two) -- use of bit operation
- Svg+js keyboard control path
- 为什么生命科学企业都在陆续上云?
- 有趣的checkbox计数器
- MySQL日志管理
猜你喜欢

The new employee of the Department after 00 is really a champion. He has worked for less than two years. The starting salary of 18K is close to me when he changes to our company

JPA learning 1 - overview, JPA, JPA core annotations, JPA core objects

颜色渐变梯度颜色集合

svg+js键盘控制路径

Signal integrity (SI) power integrity (PI) learning notes (XXV) differential pair and differential impedance (V)

C WinForm maximizes occlusion of the taskbar and full screen display

浅析大型IM即时通讯系统开发难度

Tape SVG animation JS effect

Adding, deleting, modifying and checking in low build code

How does VR panorama make money? Based on the objective analysis of the market from two aspects
随机推荐
Scala IO reads data from URLs and other data sources
Tongji and Ali won the CVPR best student thesis, lifeifei won the Huang xutao award, and nearly 6000 people attended the offline conference
JPA学习1 - 概述、JPA、JPA核心注解、JPA核心对象
水库大坝安全监测
怎么把wps表格里某一列有重复项的整行删掉
C WinForm maximizes occlusion of the taskbar and full screen display
节奏快?压力大?VR全景客栈带你体验安逸生活
Analysis report on development trend and investment forecast of global and Chinese D-leucine industry from 2022 to 2028
[interview question] the difference between instancof and getclass()
VR全景制作的优势是什么?为什么能得到青睐?
Why are life science enterprises on the cloud in succession?
【面试题】instancof和getClass()的区别
China CAE industry investment strategic planning and future development analysis report 2022 ~ 2028
信号完整性(SI)电源完整性(PI)学习笔记(二十五)差分对与差分阻抗(五)
无人驾驶: 对多传感器融合的一些思考
Do280openshift access control -- encryption and configmap
Human body transformation vs digital Avatar
Arbitrary file download of file operation vulnerability (7)
Analysis report on operation pattern and supply and demand situation of global and Chinese cyano ketoprofen industry from 2022 to 2028
∞符号线条动画canvasjs特效