dxx-rebirth/Documentation/c++std.markdown
Kp b396445efa Require support for std::index_sequence, std::make_index_sequence
The minimum supported compiler versions now provide a depth-efficient
implementation of std::make_index_sequence, which removes the last
reason to carry a private implementation.  In the case of clang, it
appears to have a special compiler intrinsic used to implement its
std::make_index_sequence.

Switch to the compiler-provided version for both gcc and clang.
2020-04-26 17:26:23 +00:00

6.4 KiB

Required C++11 features

DXX-Rebirth code uses C++11 and C++14 features present in >=clang-9.0 and >=gcc-7.5. Some of these features are probed in the SConf tests so that an error can be reported if the feature is missing. However, since these are considered the minimum supported compiler versions, and existing SConf tests reject older compilers, some C++14 features that are new in gcc-7.5 may be used without a corresponding test in SConf.

These C++11 features are required to build DXX-Rebirth:

Required C++14 features

Optional C++11/C++14 features

DXX-Rebirth code may use C++11 or C++14 features not present in the minimum supported compiler if the feature can be emulated easily (C++11: inheriting constructors, Range-based for; C++14: std::exchange, std::make_unique) or if the feature can be removed by a macro and the removal does not change the correctness of the program (C++11: rvalue-qualified member methods).

Optional C++11 features

Emulated if absent

  • Inheriting constructors are wrapped by the macro DXX_INHERIT_CONSTRUCTORS. If inherited constructors are supported, then DXX_INHERIT_CONSTRUCTORS expands to a using declaration. If inherited constructors are not supported, then DXX_INHERIT_CONSTRUCTORS defines a variadic template constructor to forward arguments to the base class.
  • Range-based for is wrapped by the macro range_for. This feature is present in the current minimum supported compiler versions. It was first used when >=gcc-4.5 was the minimum. Use of the range_for macro continues because it improves readability.

Preprocessed out if absent

  • Reference-qualified methods check that an rvalue which may or may not hold a valid pointer is not used in a context where the caller assumes the rvalue holds a valid pointer. When the rvalue may or may not hold a valid pointer, it must be saved to an lvalue, tested for a valid pointer, and used only if a valid pointer is found.

Optional C++14 features