[Dune-devel] PSA: please avoid implicit conversion integral_constant<bool, ...> to bool

Jö Fahlke jorrit at jorrit.de
Mon Feb 27 16:08:29 CET 2017


Hi!

I have to make a correction: The problem does not occur with incomplete types.
Rather, the problem occurs with types that are template specializations with a
definition (meaning they are complete), but where instantiation of the
definition leads to errors.  Call them "non-instantiable types" if you want, I
didn't see the standard use any particular name for these kinds of types.

[...]
> > That would work, but then you have to determine whether the expression may
> > involve incomplete types.  Most of the time in template code you can't be sure
> > that the passed-in types are sufficiently complete.
> But you can be sure if you have a type or an object.
> In case of the latter there is no problem whereas
> you may want to play safe in case of the former.
> This will lead to:
> 
>   As a rule of thumb try to avoid creating an object of type
>   integral_constant<T,k> just to extract its value.

I had a phone call with Carsten -- this rule of thumb should work too, at
least as long as the implicit conversion is the problem.

Regards,
Jö.

-- 
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729

A mathematician is a device to turn coffee into theorems.
-- Paul Erdős
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20170227/9ad57c94/attachment.sig>


More information about the Dune-devel mailing list