#8658 closed patch
CORE: STL like algorithm implementation
Reported by: | lordhoto | Owned by: | lordhoto |
---|---|---|---|
Priority: | normal | Component: | --Other-- |
Version: | Keywords: | ||
Cc: | Game: |
Description
Hi,
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.
Attachments (1)
Change History (5)
by , 18 years ago
Attachment: | stl_like_algorithm_v1.patch added |
---|
comment:1 by , 17 years ago
I am still travelling, but so far this looks good to me. Feel free to commit it.
comment:3 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → closed |
comment:4 by , 6 years ago
Component: | → --Other-- |
---|
path against SVN from 20070509