SHARE
TWEET

Untitled

a guest Jun 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top