https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91356

--- Comment #5 from Niels Möller <nisse at lysator dot liu.se> ---
(In reply to Jonathan Wakely from comment #4)
> Why wouldn't you take unique_ptr<T>&& instead of passing by value?

Because passing unique_ptr (and other move-only types) by value seems to be the
mainstream idiomatic way to pass around ownership in C++. I'm confident I could
save 0.05% binary size on webrtc's AppRTCMobile.apk by passing unique_ptr<T>&&
everywhere. But my closest C++ experts consider that not a good enough reason
to depart from the more mainstream idiom, and I think they have a good point.

Maybe it's a revival of the old Lisp tradition to write code for clarity, and
in case the compiler generates poor code, just put your faith in future
compiler improvements.

> I'm closing this bug, as there's nothing libstdc++ can do here.

Any improvement needs cooperation between g++ and libstdc++; I was hoping this
bug report would reach relevant people involved on both sides.

Reply via email to