Make LocalKey constexpr
Summary
A LocalKey
is essentially just a tuple with three named components, subEntity
, codim
, and index
. There is no reason why this should not be constexpr
. This would allow to use LocalKey
s in other constexpr
contexts. This MR implements this change.
Additionally, the observable properties are marked [[nodiscard]]
. The consequence is that you cannot silently ignore the return value of these functions. This could, theoretically, break existing code. Thus, a system test will be run to make sure that in the many commonly used modules it has not effect. The attributes prevents from using these functions wrongly, e.g., forgetting to inspect the outcome of the functions.
Possible improvements
- Make the
operator<
alsoconstexpr
. The comparison operator instd::array
is constexpr with > c++20. - Allow to use the
LocalKey
in a structured binding. The easiest way would be to make it an actual aggregate type. - Make
LocalKey
usable in unordered containers, i.e., provide a hash function and a equal-comparison operator.
System pipelines
Edited by Simon Praetorius