Skip to content

Commit 54e5b69

Browse files
authored
minor bugfix in PiecewiseSegment constructor (#317)
* minor bugfix in PiecewiseSegment constructor * fix indexing
1 parent f68b679 commit 54e5b69

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Domains/PiecewiseSegment.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ struct PiecewiseSegment{T,V<:AbstractVector{T}} <: Domain{T}
44
points::V
55
end
66
PiecewiseSegment{T}(d::V) where {T,V<:AbstractVector{T}} = PiecewiseSegment{T,V}(d)
7-
PiecewiseSegment(d...) = PiecewiseSegment(SVector{length(d), promote_eltypeof(d)}(d))
7+
PiecewiseSegment(d...) = PiecewiseSegment(SVector{length(d), mapfoldl(typeof, promote_type, d)}(d))
88

99
function PiecewiseSegment(pcsin::AbstractVector{IT}) where IT<:IntervalOrSegment
1010
pcs=collect(pcsin)
1111
p=(pop!(pcs))
1212
successful=true
1313
while successful
1414
successful=false
15-
for k=1:length(pcs)
15+
for k in axes(pcs, 1)
1616
if leftendpoint(pcs[k]) == last(p)
1717
push!(p,rightendpoint(pcs[k]))
1818
deleteat!(pcs,k)

0 commit comments

Comments
 (0)