Thanks Chris! That did help me figure out what was wrong. I made a mistake in how I implemented broadcasting, so the element type could note be changed. If anyone is looking at this in the future, this is the old incorrect code:
function Base.similar(bc::Broadcast.Broadcasted{MyComponentVectorStyle}, ::Type{ElType}) where ElType
# Scan the inputs for the MyComponentVector:
mcv = find_mcv(bc)
# Use the MyComponentVector to create output
similar(mcv)
end
and this is what it should look like:
function Base.similar(bc::Broadcast.Broadcasted{MyComponentVectorStyle}, ::Type{ElType}) where ElType
# Scan the inputs for the MyComponentVector:
mcv = find_mcv(bc)
# Use the MyComponentVector to create output
similar(mcv, ElType)
end
It seems like it’s all working, so now I can move on to test the compile-time/run-time trade-off for my actual problem.