Skip to content

Commit f5deb6c

Browse files
authored
Add SFINAE for the slice operator with DiscreteDomain for a Chunk (#1012)
1 parent 5b74ff0 commit f5deb6c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

include/ddc/chunk.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,20 @@ class Chunk : public ChunkCommon<ElementType, SupportType, Kokkos::layout_right>
169169
}
170170

171171
/// Slice out some dimensions
172-
template <class... QueryDDims>
172+
template <
173+
class... QueryDDims,
174+
class SFINAESupportType = SupportType,
175+
std::enable_if_t<is_discrete_domain_v<SFINAESupportType>, int> = 0>
173176
auto operator[](DiscreteDomain<QueryDDims...> const& odomain) const
174177
{
175178
return span_view()[odomain];
176179
}
177180

178181
/// Slice out some dimensions
179-
template <class... QueryDDims>
182+
template <
183+
class... QueryDDims,
184+
class SFINAESupportType = SupportType,
185+
std::enable_if_t<is_discrete_domain_v<SFINAESupportType>, int> = 0>
180186
auto operator[](DiscreteDomain<QueryDDims...> const& odomain)
181187
{
182188
return span_view()[odomain];

include/ddc/chunk_span.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ class ChunkSpan : public ChunkCommon<ElementType, SupportType, LayoutStridedPoli
308308
template <
309309
class... QueryDDims,
310310
class SFINAESupportType = SupportType,
311-
std::enable_if_t<is_discrete_domain_v<SFINAESupportType>, std::nullptr_t> = nullptr>
311+
std::enable_if_t<is_discrete_domain_v<SFINAESupportType>, int> = 0>
312312
KOKKOS_FUNCTION constexpr auto operator[](DiscreteDomain<QueryDDims...> const& odomain) const
313313
{
314314
KOKKOS_ASSERT(

0 commit comments

Comments
 (0)