当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Julia Core.fieldtype用法及代码示例


用法:

fieldtype(T, name::Symbol | index::Int)

确定复合 DataType T 中字段的声明类型(由名称或索引指定)。

例子

julia> struct Foo
           x::Int64
           y::String
       end

julia> fieldtype(Foo, :x)
Int64

julia> fieldtype(Foo, 2)
String

相关用法


注:本文由纯净天空筛选整理自julialang.org 大神的英文原创作品 Core.fieldtype — Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。