Common Practices and Code Improvements
- 'contains' member function can be used
'contains' member function can be used.
- 'if' can be replaced by 'if consteval'
'if' can be replaced by 'if consteval'.
- 'std::erase'/'std::erase_if' can be used instead of the remove-erase idiom
'std::erase'/'std::erase_if' can be used instead of the remove-erase idiom.
- 'std::is_constant_evaluated' will always evaluate to constant
'std::is_constant_evaluated' will always evaluate to constant.
- Algorithm accepting an iterator and a count can be used
Algorithm accepting an iterator and a count can be used.
- Algorithm operating on ranges can be used
Algorithm operating on ranges can be used.
- C-style cast is used instead of a C++ cast
C-style cast is used instead of a C++ cast.
- Class can be made final
Class can be made final.
- Compile-time constant expression can be replaced with either 'true' or 'false'
Compile-time constant expression can be replaced with either 'true' or 'false'.
- consteval if is always constant
consteval if is always constant.
- Constructor of smart pointer is used instead of its make function
Constructor of smart pointer is used instead of its make function.
- Declaration and assignment can be joined
Declaration and assignment can be joined.
- For-loop can be replaced with while-loop
For-loop can be replaced with while-loop.
- Function returns by const value
Function returns by const value.
- Functional-style cast is used instead of a C++ cast
Functional-style cast is used instead of a C++ cast.
- If statement with constant condition can be replaced with 'if constexpr'
If statement with constant condition can be replaced with 'if constexpr'.
- Lambda can be rewritten to use explicit template parameters
Lambda can be rewritten to use explicit template parameters.
- Local variable can be made const
Local variable can be made const.
- Member function can be made const
Member function can be made const.
- Member function can be made static
Member function can be made static.
- Namespace definition containing single class specialization
Namespace definition containing single class specialization.
- Non-explicit conversion operator
Non-explicit conversion operator.
- Non-explicit converting constructor
Non-explicit converting constructor.
- Parameter can be made const
Parameter can be made const.
- Parameter can be made pointer/reference to const
Parameter can be made pointer/reference to const.
- Pass value parameters by const reference
Pass value parameters by const reference.
- reinterpret_cast is used instead of static_cast
reinterpret_cast is used instead of static_cast.
- Result of a postfix operator is discarded
Result of a postfix operator is discarded.
- std::size can be used
std::size can be used.
- std::views::keys/values can be used
std::views::keys/values can be used.
- Structured bindings can be used
Structured bindings can be used.
- Structured bindings can be used instead of tie(..)
Structured bindings can be used instead of tie(..).
- Throw expression can be replaced with a rethrow expression
Throw expression can be replaced with a rethrow expression.
- Type trait can be simplified using a template alias or a variable template
Type trait can be simplified using a template alias or a variable template.
- Variable can be made constexpr
Variable can be made constexpr.
- Variable can be moved to init statement
Variable can be moved to init statement.
- Variable can be moved to inner scope
Variable can be moved to inner scope.
- Zero constant can be replaced with nullptr
Zero constant can be replaced with nullptr.
- Zero initialization can be used instead of memset
Zero initialization can be used instead of memset.