functional programming in C++
Hello there, this is not an issue I have, I am more interesting in knowing what you think of the hability of C++ to do functional programming.
Here, I am using the STL as much as I can because it is so convenient, actually. I also (sometimes) like functional programming, like what the std::algorithm + functional can do: clearer code (not always, I know, but for simple things, definitely) and less error prone. However, using algorithms always perform slower than an explicit loop (item 43 of Meyers' Effective STL will explain you with lots of details how the std::algorithm performs faster...... profiling shows me explicit loops are always more efficient!); and I am not even 100% convinced that using iterators instead of std::vector.at(index) in a loop is actually faster.
Now, speed matters in what I am doing (scientific programming) as well as style (I have a student who is supposed to learn something) and obviously I want my calculations to be correct.
Clearer code, good style are easier to debug so now, I use std::algorithm when it actually makes the code simpler. But performance?
As a C++ developper, what do you think of std::algorithm and these issues?