@@ -27,9 +27,9 @@ } /// Create an exception with automatically completed filename and lineno information -auto genex(ExceptionType, string fn=__FILE__, int ln=__LINE__, T...)(T params) +ExceptionType genex(ExceptionType, string fn=__FILE__, int ln=__LINE__, T...)(T params) { static if( T.length > 0 && is(T[$-1] : Throwable) ) return new ExceptionType(params[0..$-1], fn, ln, params[$-1]); else @@ -47,8 +47,9 @@ /*mixin*/ template SimpleConstructor() { + /// member-by-member constructor static if( is(typeof(super) == Object) || super.tupleof.length==0 ) this( typeof(this.tupleof) params ) { static if(this.tupleof.length>0) @@ -92,12 +93,9 @@ // shiyo- desu. Don't use in this way. // Tamp tries to call new Tomp(real) (because it only sees Tomp's members), // but it fails because Tomp takes (int,string,real). assert( !__traits(compiles, { - class Tamp : Tomp - { - mixin SimpleConstructor; - } + class Tamp : Tomp { mixin SimpleConstructor; } }) ); } /// Mixing-in the MOST-DERIVED-member-wise comparator for a class @@ -104,9 +102,9 @@ /*mixin*/ template SimpleCompare() { - override bool opEquals(Object rhs_) const + override bool opEquals(Object rhs_) const /// member-by-member equality { if( auto rhs = cast(typeof(this))rhs_ ) { foreach(i,_; this.tupleof) @@ -116,17 +114,17 @@ } assert(false, sprintf!"Cannot compare %s with %s"(typeid(this), typeid(rhs_))); } - override hash_t toHash() const + override hash_t toHash() const /// member-by-member hash { hash_t h = 0; foreach(mem; this.tupleof) h += typeid(mem).getHash(&mem); return h; } - override int opCmp(Object rhs_) const + override int opCmp(Object rhs_) const /// member-by-member compare { if( auto rhs = cast(typeof(this))rhs_ ) { foreach(i,_; this.tupleof) @@ -169,9 +167,10 @@ /// Mixing-in a simple toString method /*mixin*/ template SimpleToString() -{ +{ + /// member-by-member toString override string toString() { string str = sprintf!"%s("(typeof(this).stringof); foreach(i,mem; this.tupleof)