Daily bit(e) of C++ | auto(), auto{}
Daily bit(e) of C++ #276, C++23 prvalue copy syntax: auto(arg), auto{arg}.
The C++23 added a new use case for the auto keyword. auto can now produce a prvalue copy of an argument.
auto(arg) being equivalent to T(arg) and auto{arg} being equivalent to T{arg}, with the benefit that we do not have to get access to T (using T = std::decay_t<decltype(arg)>;).
Due to C++17 direct initialization, auto will never produce excessive copies.
Hi Simon,
Can you explain what happens at the OOPS ? I didnt quite follow that.
Great content by the way, learning new stuff every day!