Opened 18 years ago

Closed 18 years ago

Last modified 6 years ago

#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)

stl_like_algorithm_v1.patch (30.9 KB ) - added by lordhoto 18 years ago.
path against SVN from 20070509

Download all attachments as: .zip

Change History (5)

by lordhoto, 18 years ago

Attachment: stl_like_algorithm_v1.patch added

path against SVN from 20070509

comment:1 by fingolfin, 18 years ago

I am still travelling, but so far this looks good to me. Feel free to commit it.

comment:2 by lordhoto, 18 years ago

Commited by now.

comment:3 by lordhoto, 18 years ago

Owner: changed from fingolfin to lordhoto
Status: newclosed

comment:4 by digitall, 6 years ago

Component: --Other--
Note: See TracTickets for help on using tickets.