Boost logo

Boost :

From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2007-08-01 10:38:52


On 31/07/07, Stefan Seefeld <seefeld_at_[hidden]> wrote:
> I see ! I hadn't realized that the third parameter type was deduced from
> the argument. (Instead I was fixated on the use of 'NULL' instead of '0'.)

And NULL is, of course, #defined to 0.

On a slightly off-topic but perhaps more interesting note, what's the
rationale for having a separate template parameter for the type of the
initializing element? If it used the iterator's value_type (or a
reference thereto) then this thread wouldn't be happening.

Though to answer my own question, I suppose that the current one is
more general and the cast can be added by hand fairly easily, and
going the other way isn't possible.

It seems like filling with 0 is common enough that there should
perhaps be a std::reset algorithm that sets them all to a
default-constructed value. It'd be nice and easy to optimize to
memsets for PODs, too...

~ Scott


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