Skip to content

added nullopt, in_place and bad_optional_access from std namespace to Dune::Std namespace

Summary

Import types std::nullopt_t, std::in_place_t, and std::bad_optional_access and instances nullopt and in_place of these types into namespace Dune::Std in the file <dune/common/std/optional> in case of DUNE_HAVE_CXX_OPTIONAL is defined.

Motivation

If you have a compiler with c++17 std::optional support, the std implementation is imported into the namespace Dune::Std, but not all Helper classes are imported as well, i.e. nullopt_t, nullopt, in_place_t, in_place and bad_optional_access are missing. So, I neither can use e.g. std::nullopt nor can I use Dune::Std::nullopt, since the first one is defined whenever DUNE_HAVE_CXX_OPTIONAL is set and the second one if it is not set.

Discussion

For the future it has to be decided, whether std::in_place*** is implemented in <dune/common/std/optional> or better in <dune/common/std/utility>, since in the std library it is defined there and used not just for optional but also for variant and any.

Edited by Simon Praetorius

Merge request reports

Loading