Where is the definition of `top-level cv-qualifiers` in the C++11 Standard?

前端 未结 3 2135
自闭症患者
自闭症患者 2020-12-08 11:29

In the draft C++11 standard: N3337 I found several references to top-level cv-qualifiers, but no definition.

3条回答
  •  醉酒成梦
    2020-12-08 12:34

    This question is the subject of defect report 609: What is a “top-level” cv-qualifier? which says:

    The phrase “top-level cv-qualifier” is used numerous times in the Standard, but it is not defined. The phrase could be misunderstood to indicate that the const in something like const T& is at the “top level,” because where it appears is the highest level at which it is permitted: T& const is ill-formed.

    and the proposed resolution suggests adding the following wording and note:

    For a type cv T, the top-level cv-qualifiers of that type are those denoted by cv. [Example: The type corresponding to the type-id “const int&” has no top-level cv-qualifiers. The type corresponding to the type-id “volatile int * const” has the top-level cv-qualifier const. For a class type C, the type corresponding to the type-id “void (C::* volatile)(int) const” has the top-level cv-qualifier volatile. —end example]

    Update

    The defect has changed status to DRWP which means it is now part of the latest draft standard and we can find the new wording in N4527.

提交回复
热议问题