umbrello: test/import/cxx/cxx11-constexpr.h Source File

umbrello 2.38.1 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

cxx11-constexpr.h
Go to the documentation of this file.
1// https://en.wikipedia.org/wiki/C%2B%2B11#constexpr_.E2.80.93_Generalized_constant_expressions
2
3// #1
4 constexpr int get_five() {return 5;}
5 int some_value[get_five() + 7]; // Create an array of 12 integers. Legal C++11
6
7// #2
8 constexpr double earth_gravitational_acceleration = 9.8;
9 constexpr double moon_gravitational_acceleration = earth_gravitational_acceleration / 6.0;
10
11class ConstExprConstructorDeclaration {
12 constexpr ConstExprConstructorDeclaration(QString &param);
13};
14
15class ConstExprConstructorDefinition {
16 constexpr ConstExprConstructorDefinition(QString &param) {}
17};
18
19class ExplicitConstExprConstructorDeclaration {
20 explicit constexpr ExplicitConstructorDeclaration(QString &param);
21};
22
23class ExplicitConstExprConstructorDefinition {
24 explicit constexpr ExplicitConstructorDefinition(QString &param) {}
25};
ConstExprConstructorDeclaration
Definition: cxx11-constexpr.cpp:11
ConstExprConstructorDeclaration::ConstExprConstructorDeclaration
constexpr ConstExprConstructorDeclaration(QString &param)
ConstExprConstructorDefinition
Definition: cxx11-constexpr.cpp:15
ConstExprConstructorDefinition::ConstExprConstructorDefinition
constexpr ConstExprConstructorDefinition(QString &param)
Definition: cxx11-constexpr.h:16
ExplicitConstExprConstructorDeclaration
Definition: cxx11-constexpr.cpp:19
ExplicitConstExprConstructorDeclaration::ExplicitConstructorDeclaration
constexpr ExplicitConstructorDeclaration(QString &param)
ExplicitConstExprConstructorDefinition
Definition: cxx11-constexpr.cpp:23
ExplicitConstExprConstructorDefinition::ExplicitConstructorDefinition
constexpr ExplicitConstructorDefinition(QString &param)
Definition: cxx11-constexpr.h:24
some_value
int some_value[get_five()+7]
Definition: cxx11-constexpr.h:5
get_five
constexpr int get_five()
Definition: cxx11-constexpr.h:4
moon_gravitational_acceleration
constexpr double moon_gravitational_acceleration
Definition: cxx11-constexpr.h:9
earth_gravitational_acceleration
constexpr double earth_gravitational_acceleration
Definition: cxx11-constexpr.h:8