◐ Shell
clean mode source ↗

cv (<div class="t-tr-text">const volatilidade<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

De cppreference.com

<metanoindex/>

  • const - define que o tipo é constante'.

    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 - define que o tipo é volátil'.

    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 - define que um membro de uma classe não afeta o estado externamente visível da classe. Membros mutable pode ser modificado em' classes de constantes, que é constness' é essencialmente ignorados para o membro particular.

    Original:

    mutable - defines that a member of a class does not affect the externally visible state of the class. mutable members 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.

Explicação

Nota: CV-eliminatórias </ b> e cv-especificadores </ b> (lista acima) não são os mesmos thing.
O CV-eliminatórias são propriedades de um tipo enquanto cv-especificadores são recurso de linguagem para definir CV-eliminatórias

Original:

Note: cv-qualifiers and cv-specifiers (list above) are not the same thing.
The cv-qualifiers are properties of a type whereas cv-specifiers are language feature to define cv-qualifiers

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Cv-eliminatórias definir duas propriedades básicas de um tipo: constness''' e volatilidade. A cv-qualificador pode ser um dos seguintes: 'const volatile', 'const', 'volatile' ou 'none'. const define que o tipo é constante, volatile define que o tipo é' volátil. Tipo não-constante e não-volátil não tem restrições adicionais, enquanto constante e volátil implica o seguinte:

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.

  • ' 'Constante - o objeto não deve ser modificado. Tente fazer isso resulta em comportamento indefinido. Na maioria dos compiladores é tempo de compilação erro.

    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.

  • ' 'Volátil - o objeto pode ser modificado por meio não detectáveis ​​pelo compilador e, portanto, algumas otimizações do compilador deve ser desativado.

    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.

Há ordenação parcial de CV-eliminatórias pela ordem de restrições crescentes. O tipo pode ser dito mais ou' cv menos qualificado, então:

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.

  • Incompetente <const

    Original:

    unqualified < const

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • Incompetente <volatile

    Original:

    unqualified < volatile

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • Incompetente <const volatile

    Original:

    unqualified < const volatile

    The 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

Qualquer CV-eliminatórias são parte da definição do tipo, portanto, com diferentes tipos de CV-qualificações são sempre diferentes tipos. Portanto elenco é necessária para corresponder ao atribuir tipos de variáveis, funções de chamada, etc, só lançando a mais cv qualificado tipo é feito automaticamente como parte de

conversões implícitas

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.

. Em particular, as seguintes conversões são permitidos:

Original:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

  • ' Tipo não qualificado pode ser convertido para const

    Original:

    unqualified type can be converted to const

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • ' Tipo não qualificado pode ser convertido para volatile

    Original:

    unqualified type can be converted to volatile

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • ' Tipo não qualificado pode ser convertido para const volatile

    Original:

    unqualified type can be converted to const volatile

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • const tipo pode ser convertida para const volatile

    Original:

    const type can be converted to const volatile

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • volatile tipo pode ser convertida para const volatile

    Original:

    volatile type can be converted to const volatile

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Para converter para um menos cv qualificado, tipo

const_cast

deve ser utilizado.

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.

Palavras-chave

const, volatile, mutable

Exemplo