From fb403c37c45ee2e7c8fd13887dc5ac7f0b45a7e0 Mon Sep 17 00:00:00 2001 From: Marcel Koch Date: Fri, 30 Jun 2023 09:45:04 +0200 Subject: [PATCH] disable ambiguous range constructor this should fix the bug reported by sonarcloud: https://sonarcloud.io/project/issues?open=AYTucKfs8qk247btl14g&id=ginkgo-project_ginkgo --- include/ginkgo/core/base/range.hpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/include/ginkgo/core/base/range.hpp b/include/ginkgo/core/base/range.hpp index c9713f33572..48789f41f95 100644 --- a/include/ginkgo/core/base/range.hpp +++ b/include/ginkgo/core/base/range.hpp @@ -188,6 +188,27 @@ GKO_ATTRIBUTES constexpr GKO_INLINE equal_dimensions(first, second); } +/** + * Helper that stores the first type of a parameter pack, if its length is + * greater 0. + */ +template +struct head; + +/** + * @copydoc head + */ +template +struct head { + using type = First; +}; + +/** + * @copydoc head + */ +template +using head_t = typename head::type; + } // namespace detail @@ -327,7 +348,11 @@ class range { * * @param params parameters forwarded to Accessor constructor. */ - template + template >>>> GKO_ATTRIBUTES constexpr explicit range(AccessorParams&&... params) : accessor_{std::forward(params)...} {}