Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-03-08 13:33:00


From: "Howard Hinnant" <hinnant_at_[hidden]>
> On Friday, March 8, 2002, at 12:51 PM, Peter Dimov wrote:
>
> > One way to solve it (that I see) is
> >
> > template<class F> vector::vector(size_type n, F f);
> >
> > that will allocate memory and use f(this->_Ptr, n) to initialize it.
>
> I believe you can essentially do the same thing with the existing
> iterator interface.
>
> template <class InputIterator>
> vector(InputIterator first, InputIterator last,
> const Allocator& = Allocator());
>
> Does your proposal have advantages over this?

Why would anyone want an uninitialized vector? One legitimate reason is that
you have an existing C-style library function 'f' that will initialize it.

I don't see how the iterator interface can be used to achieve the same
effect. If the current vector interface is enough, why all this talk about
uninitialized values?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk