Skip to content

Assignment with Std::optional

I think commit 93e7d878 somehow broke the assignment for the Dune std::optional.

The following compiles with a C++17 compiler:

auto a = std::optional<int>();
auto b = std::optional<int>(4);
a=b;

but doing the same with Dune::Std::Optional does not work (G++ 6.3):

error: use of deleted function ‘constexpr Dune::Std::optional<int>& Dune::Std::optional<int>::operator=(const Dune::Std::optional<int>&)’
a=b;

note: ‘constexpr Dune::Std::optional<int>& Dune::Std::optional<int>::operator=(const Dune::Std::optional<int>&)’ is implicitly declared as deleted because ‘Dune::Std::optional<int>’ declares a move constructor or move assignment operator
     class optional
           ^~~~~~~~