You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The simplest way to create a 1-dimensional, zero-length view in map_axis would be unsafe { ArrayView::new_(std::ptr::NonNull::<A>::dangling().as_ptr(), Ix1(0), Ix1(0)) }. See this commentary.
Edit: If that doesn't compile, you might need a cast: unsafe { ArrayView::new_(std::ptr::NonNull::<A>::dangling().as_ptr() as *const A, Ix1(0), Ix1(0)) }.
Activity
andrei-papou commentedon Mar 25, 2019
Hi @jturner314 . I can work on this one if you don't mind.
jturner314 commentedon Mar 25, 2019
@andrei-papou Sure, please feel free.
andrei-papou commentedon Mar 27, 2019
@jturner314 could you please point me to an example of creating an empty array? Thanks a lot.
jturner314 commentedon Mar 27, 2019
The simplest way to create a 1-dimensional, zero-length view in
map_axiswould beunsafe { ArrayView::new_(std::ptr::NonNull::<A>::dangling().as_ptr(), Ix1(0), Ix1(0)) }. See this commentary.Edit: If that doesn't compile, you might need a cast:
unsafe { ArrayView::new_(std::ptr::NonNull::<A>::dangling().as_ptr() as *const A, Ix1(0), Ix1(0)) }.andrei-papou commentedon Mar 29, 2019
@jturner314 thanks. please take a look at the PR #612
jturner314 commentedon Apr 2, 2019
Fwiw, I realized that a cleaner (safe) way to create a zero-length one-dimensional view is
ArrayView1::from(&[]).jblondin commentedon Apr 19, 2019
PR was merged. Is anything still remaining here, or can this issue be closed?
jturner314 commentedon Apr 19, 2019
Fixed by #612. Thanks for following up.