thejpster , Englisch
@thejpster@hachyderm.io avatar

Fun fact: Box::<[i32; 6]> is half the size of Box::<[i32]>

It seems that when a Box contains an unsized type like a slice, the Box value includes both the pointer and the size.

I know references did this (&[i32; 6] vs &[i32]) and I guess it makes sense that Box does it to, but I never really thought about it before.

  • Alle
  • Abonniert
  • Moderiert
  • Favoriten
  • random
  • haupteingang
  • Alle Magazine