diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index e7d75a7..9d14c56 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -2954,6 +2954,18 @@ This makes it clear to callers that the object is assumed to be modified. ##### Note +Some user-defined and standard library types, such as `span` or the iterators +are [cheap to copy](#Rf-in) and may be passed by value, while doing so has +mutable (in-out) reference semantics: + + void increment_all(span a) + { + for (auto&& e : a) + ++e; + } + +##### Note + A `T&` argument can pass information into a function as well as out of it. Thus `T&` could be an in-out-parameter. That can in itself be a problem and a source of errors: