1 module wrap_all; 2 3 import templates2; 4 import impl: OtherString; 5 6 // should be registered in Python as identity_int 7 alias identityInt = identity!int; 8 9 int product(int i, int j) { 10 return i * j; 11 } 12 13 struct String { 14 string s; 15 this(string s) { this.s = s; } 16 } 17 18 19 string otherStringAsParam(OtherString s) { 20 return s.s ~ "quux"; 21 } 22 23 24 enum MyEnum { 25 foo, 26 bar, 27 baz, 28 } 29 30 31 // FIXME 32 // See https://github.com/symmetryinvestments/autowrap/issues/177 33 version(Have_autowrap_csharp) {} 34 else { 35 36 // mimics std.range.chain 37 auto mychain(Ranges...)(Ranges ranges) { 38 39 static struct Oops { 40 import std.meta: staticMap; 41 import std.traits: Unqual; 42 alias R = staticMap!(Unqual, Ranges); 43 } 44 45 return Oops(); 46 } 47 48 49 auto chainy() { 50 import std.range: iota; 51 return mychain(5.iota, 7.iota); 52 53 } 54 } 55 56 57 struct HasOnlyOpIndex { 58 bool opIndex(size_t i) @safe @nogc pure nothrow const { 59 return i == 42; 60 } 61 }