Old problem with performance

Weed resume755 at mail.ru
Fri Feb 20 11:24:43 PST 2009


Kagamin пишет:
> Weed Wrote:
> 
>> Good (I think) use cases have been in this thread
> 
> They may be good, but they don't show what can be done in C++ and can't be done in D. You were advised to use structs for value semantic.

We are beginning to repeat itself. Okay. :)

On D you may write anything. Even without cycles! With only "if" and
"goto" keywords. The question of the costs of such a code.  :)

An example is unnecessarily complex code here:
http://www.dsource.org/projects/openmeshd/browser/trunk/LinAlg/linalg/MatrixT.d

See line 227, template MultReturnType(ArgT) {

This template is necessary to receive by value a structures containing
the vectors and matrices as mathematical operations results. Receiving
the vectors and matrices by value in structures needed to increase
performance.

Try to add here another 3 or 4 types of the returned object to this
template?

In C++ vector, matrix, and all other possible objects would have been
the class derived from common base class and this problem does not occur.



More information about the Digitalmars-d mailing list