diff --git a/doc/contributing/source/coding-style.rst b/doc/contributing/source/coding-style.rst index 8ad43ab91..b2a80f2b1 100644 --- a/doc/contributing/source/coding-style.rst +++ b/doc/contributing/source/coding-style.rst @@ -1415,6 +1415,21 @@ of rules that should be observed while developing code. MyClass myClass; MyClass.StaticFunction(); +- Prefer using type traits in short form ``traits_t<...>`` and ``traits_v<...>``, + instead of the long form ``traits<...>::type`` and ``traits<...>::value``, respectively. + + .. sourcecode:: cpp + + // Prefer using the shorter version of type traits + std::is_same_v + std::is_integral_v + std::enable_if_t, Time> + + // Avoid the longer form of type traits + std::is_same::value + std::is_integral::value + std::enable_if::value, Time>::type + - Prefer to use ``static_assert()`` over ``NS_ASSERT()`` when conditions can be evaluated at compile-time.