From 0b5cf1f276aec359e1d502f4e1749665c62d2414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Wed, 1 Jul 2020 14:13:52 +0200 Subject: [PATCH] Faster LazyMap --- src/Utilities/lazy_iterators.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Utilities/lazy_iterators.jl b/src/Utilities/lazy_iterators.jl index a7b44938a9..6e55d5ffe0 100644 --- a/src/Utilities/lazy_iterators.jl +++ b/src/Utilities/lazy_iterators.jl @@ -14,12 +14,12 @@ Iterator over the elements of `data` mapped by `f`. This is similar to `Base.Generator(f, data)` except that the `eltype` of a `LazyMap` is given at construction while the `eltype` of `Base.Generator(f, data)` is `Any`. """ -struct LazyMap{T, VT} - f::Function +struct LazyMap{T, VT, F} + f::F data::VT end -function LazyMap{T}(f::Function, data) where {T} - return LazyMap{T, typeof(data)}(f, data) +function LazyMap{T}(f, data) where {T} + return LazyMap{T, typeof(data), typeof(f)}(f, data) end Base.size(it::LazyMap) = size(it.data) function Base.iterate(it::LazyMap, args...)