Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #![feature(const_generics)]
  2.  
  3. use std::default::Default;
  4.  
  5. pub struct RawMatrix<T, const N: usize>
  6. where
  7. T: Sized + Default + Copy,
  8. {
  9. data: [T; {N}],
  10. }
  11.  
  12. impl <T, const N : usize> Default for RawMatrix<T, {N}> where T: Sized + Default + Copy {
  13. fn default() -> Self {
  14. RawMatrix::<_, {N}>{data: [T::default(); N] }
  15. }
  16. }
  17.  
  18. fn main() {
  19. let matrix = RawMatrix::<u32, 20>::default();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement