-
- Downloads
[concept] Return check result as std::integral_constant<bool, *>
By using "std::integral_constant<bool, *>" instead of "constexpr bool" as return type for Dune::models(), the result can directly be used in Dune::Hybrid::ifElse(): T t; ifElse(models<HasFoo, T>(), [&](auto id) { id(t).foo(); }, [&](auto id) { id(t).bar(); }); Before one would have to create the integral constant manually to turn ifElse() into static mode. The change is backward compatible because integral_constant<bool, *> casts to bool. Notice that this change requires a small reorganization of code. To use models() internally we need a forward declaration which is not possible if the type is deduced (as it is now). Hence a new function Imp:models() with "constexpr bool" return type is added for internal use. Its result is encoded as integral_constant by the actual interface method.
Please register or sign in to comment