Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.41 KB | None | 0 0
  1. import std.stdio;
  2.  
  3. struct Tensor(T, Dims...) {
  4. }
  5.  
  6. void foo(T, alias M)(Tensor!(T, M)) {
  7.   writeln("I match vectors");
  8. }
  9.  
  10. void foo(T, alias M, alias N)(Tensor!(T, M, N)) {
  11.   writeln("I match matrices");
  12. }
  13.  
  14. void foo(T, alias M, alias N, alias O)(Tensor!(T, M, N, O)) {
  15.   writeln("I match cubes");
  16. }
  17.  
  18. void main() {
  19.   foo(Tensor!(int, 3)());
  20.   foo(Tensor!(int, 3, 5)());
  21.   foo(Tensor!(int, 3, 5, 7)());
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement