Operator overloading or alternatives to expression templates

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 14 07:57:35 PDT 2015


On Friday, 11 September 2015 at 19:41:41 UTC, Martin Nowak wrote:
> AFAIK expression templates are the primary choice tom implement 
> SIMD and
> matrix libraries.
> And I still have [this 
> idea](http://dpaste.dzfl.pl/cd375ac594cf) of
> implementing a nice query language for ORMs.

While expression templates are used in many matrix libraries, 
there has also been some move away from them. Blaze uses 
so-called smart expression templates because of what they view as 
performance limitations of expression templates. I think the 
general idea is to reduce the creation of temporaries and 
ordering the calculations so as to minimize the size of the 
problem (like in the multiplication A*B*c, doing A*(B*c) instead 
of (A*B)*c)
http://arxiv.org/pdf/1104.1729.pdf

> At least the comparison operators are really limiting, e.g. 
> it's not possible to efficiently implement logical indexing.
>
> vec[vec < 15], vec[vec == 15], vec[(vec != 15) & (vec > 10)]
>

I loves the logical indexing.




More information about the Digitalmars-d mailing list