| General topics | ||||||||||||||||
| Flow control | ||||||||||||||||
| Conditional execution statements | ||||||||||||||||
| Iteration statements (loops) | ||||||||||||||||
| Jump statements | ||||||||||||||||
| Functions | ||||||||||||||||
| Function declaration | ||||||||||||||||
| Lambda function expression | ||||||||||||||||
inline specifier | ||||||||||||||||
| Dynamic exception specifications(until C++17*) | ||||||||||||||||
noexcept specifier(C++11) | ||||||||||||||||
| Exceptions | ||||||||||||||||
| Namespaces | ||||||||||||||||
| ||||||||||||||||
| Types | ||||||||||||||||
| Specifiers | ||||||||||||||||
| ||||||||||||||||
| Storage duration specifiers | ||||||||||||||||
| Initialization | ||||||||||||||||
| Expressions | ||||||||||||||||
| Alternative representations | ||||||||||||||||
| Literals | ||||||||||||||||
| Boolean -Integer -Floating-point | ||||||||||||||||
| Character -String -nullptr(C++11) | ||||||||||||||||
| User-defined(C++11) | ||||||||||||||||
| Utilities | ||||||||||||||||
| Attributes(C++11) | ||||||||||||||||
| Types | ||||||||||||||||
typedef declaration | ||||||||||||||||
| Type alias declaration(C++11) | ||||||||||||||||
| Casts | ||||||||||||||||
| Memory allocation | ||||||||||||||||
| Classes | ||||||||||||||||
| Class-specific function properties | ||||||||||||||||
| ||||||||||||||||
| Special member functions | ||||||||||||||||
| Templates | ||||||||||||||||
| Miscellaneous | ||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Namespace aliases allow the programmer to define an alternate name for a namespace.
They are commonly used as a convenient shortcut for long or deeply-nested namespaces.
Contents |
namespacealias_name =ns_name; | (1) | ||||||||
namespacealias_name =::ns_name; | (2) | ||||||||
namespacealias_name =nested_name::ns_name; | (3) | ||||||||
The new aliasalias_name provides an alternate method of accessingns_name.
alias_name must be a name not previously used.alias_name is valid for the duration of the scope in which it is introduced.
#include <iostream> namespace foo{namespace bar{namespace baz{int qux=42;}}} namespace fbz= foo::bar::baz; int main(){std::cout<< fbz::qux<<'\n';}
Output:
42
| namespace declaration | identifies a namespace[edit] |
| type alias declaration(C++11) | creates a synonym for a type[edit] |