From d92fe05176230138be886f83e352065d1017bfe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Thu, 17 Nov 2022 14:21:35 +0100 Subject: [PATCH 1/2] force qualified names for recursion --- include/gridtools/fn/unstructured.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/gridtools/fn/unstructured.hpp b/include/gridtools/fn/unstructured.hpp index 049217a65..b175e4a5a 100644 --- a/include/gridtools/fn/unstructured.hpp +++ b/include/gridtools/fn/unstructured.hpp @@ -101,10 +101,13 @@ namespace gridtools::fn { template GT_FUNCTION constexpr auto shift( iterator const &it, Dim, Offset offset, Offsets... offsets) { - if constexpr (has_key()) { - return shift(horizontal_shift(it, Dim(), offset), offsets...); + if constexpr (sizeof...(offsets) == 0) { + return it; + } + else if constexpr (has_key()) { + return unstructured_impl_::shift(horizontal_shift(it, Dim(), offset), offsets...); } else { - return shift(non_horizontal_shift(it, Dim(), offset), offsets...); + return unstructured_impl_::shift(non_horizontal_shift(it, Dim(), offset), offsets...); } } template From f0bb2b3599a8fd7ca3e0a3a4d3003a2d175a308c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Thu, 17 Nov 2022 17:04:14 +0100 Subject: [PATCH 2/2] fixed logic --- include/gridtools/fn/unstructured.hpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/gridtools/fn/unstructured.hpp b/include/gridtools/fn/unstructured.hpp index b175e4a5a..0de6a4edc 100644 --- a/include/gridtools/fn/unstructured.hpp +++ b/include/gridtools/fn/unstructured.hpp @@ -98,22 +98,20 @@ namespace gridtools::fn { return shifted; } + template + GT_FUNCTION constexpr auto shift(iterator const &it) { + return it; + } + template GT_FUNCTION constexpr auto shift( iterator const &it, Dim, Offset offset, Offsets... offsets) { - if constexpr (sizeof...(offsets) == 0) { - return it; - } - else if constexpr (has_key()) { + if constexpr (has_key()) { return unstructured_impl_::shift(horizontal_shift(it, Dim(), offset), offsets...); } else { return unstructured_impl_::shift(non_horizontal_shift(it, Dim(), offset), offsets...); } } - template - GT_FUNCTION constexpr auto shift(iterator const &it) { - return it; - } template struct make_iterator {