The question of vector vs valarray has already been asked here. My question refers specifically to the case of C++11. I have been reading a "A Tour of C++" and "The C++ Programming Language". Both books are written by Bjarne Stroustrup. In the first book the author explains that std::valarray
should be preferred for numerical computing (Chapter 12). But then in the second book, in chapter 29, the author implements a Matrix class in terms of a std::vector
.
Also by doing a bit of googling, it seems that performance-wise, a std::vector
is just as fast as dynamically allocated "raw arrays".
So in the context of C++11, which container should be preferred for numerical computing?
Aucun commentaire:
Enregistrer un commentaire