mantid
mantid copied to clipboard
Migrate from boost::optional to std::optional - c++17
In interest of using compiler features over library features, move from boost::optional to std::optional which has been in the language since C++17. Like other things that have been matured in boost before migrated to the standard, this requires changing
-
#include <boost/optional.h>
becomes#include <optional>
-
boost::optional<T>
tostd::optional<T>
-
get_value_or()
becomesvalue_or()
-
get()
becomesvalue()
-
boost::none
becomesstd::nullopt
Separately, the following requires special attention to move to using std::optional
.
... and a bunch of things in ISIS reflectometry
- qt/scientific_interfaces/ISISReflectometry/ <- the whole thing
- Framework/API/inc/MantidAPI/BoostOptionalToAlgorithmProperty.h and cpp files
- qt/widgets/common/inc/MantidQtWidgets/Common/Batch/ and cpp files
This article gives a nice summary on why optional <T&>
is a bad idea. Unfortunately, it is found several places in the ISIS reflectometry GUI.