>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.