Re: expression templates

2011-05-02 Thread Don
ring Op, T )( T v ) if( isNumeric!T ) { return Expr!( OpBinary!( Op, R, Constant!( T, v ) ) )(); } auto opBinaryRight( string Op, T )( T v ) if( isNumeric!T ) { return Expr!( OpBinary!( Op, Constant!( T, v ), R ) )(); } }; But I cannot figure out how to implement expression

Expression templates in D1

2011-04-22 Thread SiegeLord
I have been trying to create some simple expression templates in D1 but I've run into trouble. Here is a reduced test case: class A { void opSub_r(T:int)(T a) { } void opSub(T)(T a) { } } void main(char[][] args) { A a; a - 1;

Re: expression templates

2011-03-26 Thread bearophile
Mr enuhtac: > But these workarounds are ugly, if would greatly prefer the normal comparison > operators. > Does anyone has an idea how to use them? I don't know the answer. If no one will give you a good answer then I suggest you to ask the same question (with the same code example) in the main

expression templates

2011-03-26 Thread Mr enuhtac
meric!T ) { return Expr!( OpBinary!( Op, R, Constant!( T, v ) ) )(); } auto opBinaryRight( string Op, T )( T v ) if( isNumeric!T ) { return Expr!( OpBinary!( Op, Constant!( T, v ), R ) )(); } }; But I cannot figure out how to implement expression templates for comparis