Skip to content

Commit 5b4e390

Browse files
authored
Merge pull request #8 from N5N3/extendable_bc
Move `StaticArrayStyle` here.
2 parents c97edbf + 4fd3332 commit 5b4e390

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "StaticArraysCore"
22
uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3-
version = "1.1.0"
3+
version = "1.2.0"
44

55
[compat]
66
julia = "1.6"

src/StaticArraysCore.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,4 +384,9 @@ array operations as in the example below.
384384
"""
385385
abstract type FieldVector{N, T} <: FieldArray{Tuple{N}, T, 1} end
386386

387+
# Add a new BroadcastStyle for StaticArrays, derived from AbstractArrayStyle
388+
# A constructor that changes the style parameter N (array dimension) is also required
389+
struct StaticArrayStyle{N} <: Base.Broadcast.AbstractArrayStyle{N} end
390+
StaticArrayStyle{M}(::Val{N}) where {M,N} = StaticArrayStyle{N}()
391+
387392
end # module

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ using StaticArraysCore, Test
2222
@test StaticArraysCore.tuple_length((5, 3)) == 2
2323
@test StaticArraysCore.tuple_prod((5, 3)) == 15
2424
@test StaticArraysCore.tuple_minimum((5, 3)) == 3
25+
26+
@test StaticArraysCore.StaticArrayStyle{1}(Val(2)) === StaticArraysCore.StaticArrayStyle{2}()
2527
end

0 commit comments

Comments
 (0)