ginkgo-project / ginkgo

Numerical linear algebra software package
https://ginkgo-project.github.io/
BSD 3-Clause "New" or "Revised" License
384 stars 86 forks source link

`static_assert` on supported index and value types #1555

Open upsj opened 4 months ago

upsj commented 4 months ago

To make issues like #1554 more clearly visible, we should have a static_assert in-place with our pre-compiled classes that prevents usage of unsupported types. Maybe something like

template <typename>
struct supported_index_type { constexpr static bool value = false; };
template <> struct supported_index_type<int32> { constexpr static bool value = true; };
template <> struct supported_index_type<int64> { constexpr static bool value = true; };

would help