From af3d4809763ef308f08ced947a73b624729ac7ea Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen Automatic Types
auto
Automatic type deduction
-TODO: documentation link
+
+auto specifier
Use according to the Google
Style Guide on
@@ -193,7 +194,8 @@ Style Guide.
auto
. Discussion thread. Another discussion thread.Null Pointer Constant
nullptr
Declares a type-safe null pointer
-TODO: documentation link
+
+nullptr
Recommended for new code.
Discussion thread.
Google Style Guide.
@@ -214,7 +216,8 @@ Note: std::nullptr_t
is a library feature and not available.
for (type var : range)
Facilitates a more concise syntax for iterating over the elements
of a container (or a range of iterators) in a
-for
loopTODO: documentation link
+
+Range-based for loop
As a rule of thumb, use
@@ -249,7 +252,8 @@ Are Variadic macros nonstandard?
for (const auto& ...)
, for (auto& ...)
, or for (concrete type ...)
. For pointers, use for (auto* ...)
to make clear that the copy of the loop variable is intended, and only a pointer is copied. Discussion threadVariadic Templates
template <typename ... arg>
Allows templates that accept a variable number of arguments
-TODO: documentation link
+
+Parameter pack
Usage should be rare. Use instead of .pump files. Discussion thread
@@ -281,7 +285,8 @@ codebase.
Constant Expressions
constexpr
Compile-time constant expressions
-TODO: documentation link
+
+constexpr specifier
Doesn't work in MSVS2013. Reevalute once it does. Google
Style Guide on
@@ -332,7 +337,8 @@ Fundamental types
constexpr
string var=R"(raw_string)";
Allows a string to be encoded without any escape
sequences, easing parsing in regex expressions, for example
-TODO: documentation link
+
+string literal
Causes incorrect line numbers in MSVS2014 and gcc. Reevaluate once that works. Discussion thread
@@ -340,7 +346,8 @@ sequences, easing parsing in regex expressions, for example
Rvalue References (and Move Semantics)
T(T&& t)
and T& operator=(T&& t)
Reference that only binds to a temporary object
-TODO: documentation link
+
+Rvalue references
To be revisited in the future. Allowed in exceptional cases where approved by the OWNERS of src/styleguide/c++/. Discussion thread
@@ -402,6 +409,7 @@ work in all our compilers yet.
alignas
specifier,
+alignof
operator,
std::alignment_of<T>
,
std::aligned_union<Size, ...Types>
and
std::max_align_t
type var = literal_value_type