Allowed C++ Standard Features

A feature might be in either the 'Needs validation', 'Allowed' or 'Disallowed' state. The significance of these states are as follows:

  1. Needs validation
    1. The feasibility of using the feature in CRYENGINE's code base is yet to be validated by the CRYENGINE's Technical Leads.
  2. Allowed
    1. The feature doesn't introduce 'show-blocking' issues.
    2. The feature improves, or at least doesn't harm, code runtime and compile time performance.
    3. The feature improves, or at least doesn't harm, code readability or debugability.
    4. The feature is supported by all the compilers that the CRYENGINE code base is compiled against.
  3. Disallowed
    1. The feature introduces a 'show-blocking' issue.
    2. The feature has a negative impact on runtime and compile time performance.
    3. The feature has a negative impact on code readability and debugability.
    4. The feature generally doesn't contribute to the overall quality and performance of the CRYENGINE code base.
    5. The feature is not supported by a CRYENGINE code base compiler.

C++17 Language Features

FeatureStateComments
Template argument deduction for class templatesNeeds validation-
Declaring non-type template parameters with autoNeeds validation-
Folding expressionsNeeds validation-
New rules for auto deduction from braced-init-listNeeds validation-
Constexpr lambdaNeeds validation-
Lambda capture this by valueNeeds validation-
Inline variablesNeeds validation-
Nested namespacesAllowedThis feature is considered light weight and doesn’t negatively impact code quality or run-time/compile-time performance. It is one of the first C++17 features adopted by compiler vendors, and has therefore been made available even on older tool-chains such as vc140. It is more of a cosmetic feature, since it helps improve readability in nested namespace scenarios.
Structured bindingsNeeds validation-
Selection statements with initializerNeeds validation-
Constexpr ifNeeds validationThe feature greatly simplifies compile-time branching that was only possible through overloading or specialization / SFINAE. It improves compile time and readability. The feature is available on all platforms and compilers (VS2017.3)
Utf-8 character literalsNeeds validation-
Direct-list-initialization of enumsNeeds validation-
New standard attributes [[fallthrough]], [[nodiscard]], [[maybe_unused]] AllowedThe [[nodiscard]] attribute, when put in front of function return type, can prevent discarding important return value or error code or misunderstanding the purpose of function. A typical example is the confusion of .empty() with .clear() in custom containers. With [[nodiscard]] the compiler issues a warning.
Terse static_assertNeeds validation

The terse form of static_assert is useful when the evaluated expression contains enough information that an additional message would be redundant.

Supported by all compilers. (VS2017.0)

Example:

static_assert(std::is_default_constructible_v<T>) is equally readable than static_assert(std::is_default_constructible_v<T>, "Must be default constructible")

C++17 Library Features

FeatureStateComments
std::variantNeeds validation(Note: newly supported by PS4 SDK 7.0)
std::optionalNeeds validation(Note: newly supported by PS4 SDK 7.0)
std::anyDisallowedNot supported on PS4 as of SDK 7.0 when RTTI is turned off.
std::string_viewNeeds validation-

<functional>

std::invoke, std::not_fn

Needs validation-

<tuple>

std::apply, std::make_from_tuple

Needs validation-

<type_traits>

std::void_t, std::conjunction, std::disjunction, std::negation, std::invoke_result, std::is_invocable, std::bool_constant



std::filesystemNeeds validation-
std::byteNeeds validation-
Splicing for maps and setsNeeds validation-
Parallel algorithmsNeeds validation-

C++14 Language Features

FeatureStateComments
Binary literalsNeeds validation-
Generic lambda expressionsNeeds validation

Taking parameters by auto type makes lambda on-par with template functions. It is a great improvement to callbacks and generic algorithms that would be otherwise unnecessarily verbose. It also enables designs such as generic visitor pattern which wasn't possible without the feature.

The feature is supported by all compilers.

Lambda capture initializersNeeds validation-
Return type deductionNeeds validation-
Decltype(auto)Needs validation-
Relaxing constraints on constexpr functionsNeeds validation

The feature allows constexpr function to be written in almost identical style as normal run-time functions, improving readability and compile time.

Supported by all compilers.

Variable templatesNeeds validation-
[[deprecated]] attributeNeeds validation-

C++14 Library Features

FeatureStateComments
User-defined literals for standard library typesNeeds validation-
Compile-time integer sequencesNeeds validation

std::integer_sequence and std::index_sequence are useful template-metaprogramming tools that help transform variadic template arguments or constexpr array. Compilers usually implement the feature as magic intrinsics, which speeds up the compilation compared to the manually implemented recursive template.

Supported compilers - ?

std::make_uniqueNeeds validation-