Re:Care is needed to use C++ std:optional with non-trivial o...
by kadoban on Friday January 13, 2023 @09:37AM
(#34368261)
The article's example of using std::optional doesn't seem very realistic, so its counts of copies don't feel compelling at all. Their code is causing almost all of them.
They also didn't confirm with a compiler which will actually be copies or what can be elided (either automatically or manually/by better use of types), making it even less compelling.
They also didn't confirm with a compiler which will actually be copies or what can be elided (either automatically or manually/by better use of types), making it even less compelling.