Skip to content

Commit 0943204

Browse files
authored
0-dim arguments (#15)
Most of the functionality seemed to just work. Only `axes` needed changing.
1 parent 1546b7b commit 0943204

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/StackViews.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function Base.axes(A::StackView{T,N,D}) where {T,N,D}
119119
prev, post = Base.IteratorsMD.split(frame_axes, Val(D-1))
120120

121121
# use homogenous range to make _append_tuple happy
122-
fill_range = convert(typeof(first(frame_axes)), Base.OneTo(1))
122+
fill_range = _convert(eltype(prev), Base.OneTo(1))
123123
return (_append_tuple(prev, Val(D-1), fill_range)...,
124124
Base.OneTo(length(A.slices)),
125125
post...)
@@ -140,6 +140,8 @@ end
140140
end
141141

142142
# utils
143+
_convert(::Type{Base.Bottom}, idx)=idx
144+
_convert(T::Type, idx)=convert(T, idx)
143145

144146
# For type stability
145147
@inline _max(::Val{x}, ::Val{y}) where {x, y} = Val(max(x, y))

0 commit comments

Comments
 (0)