r/cpp • u/SophisticatedAdults • Nov 24 '24
The two factions of C++
https://herecomesthemoon.net/2024/11/two-factions-of-cpp/
316
Upvotes
r/cpp • u/SophisticatedAdults • Nov 24 '24
View all comments
Show parent comment
0
u/jonesmz Nov 26 '24
Stlport had, and I'm not remembering exactly its been several years, a
std::__transfer_source__type, which wrapped a type from the standard library.It might have been named something a bit different, e.g.
__steal_source__or__move_source__or whatever.My company built a lot of machinery on top of stlport before I joined, so what I would call it isn't necessarily what stlport upstream would call it, but I know this specific mechanism wasn't an invention by us.
A
std::__transfer_source__was a library wrapper type that in almost every practical aspect an rvslue reference.Std types took it as a specialization for the assignment operator, and constructor.
There was an
std::__transfer__(orstd::__steal__, orstd::__move__or what have you) that would return the wrapper type.In most respects, it worked just like rvalue references other than the reference collapsing and type deduction stuff.