Skip to content

Add a C++14 implementation of C++17's std::variant

In dune-subgrid we wanted to use std::variant which is part of C++17's STL (see e.g. here). Since the corresponding compilers (or rather STL implementations) aren't too widespread by now and also out of pure curiosity, I reimplemented std::variant myself using only C++14 and some of Dune::Hybrid. In the end I ended up with a implementation that covers most of the STL functionality and behaves more or less the same way (though it probably won't be as safe, fast or complete as e.g. the gcc implementation, of course). If this might be of any value for the Dune project, I'd be happy to contribute this to dune-common.

Edited by Oliver Sander

Merge request reports