cpp/language/cv: Unterschied zwischen den Versionen
Aus cppreference.com
P12bot (Diskussion | Beiträge) K (r2.7.3) (Bot: Ergänze: en, es, fr, it, ja, pt, ru, zh) |
|||
Zeile 3: | Zeile 3: | ||
{{cpp/language/navbar}} | {{cpp/language/navbar}} | ||
− | :*{{tr|{{ttb|const}} - legt fest, dass | + | :*{{tr|{{ttb|const}} - legt fest, dass '''' .|{{ttb|const}} - defines that the type is ''constant''.}} |
− | :*{{tr|{{ttb|volatile}} - legt fest, dass | + | :*{{tr|{{ttb|volatile}} - legt fest, dass ''flüchtig'' .|{{ttb|volatile}} - defines that the type is ''volatile''.}} |
− | :*{{tr|{{ttb|mutable}} - legt fest, dass ein Mitglied einer Klasse keinen Einfluss auf | + | :*{{tr|{{ttb|mutable}} - legt fest, dass ein Mitglied einer Klasse keinen Einfluss auf äußerlich Zustand der Klasse . {{tt|mutable}} Mitglieder können in '''' Klassen , die ''Konstantheit'' im Wesentlichen für jeweilige Mitglied ignoriert .|{{ttb|mutable}} - defines that a member of a class does not affect the externally visible state of the class. {{tt|mutable}} members can be modified in ''constant'' classes, that ''constness'' is essentially ignored for the particular member.}} |
===Erklärung=== | ===Erklärung=== | ||
− | :{{tr|Hinweis: <b> cv- | + | :{{tr|Hinweis: <b> cv-</b> und <b> cv-</b> (siehe Liste oben) sind nicht das Gleiche.<br> Die cv-sind Eigenschaften eines Typs während cv--sind um cv-zu definieren|Note: <b>cv-qualifiers</b> and <b>cv-specifiers</b> (list above) are not the same thing.<br> The cv-qualifiers are properties of a type whereas cv-specifiers are language feature to define cv-qualifiers}} |
− | {{tr|Cv- | + | {{tr|Cv-definieren zwei grundlegende Eigenschaften eines Typs:'' Konstantheit'' und'' ''. cv-kann eine der folgenden sein: {{tt|'const volatile'}}, {{tt|'const'}}, {{tt|'volatile'}} oder {{tt|'none'}}. {{tt|const}} legt fest, dass '''' , {{tt|volatile}} legt fest, dass '''' ist. und Typ hat keine Beschränkungen, während und folgendes :|Cv-qualifiers define two basic properties of a type: ''constness'' and ''volatility''. A cv-qualifer can be one of the following: {{tt|'const volatile'}}, {{tt|'const'}}, {{tt|'volatile'}} or {{tt|'none'}}. {{tt|const}} defines that a type is ''constant'', {{tt|volatile}} defines that the type is ''volatile''. Non-constant and non-volatile type has no additional restrictions, whereas constant and volatile imply the following:}} |
− | :*{{tr|'''' ' | + | :*{{tr|'''''''''' - das Objekt darf nicht verändert werden. Verhalten. Bei den meisten Compilern ist Kompilierungsfehler.|'''''constant''''' - the object shall not be modified. Attempt to do so results in undefined behavior. On most compilers it is compile-time error.}} |
− | :*{{tr|'''' ' | + | :*{{tr|'''''''''' - das Objekt kann durch nicht nachweisbar durch den Compiler geändert werden und somit einige Compiler-Optimierungen deaktiviert werden .|'''''volatile''''' - the object can be modified by means not detectable by the compiler and thus some compiler optimizations must be disabled.}} |
− | {{tr|Es gibt partielle Ordnung der cv- | + | {{tr|Es gibt partielle Ordnung der cv-durch die Reihenfolge der zunehmenden Einschränkungen. Der Typ kann ''mehr'' oder ''weniger'' cv:|There is partial ordering of cv-qualifiers by the order of increasing restrictions. The type can be said ''more'' or ''less'' cv-qualified then:}} |
− | :* {{tr|'' | + | :* {{tr|'' '' < {{tt|const}}|''unqualified'' < {{tt|const}}}} |
− | :* {{tr|'' | + | :* {{tr|'' '' < {{tt|volatile}}|''unqualified'' < {{tt|volatile}}}} |
− | :* {{tr|'' | + | :* {{tr|'' '' < {{tt|const volatile}}|''unqualified'' < {{tt|const volatile}}}} |
:* {{tt|const}} < {{tt|const volatile}} | :* {{tt|const}} < {{tt|const volatile}} | ||
:* {{tt|volatile}} < {{tt|const volatile}} | :* {{tt|volatile}} < {{tt|const volatile}} | ||
− | {{tr|Alle cv- | + | {{tr|Alle cv-sind Teil der Typ-Definition, mit unterschiedlichen cv-Qualifikationen immer verschiedene Typen. Deshalb Casting erforderlich, um Typen , . Nur ''mehr cv qualifizierten'' wird automatisch als Teil {{rlp|implicit_cast |{{tr| impliziten Konvertierungen| implicit conversions}}}} getan. Insbesondere werden die folgenden Konvertierungen erlaubt:|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 {{rlp|implicit_cast |{{tr| impliziten Konvertierungen| implicit conversions}}}}. In particular, the following conversions are allowed:}} |
− | :* {{tr|'' | + | :* {{tr|'' '' Typ kann {{tt|const}} umgewandelt werden|''unqualified'' type can be converted to {{tt|const}}}} |
− | :* {{tr|'' | + | :* {{tr|'' '' Typ kann {{tt|volatile}} umgewandelt werden|''unqualified'' type can be converted to {{tt|volatile}}}} |
− | :* {{tr|'' | + | :* {{tr|'' '' Typ kann {{tt|const volatile}} umgewandelt werden|''unqualified'' type can be converted to {{tt|const volatile}}}} |
:* {{tr|{{tt|const}} Typ kann in {{tt|const volatile}} umgewandelt werden|{{tt|const}} type can be converted to {{tt|const volatile}}}} | :* {{tr|{{tt|const}} Typ kann in {{tt|const volatile}} umgewandelt werden|{{tt|const}} type can be converted to {{tt|const volatile}}}} | ||
:* {{tr|{{tt|volatile}} Typ kann in {{tt|const volatile}} umgewandelt werden|{{tt|volatile}} type can be converted to {{tt|const volatile}}}} | :* {{tr|{{tt|volatile}} Typ kann in {{tt|const volatile}} umgewandelt werden|{{tt|volatile}} type can be converted to {{tt|const volatile}}}} | ||
− | {{tr|Um | + | {{tr|Um ''weniger cv qualifizierten'' Typ zu konvertieren, {{ltt|cpp/language/const_cast}} verwendet werden .|To convert to a ''less cv-qualified'' type, {{ltt|cpp/language/const_cast}} must be used.}} |
===Keywords=== | ===Keywords=== |
Aktuelle Version vom 26. November 2013, 04:51 Uhr
![]() |
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
- 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.
[Bearbeiten] 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 definierenOriginal: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-qualifiersThe 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.
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.
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 <div class="t-tr-text"> impliziten Konvertierungen
getan. Insbesondere werden die folgenden Konvertierungen erlaubt: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
impliziten Konvertierungen</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.
- uneingeschränkter Typ kann
const
umgewandelt werdenOriginal:unqualified type can be converted toconst
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 werdenOriginal:unqualified type can be converted tovolatile
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 werdenOriginal:unqualified type can be converted toconst 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 inconst volatile
umgewandelt werdenOriginal:const
type can be converted toconst 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 inconst volatile
umgewandelt werdenOriginal:volatile
type can be converted toconst 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.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Keywords
[Bearbeiten] Beispiel
This section is incomplete |