Skip to content

question about outer constructors #721

@githubtomtom

Description

@githubtomtom

@generated function (::Type{SArray{S, T, N}})(x::Tuple) where {S <: Tuple, T, N}

in above I see the use of generated function for outer constructors.

what is the difference (and disadvantage) using the following instead?

SArray{S, T, N}(x::Tuple) where {S<:Tuple, T, N} = SArray{S, T, N, tuple_prod(S) }(x)

also, in

@inline (::Type{SDiagonal{N,T}})(a::Tuple) where {N,T} = Diagonal(SVector{N,T}(a))

why don't we define the following?

@inline SDiagonal{N,T}(a::Tuple) where {N,T} = Diagonal(SVector{N,T}(a))

thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions