6 ms·
some of the information here is a bit wrong. the idea that const is weaker than parameter is true, but not for the reasons given. any function taking a float, i
by jheriko 10y ago
some of the information here is a bit wrong. the idea that const is weaker than parameter is true, but not for the reasons given. any function taking a float, int etc. in C++ can also take a const float or const int.
its also unfair to suggest that C/C++ is as fault with not allowing a = b * c with array types. this is a failing of the standard library and easily fixed... operator overloading lets you create exactly this functionality, and std::valarray already does this for a lot of what you get in Fortran...
- pklausler 10y agoGood luck getting a high performance implementation of A=B+C without memory allocation out of a library.
- jheriko 10y agorolling your own is pretty easy, it is a shame that the C++ standard library is a dire wasteland of bad implementations. you are right that valarray will do heap allocations and making it work on the stack is a real ballache.
- whyever 10y agoThis is really not hard using expression templates.