◐ Shell
clean mode source ↗

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

Aus cppreference.com

<metanoindex/>

  • const - legt fest, dass der Typ konstant ist.

    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 - legt fest, dass der Typ flüchtig ist.

    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 - legt fest, dass ein Mitglied einer Klasse keinen Einfluss auf den äußerlich sichtbaren Zustand der Klasse hat. mutable Mitglieder können in konstanten Klassen modifiziert werden, sodass die Konstantheit im Wesentlichen für das jeweilige Mitglied ignoriert wird.

    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 its 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.

Erklärung

Hinweis: cv-qualifier und cv-specifier (siehe Liste oben) sind nicht das Gleiche.
Die cv-qualifier sind Eigenschaften eines Typs während cv-specifier Sprach-Funktionen sind um cv-qualifier zu definieren

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-qualifier definieren zwei grundlegende Eigenschaften eines Typs: Konstantheit und Flüchtigkeit. Ein cv-qualifier kann eine der folgenden sein: 'const volatile', 'const', 'volatile' oder 'none'. const legt fest, dass der Typ konstant ist, volatile legt fest, dass der Typ flüchtig ist. Der nichtkonstante und nichtflüchtige Typ hat keine weiteren Beschränkungen, während konstant und flüchtig folgendes bedeuten :

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.

  • konstant - das Objekt darf nicht verändert werden. Falls dies versucht wird folgt ein unbestimmtes Verhalten. Bei den meisten Compilern ist dies ein Kompilierungsfehler.

    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.

  • flüchtig - das Objekt kann durch nicht nachweisbar durch den Compiler geändert werden und somit einige Compiler-Optimierungen deaktiviert werden .

    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.

Es gibt eine partielle Ordnung der cv-qualifer durch die Reihenfolge der zunehmenden Einschränkungen. Der Typ kann so als mehr oder weniger cv-qualifiziert beschrieben werden:

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.

  • uneingeschränkt < 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.

  • uneingeschränkt < 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.

  • uneingeschränkt < 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

Alle cv-qualifier sind Teil der Typ-Definition, daher sind Typen mit unterschiedlichen cv-Qualifikationen auch immer verschiedene Typen. Deshalb ist Casting erforderlich, um Typen bei Variablenzuweisung, Funktionenaufruf usw. anzupassen. Nur Casting nach mehr cv qualifizierten wird automatisch als Teil der

impliziten Konvertierungen

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.

getan. Insbesondere werden die folgenden Konvertierungen erlaubt:

Original:

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

  • uneingeschränkter Typ kann const umgewandelt werden

    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.

  • uneingeschränkter Typ kann volatile umgewandelt werden

    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.

  • uneingeschränkter Typ kann const volatile umgewandelt werden

    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 Typ kann in const volatile umgewandelt werden

    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 Typ kann in const volatile umgewandelt werden

    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.

Um in einen weniger cv qualifizierten Typ zu konvertieren, muss

const_cast

verwendet werden .

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.

Keywords

const, volatile, mutable

Beispiel