Skip to content

Commit 6aecef2

Browse files
committed
Small overload for better performance
1 parent d0507cb commit 6aecef2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ObjFileBase.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ sectionoffset(x::SectionRef) = sectionoffset(deref(x))
144144
handleT{T}(::Union{Type{SectionRef{T}}, Type{Section{T}}, Type{SymbolRef{T}},
145145
Type{SymtabEntry{T}}}) = T
146146
Base.read(s::SectionRef, args...) = read(handle(s), args...)
147+
Base.read{T}(s::SectionRef, ::Type{T}) = read(handle(s), T)::T
147148
Base.position(s::SectionRef) = position(handle(s)) - sectionoffset(s)
148149

149150
abstract StrTab
@@ -329,6 +330,7 @@ end
329330
readmeta(file::AbstractString) = readmeta(open(file,"r"))
330331

331332
read{T<:ObjectHandle}(oh::T, args...) = read(oh.io,args...)
333+
read{H<:ObjectHandle,T}(oh::H, ::Type{T}) = read(oh.io, T)::T
332334

333335
# Others
334336

0 commit comments

Comments
 (0)