I'm attempting to create a matrix class where the output of the overloaded plus operator is a new matrix that contains the sum of the two matrices passed in. However, I would like to preallocate the result in order to improve the time efficiency of this operator. Everywhere that I've searched so far shows that the overloaded operator+ instantiates a new object that it returns by value, which is then copied to whatever variable it is being assigned to. Is there anyway to avoid this?
Aucun commentaire:
Enregistrer un commentaire