Return Type Attributes: auto ref and inout
You will learn about the auto ref and inout type of functions.
We'll cover the following
auto ref
functions
auto ref
helps with functions like parenthesized()
below. Similar to auto
, the return type of an auto ref
function is deduced by the compiler. Additionally, if the returned expression can be a reference, that variable is returned by a reference as opposed to being copied.
parenthesized()
can be compiled if the return type is auto ref
:
Get hands-on with 1400+ tech skills courses.