Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/wrap_tuples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct WrappedTuples{T <: AbstractVector{<:NamedTuple}} <: AbstractVector{NamedT
end

# Required methods for AbstractVector
Base.size(w::WrappedTuples) = (length(w.data), length(first(w.data)))
Copy link
Member

@lazarusA lazarusA Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need this.

The intended use of this is to first do something like soc = WrappedTuples(SOC.history), and then soc.nse to get all values, without the need to use list comprehension.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct WrappedTuples{T <: AbstractVector{<:NamedTuple}} <: AbstractVector{NamedTuple}

It's also just odd to have an 2D vector 😆

Base.size(w::WrappedTuples) = (length(w.data),)
Base.getindex(w::WrappedTuples, i::Int) = w.data[i]
Base.getindex(w::WrappedTuples, r::AbstractRange) = WrappedTuples(w.data[r])
Base.IndexStyle(::Type{<:WrappedTuples}) = IndexLinear()
Expand Down
Loading