A concept-centered standard library for C++20, enabling safer and more reliable products and a more modern feel for C++ code.; Also home of Subdoc the code-documentation generator.
A function receiving const T& and passed a U that is convertible to T will implicitly create a temporary T and pass the reference to that.
But if the function is going to store the reference, then this means it holds a pointer to a temporary. The Google style guide just forbids passing a const& at all in this case.
We use sus::construct::SafelyConstructibleFromReference to prevent implicit conversions at the caller, and apply this to the with() constructor methods on the three types that hold references: Option, Result, and Tuple.
A function receiving const T& and passed a U that is convertible to T will implicitly create a temporary T and pass the reference to that.
But if the function is going to store the reference, then this means it holds a pointer to a temporary. The Google style guide just forbids passing a const& at all in this case.
We use
sus::construct::SafelyConstructibleFromReference
to prevent implicit conversions at the caller, and apply this to thewith()
constructor methods on the three types that hold references: Option, Result, and Tuple.