mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
7d49d4b45d
Somewhere along the way, GSL's implementation of final_act and finally seems to have become way overthought. This PR is to re-simplify these facilities back to what C++ Core Guidelines C.30 said which is simple and clear and works. It just copies the invocable thing, and doesn't bother trying to optimize the copy. This should be fine, because we're typically passing something that's cheap to copy, often a stateless lambda. The problem in #846 appears to be because finally looks like was originally written as a const&/&& overload (its state at the time that issue was opened)... to eliminate a copy when you invoke it with a temporary. If so, then the && was probably never intended to be a forwarder, but an rvalue reference that tripped over the horrid C++ syntax collision where a && parameter magically instead means a forwarding reference because the type happens to be a template parameter type here. So I suspect the original author was just trying to write an rvalue overload, and the forwarder that's there now was never intended at all. |
||
---|---|---|
.. | ||
algorithm_tests.cpp | ||
assertion_tests.cpp | ||
at_tests.cpp | ||
byte_tests.cpp | ||
CMakeLists.txt | ||
CMakeLists.txt.in | ||
deathTestCommon.h | ||
no_exception_ensure_tests.cpp | ||
notnull_tests.cpp | ||
owner_tests.cpp | ||
span_compatibility_tests.cpp | ||
span_ext_tests.cpp | ||
span_tests.cpp | ||
strict_notnull_tests.cpp | ||
string_span_tests.cpp | ||
utils_tests.cpp |