EnsureSize() -> ResizeDouble(), while -> if, remove now unneded static_cast<>