-
>I acutally though vectors did allocate memory on a need-for basis.
Yes, but most implementations will err on the assumption that growth is expected. If an allocation is required, for example, the capacity might be doubled on the assumption that if one item is added, another (or more) will also be added.
>Here it gives the same error:
It looks like you're making this a lot harder than necessary.
-
front() returns the value of the first element, so I think it's obvious where that error is coming from. If it's anything but 0 or -1, you have a problem.
-
edited (dumb question ¬¬)
-
Just i... starting at 0 going to size() - 1.
-
>so is there anything that i can use inside the "at", so i can increase indexes in the loop.
What are you trying to do anyway? I'm willing to bet that there's a much better way to do it if you'll tell us the problem you want to solve.
-
Oh thanks, you saw the post before i edit it =]
Now my problem is solved
(Wow, you guys answer too quick =])