CppCoreGuidelines
CppCoreGuidelines copied to clipboard
The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++
This is a rule that I've been following for many years that, in my experience, makes code less error-prone. Here's some suggested text: (start suggested text) Try to keep code...
Some member functions and operators return references, the obvious cases being assignment operator and subscript operators, as well as accessor functions in some cases. I begin with assignment operators, since...
If use pointer, is C.12 saying to use non-const pointer? I'm referring to const of the pointer itself, not the object that is pointed to: I.e. `ClassXyz* const _ptr` not...
Avoided a potential misunderstanding that `throw e` would slice *any* `e` to `std::exception`. The note about rethrowing appears to be written when the example of this item still did `catch...
Is std::span an example of a lightweight wrapper that is often used as an in-out parameter but is commonly not passed by reference?
https://github.com/isocpp/CppCoreGuidelines/blob/6f27719b2b994d1304f78194dc7824e4ddeea5f5/CppCoreGuidelines.md?plain=1#L18251 The argument of `copy_trait` must be a container element type instead of `Iter`. Probably there should be `copy_trait` like in the next sample. https://github.com/isocpp/CppCoreGuidelines/blob/6f27719b2b994d1304f78194dc7824e4ddeea5f5/CppCoreGuidelines.md?plain=1#L18266-L18267 And another typo is in...
Although it is possible to include an interface as a library (or through the search path), it is much more common and standard using `#include "foo.h"` for interfaces of classes,...
[F.21: To return multiple “out” values, prefer returning a struct or tuple](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-out-multi) currently suggests: ```c++ // GOOD: self-documenting tuple f(const string& input) { // ... return make_tuple(status, something()); } ```...
Applies change stated in issue #1943. Signed-off-by: Daniel Kříž
The code was likely copied from the example above, but the return type was not replaced.