CORE: STL like algorithm implementation
|Reported by:||lordhoto||Owned by:||lordhoto|
This patch implements functionality like <algorithm> in the STL. I added some example usages (for Common::for_each, which works like std::for_each, Common::copy, which works like std::copy, Common::copy_backward, which works like std::copy_backward and Common::find_if, which works like... I guess you got it by now ;-)).
First of all I used it in our Common::Array implementation. I extended our tests for Common::Array also, to test if it works like before. What we can gain of the use of Common::copy/Common::copy_backward is that we're able to specialize the templates only for 'int','short',etc. to use memcpy instead of a custom copy loop there.
Second I changes some Kyrandia engine code to use the new functionality, which saves at least code lines and looks far superior IMHO.
Maybe it's a bit 'over engineered' for our needs. But I think it's a good addition, which also eases it for coders used to the STL to get into our code.
Also I don't know if we have support for some compilers which have a hard time with templates, msvc6 should've at least, but I don't think anyone uses it for building ScummVM...
I'm assigning this to Fingolfin, since he's in charge of our core code base, but others are free to comment on this too :-)
Ticket imported from: #1715313. Ticket imported from: patches/763.