Namensräume
Varianten
Aktionen

Namespaces

Aus cppreference.com
< cpp‎ | language

 
 
Sprache C + +
Allgemeine Themen
Original:
General topics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Flusskontrolle
Original:
Flow control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Bedingte Ausführung Aussagen
Original:
Conditional execution statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Iterationsanweisungen
Original:
Iteration statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Gehe Aussagen
Original:
Jump statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Funktionen
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Funktion Erklärung
Lambda-Funktion Erklärung
Funktions-Template
inline-Spezifizierer
Exception-Spezifikationen (veraltet)
noexcept Spezifizierer (C++11)
Ausnahmen
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Namespaces
Original:
Namespaces
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Namespace-Deklaration
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
decltype specifier (C++11)
Specifiers
Original:
Specifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cv Planer
Lagerdauer Planer
constexpr Spezifizierer (C++11)
auto Spezifizierer (C++11)
alignas Spezifizierer (C++11)
Initialisierung
Original:
Initialization
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Literale
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Expressions
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
alternative Darstellungen
Utilities
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
Typ Aliasdeklaration (C++11)
Attribute (C++11)
Wirft
Original:
Casts
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
impliziten Konvertierungen
const_cast conversion
static_cast conversion
dynamic_cast conversion
reinterpret_cast conversion
C-Stil und funktionale Besetzung
Speicherzuweisung
Original:
Memory allocation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Class-spezifische Funktion Eigenschaften
Original:
Class-specific function properties
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
explizit (C++11)
statisch
Besondere Member-Funktionen
Original:
Special member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Templates
Original:
Templates
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Klassen-Template
Funktions-Template
Template-Spezialisierung
Parameter Packs (C++11)
Verschiedenes
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inline Montage
 
Namespaces bieten ein Verfahren zur Verhinderung Namenskonflikte in großen Projekten .
Original:
Namespaces provide a method for preventing name conflicts in large projects.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Symbole erklärt, innerhalb eines Namespace-Block in einem benannten Bereich, die sie daran hindern, für die gleichnamige Symbole in andere Bereiche verwechselt platziert werden .
Original:
Symbols declared inside a namespace block are placed in a named scope that prevents them from being mistaken for identically-named symbols in other scopes.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Mehrere Deklarationen von Namespaces mit dem gleichen Namen sind erlaubt, was in einem Namespace einschließlich aller Symbole aller solcher Erklärungen .
Original:
Multiple declarations of namespaces with the same name are allowed, resulting in a namespace including all symbols from all such declarations.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Syntax

namespace ns_name { declarations } (1)
inline namespace ns_name { declarations } (2) (seit C++11)
ns_name::name (3)
using namespace ns_name; (4)
using ns_name::name; (5)

[Bearbeiten] Erklärung

# Erklärung des Namensraums name .
Original:
# Declaration of the namespace name.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Erklärung des Namensraums name. Definitionen erscheint sowohl innerhalb name und seine umgebenden Namensraum
Original:
# Declaration of the namespace name. Definitions will appear both inside name and its enclosing namespace
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Standard Methode für den Zugriff Namespace content .
Original:
# Standard way of accessing namespace content.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Machen alle Symbole eines Namespace zugänglich im Rahmen der using-Direktive .
Original:
# Making all symbols of a namespace accessible in the scope of the using directive.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Making ein spezifischer Symbole eines Namespace zugänglich im Rahmen der using-Direktive .
Original:
# Making a specific symbols of a namespace accessible in the scope of the using directive.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Beispiel

Dieses Beispiel zeigt, wie ein Namespace verwenden, um eine Klasse, die bereits in der std Namespace benannt wurde erstellt .
Original:
This example shows how to use a namespace to create a class that already has been named in the std namespace.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <vector>
 
namespace vec {
 
    template< typename T >
    class vector {
        // ...
    };
 
} // of vec
 
int main()
{
    std::vector<int> v1; // Standard vector.
    vec::vector<int> v2; // User defined vector.
 
    v1 = v2; // Error: v1 and v2 are different object's type.
 
    {
        using namespace std;
        vector<int> v3; // Same as std::vector
        v1 = v3; // OK
    }
 
    {
        using vec::vector;
        vector<int> v4; // Same as vec::vector
        v2 = v4; // OK
    }
 
    return 0;
}


[Bearbeiten] Siehe auch

Namespacealias
erstellt einen Alias ​​eines vorhandenen Namespace
Original:
creates an alias of an existing namespace
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]