Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- struct Tensor(T, Dims...) {
- }
- void foo(T, alias M)(Tensor!(T, M)) {
- writeln("I match vectors");
- }
- void foo(T, alias M, alias N)(Tensor!(T, M, N)) {
- writeln("I match matrices");
- }
- void foo(T, alias M, alias N, alias O)(Tensor!(T, M, N, O)) {
- writeln("I match cubes");
- }
- void main() {
- foo(Tensor!(int, 3)());
- foo(Tensor!(int, 3, 5)());
- foo(Tensor!(int, 3, 5, 7)());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement