[Dune-devel] convert `enum` to `static const int`
Ansgar Burchardt
Ansgar.Burchardt at tu-dresden.de
Wed Sep 20 15:42:19 CEST 2017
On Wed, 2017-09-20 at 15:23 +0200, Jö Fahlke wrote:
> Oh, and: `static constexpr` (or `static const`) variables are lvalues, while
> enumerators were prvalues. That means we need to define them (in addition to
> initializing them) without violating the ODR. Otherwise expressions like
> `std::min(GridType::dimension, 2)` can produce linker errors.
Hmm, right. And that would be quite annoying to do...
C++17's inline variables should fix that[1] and `static constexpr`
members would even be inline by default[2], but we can't require C++17
yet.
Ansgar
[1] http://en.cppreference.com/w/cpp/language/static#Static_data_members
[2] http://en.cppreference.com/w/cpp/language/inline
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6519 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20170920/8aa2b940/attachment.bin>
More information about the Dune-devel
mailing list