Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Anyone using STL?

Author: Daniel Clausen

Date: 02:44:27 07/26/02

Go up one level in this thread


On July 26, 2002 at 05:34:20, Russell Reagan wrote:

>On July 26, 2002 at 05:26:47, Daniel Clausen wrote:
>
>>Well, if you use a fixed array (say int moves[256]) you also waste a lot of
>>space in most cases.
>
>But that is only stack space. There is no dynamic allocation involved. I think
>the concern is not with using up too much memory, but with the fact that it
>takes extra time to allocate memory dynamically. If you have a local variable in
>a function, it doesn't "cost" anything to declare it. It's just an addition to
>the stack pointer register on the CPU. It works just like Bob's method of
>storing moves.
>
>Russell

You could also use a global array of vector objects and use one vector object
per ply. This way you'd only have to clear the vector[ply] (or the list or
whatnot) at the beginning of the ply. (which could be as easy as 'nElements=0'.

Sargon



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.