Please enable JavaScript.
Coggle requires JavaScript to display documents.
C++ Declearation - Coggle Diagram
C++ Declearation
property
scop
type
storage duration
linkage
declaration vs definition
declaration
introduce entity name and its properties to the compiler
the location of properties might be here or somewhere else
declaration specifier
type specifier
int, long ...
non-type specifier
extern, static, virtual
constexpr
const is a type specifier, but constexpr is not
declarator
is a declarator-id (the name declared), possibly surrounded by operators
unary *
pointer
unary &
reference
unary &&
rvalue reference
[]
array
()
function
template <typename T>
void dispatch(T &&arg)
forwarding rvalue reference
example
static unsigned long int *x[N];
declaration specifier
static unsigned long int
type specifier
unsigned long int
non-type specifier
static
constexpr
declarator
*x[N]
declarator-id
x
precedence
Highest
() : grouping
[] : array
() : function
Lowest
* : pointer
& : reference
&& : rvalue reference
special case
const
type specifier
const int *v[N];
v is an array of pointers that contain const int's
declarator
int*const v[N];
v is
initializer
int n(4);
int n{4];
int n = 4;
definition
A declaration with properties right here.
template
keyword typename
template <typename T>
can be replace with class
typename T::size_type size;
can NOT be replaced with class
&&
template <typename T>
void func1(T &&arg1);
forward reference
template <typename> T
void func1(T
const
&&argv1);
rvalue reference
Back to Basics: Declarations in C++ - Ben Saks - CppCon 2022