cv (<div class="t-tr-text">const的波动<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">const-volatility</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div>) specifiers
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
const- 定义的类型是“不变”的Original:const- defines that the type is constant.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.volatile- 定义的类型是“挥发性”的Original:volatile- defines that the type is volatile.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.mutable- 定义一个类的成员不影响外部可见状态之类的。mutable成员可以��行修改,在“不变”是“常量性”本质上是忽略的特定成员的类,.Original:mutable- defines that a member of a class does not affect the externally visible state of the class.mutablemembers can be modified in constant classes, that is constness is essentially ignored for the particular member.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 解释
- 注: cv修饰符</ B>和<b> CV规范</ B>以上(列表)是不一样的thing.
的cv修饰符是一个类型的属性,而CV规范的语言功能定义cv修饰符</div>Original:Note: <b>cv-qualifiers</b> and <b>cv-specifiers</b> (list above) are not the same thing.
The cv-qualifiers are properties of a type whereas cv-specifiers are language feature to define cv-qualifiersThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cv修饰符定义的类型的两个基本属性:“常量性”和“波动”。 CV-qualifer可以是下列之一:
'const volatile','const','volatile'或'none'。 const定义一个类型是“不变”,volatile定义的类型是“挥发性”。非恒定性和非易失性的类型并没有额外的限制,而常数和挥发性意味着以下内容:Original:
Cv-qualifiers define two basic properties of a type: constness and volatility. A cv-qualifer can be one of the following:
'const volatile', 'const', 'volatile' or 'none'. const defines that a type is constant, volatile defines that the type is volatile. Non-constant and non-volatile type has no additional restrictions, whereas constant and volatile imply the following:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- 不变 - 对象将不会被修改。尝试这样做的结果,不确定的行为。在大多数的编译器,它是编译时错误.Original:constant - the object shall not be modified. Attempt to do so results in undefined behavior. On most compilers it is compile-time error.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - 挥发性 - 对象可以进行修改,通过编译器无法检测,因此一些编译器的优化,必须禁用.Original:volatile - the object can be modified by means not detectable by the compiler and thus some compiler optimizations must be disabled.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cv修饰符是偏序的顺序的限制越来越多。的类型,可以说是'多“或”少“CV合格的然后
Original:
There is partial ordering of cv-qualifiers by the order of increasing restrictions. The type can be said more or less cv-qualified then:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- “不合格”
constOriginal:unqualified <constThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - “不合格”
volatileOriginal:unqualified <volatileThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - “不合格”
const volatileOriginal:unqualified <const volatileThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
const<const volatile -
volatile<const volatile
-
任何cv修饰符的类型定义的一部分,因此类型,不同品种的资格都有不同的类型。因此,铸件所需要的匹配类型时,指定变量,函数调用等铸造“更多合格的简历”型是自动完成的<div class="t-tr-text"> 隐式转换
。特别是,下面的转换是允许的Original:
implicit conversions
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
Original:
Any cv-qualifiers are part of the type definition, hence types with different cv-qualifications are always different types. Therefore casting is needed to match types when assigning variables, calling functions, etc. Only casting to more cv-qualified type is done automatically as part of
隐式转换</div>. In particular, the following conversions are allowed:
Original:
implicit conversions
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- “不合格”类型可以转换
constOriginal:unqualified type can be converted toconstThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - “不合格”类型可以转换
volatileOriginal:unqualified type can be converted tovolatileThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - “不合格”类型可以转换
const volatileOriginal:unqualified type can be converted toconst volatileThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
const类型可以转换const volatileOriginal:consttype can be converted toconst volatileThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
volatile类型可以转换const volatileOriginal:volatiletype can be converted toconst volatileThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
要转换到“少品种合格的”类型,const_cast必须被使用
Original:
To convert to a less cv-qualified type, const_cast must be used.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 关键字
[编辑] 为例
| 本节是不完整的 |

