[gecode-users] DynamicArray
Guido Tack
tack at ps.uni-sb.de
Tue Dec 11 08:58:44 CET 2007
Gustavo Gutierrez wrote:
> Would it be possible to add a size method to DynamicArray class?. I
> have one as class attribute and i had to subclass DynamicArray just
> for the size.
I'm not sure that would make so much sense. From the outside, a
DynamicArray looks as if it's unbounded in size. As soon as you
access element i, the array has size at least i, but normally > i. So
the size wouldn't tell you anything about how many elements you
inserted, or how many are actually intialized, for that matter. We
typically use DynamicArray in situations where we either know the size
outside the array, or where we have to subclass anyway in order to
remember how many elements are used.
Guido
P.S.: I forwarded this to the users list as it might be interesting
for others, too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2436 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20071211/8730afc7/attachment.bin>
More information about the gecode-users
mailing list