lundi 29 juin 2015


I think that the default overload of == for valarray is not very convenient. By default x==y (for two valarrays x and y) returns a valarray<bool>, with true on the ith entry if x[i]==y[i]. Rather, I need a single bool, which tells me if both valarray<double> contain the same elements or not. I know I can do this with a cycle, but having to do the cycle every time is not convenient. What's the best workaround here? Is there a way for me to define my own overload of == (and also !=, <, and so on)?


Aucun commentaire:

Enregistrer un commentaire