gpt4 book ai didi

c++ - 什么是 "Unary Constructor"?

转载 作者:行者123 更新时间:2023-12-03 14:20:36 24 4
gpt4 key购买 nike

这里是this link它说:

The static_cast keyword can be used for any normal conversion between types. Conversions that rely on static (compile-time) type information. This includes any casts between numeric types, casts of pointers and references up the hierarchy, conversions with unary constructor, conversions with conversion operator. For conversions between numeric types no runtime checks if data fits the new type is performed. Conversion with unary constructor would be performed even if it is declared as explicit.

还有 here :

To interoperate well with other CLS-compliant languages, you may wish to wrap each user-defined unary constructor for a given class with a corresponding convert-from operator.

“一元构造函数”是什么意思?

最佳答案

一元的意思是一个,所以他们说的是一个只有一个参数的构造函数。这种东西的标准名称是 conversion constructor .

关于c++ - 什么是 "Unary Constructor"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61257015/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com