Simplify CHECK_INTERFACE_IMPLEMENTATION
In dune-common/dune/common/bartonnackmanifcheck.hh we have the macro CHECK_INTERFACE_IMPLEMENTATION, which checks whether a method in a CRTP base class is really overriden in the the derived class. The check has serious side-effects (in particular, there is an extra call to the derived method), and it is therefore only enabled under certain circumstances.
The member function pointer trick in merge request !82 (merged) suggests a different way to check whether a method is overridden: get pointers to the method in the base class and in the derived class, and check whether they differ. I'll attach a prototype implementation to this report.
Advantages:
- shorter code
- no run-time cost at all: the conditional involves only compile-time information, which can be expected to be elided by the optimizer.
- even if it is not elided, the overhead is a simple pointer comparison; there is no additional call to the derived method.
- as a consequence, the check can remain enabled at all times, and we can retire the DUNE_INTERFACECHECK build option
Does anybody volunteer to create a merge request?