Vector's ctor.
Dhruv Matani
dhruvbird@gmx.net
Mon Oct 11 19:53:00 GMT 2004
On Tue, 2004-10-12 at 01:05, Gabriel Dos Reis wrote:
> Dhruv Matani <dhruvbird@gmx.net> writes:
>
> | Hello,
> | I wanted to know if such a construct is a valid according to the C++
> | standard. If it is then there is a problem in the library.
> |
> | std::vector<int> iv(0, 1);
>
> Yes. There is no requirement that n shall be nonzero.
vector(n, _Tp, _Alloc) calls
_Vector_base(n, _Alloc) calls
_Vector_impl.allocate(n);
No protection for n == 0!
I've been getting a Seg. fault with a custom allocator! Maybe this is
the reason. will probe deeper later. It's getting close to bed-time.
>
> -- Gaby
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
The price of freedom is responsibility, but it's a bargain, because
freedom is priceless. ~ Hugh Downs
More information about the Libstdc++
mailing list