SHARE
TWEET

Untitled

a guest Jun 16th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #![feature(const_generics)]
  2.  
  3. struct Foo<T, const N: usize>([T; {N}]);
  4.  
  5. impl<T, const N: usize> Foo<T, {N}> {
  6.     fn foo(&self) -> usize {
  7.         {N}
  8.     }
  9. }
  10.  
  11. fn main() {
  12.     let foo = Foo([0u32; 512]);
  13.     println!("{:?}", foo.foo());
  14. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top