* Add '<=>' to comparison operators related rules (C.87, C.167)
C++20's three-way comparison operator should respect the same rules as other
comparison operators.
* Fix a minor typo
Co-authored-by: Jonathan Wakely <github@kayari.org>
Co-authored-by: Jonathan Wakely <github@kayari.org>
This allows the example to remain simple well not misleading a beginner
such a comparison is safe. Including an epsilon comparison or something
similar would overly complicate this example.
Co-authored-by: Martin O'Shea <martin.oshea@native-instruments.com>
* Update C.83 with swap for resource mgmt.
The swap is useful to implement assignments idiomatically (e.g. copy-swap idiom).
With the current enforcement, to non-virtual classes, very simple classes (e.g. `trivially_copyable`, a struct encapsulating an stl container) are suggested to have a swap. This suggestion can be argued wrong since for very simple classes copy-swap idiom is not efficient (the creation of a third object on assignment is not needed, which copy-swap does).
* Rework C.83 according to PR comments.
The various guidelines now have consistent Enforcements.
All C-style casts are now consistently banned, including to `(void)`.
Cast to `(void`)` should be `std::ignore =` instead.
All functional-style casts are now consistently banned, instead of
`T(x)` use `T{x}`.
In English, the word "may" is overloaded and ambiguous. This commit
changes it to "might" wherever possible, otherwise more specific
meanings like "can," "could," or especially "must" ("may not" -> "must
not" when that is intended).
The examples in SF.12 are likely to encourage readers to always use the `""` form of `'#include` when including headers from the same project ([discussion](https://github.com/isocpp/CppCoreGuidelines/pull/1596#issuecomment-673266275)). However, in larger projects this may not always be appropriate; `<>` should be used for includes located via a header search path.
This proposed solution adds an example of the later, i.e. where `<>` is used to include a header from the same project.