|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2007-07-31 18:10:09
Stefan Seefeld wrote:
> Michael Marcin wrote:
>> Hello,
>>
>> I have something like:
>>
>> class A;
>> boost::array<A*,10> the_array;
>>
>> std::fill( the_array.begin(), the_array.end(), NULL );
>>
>> Which wont compile (at least under Visual Studio 2005) without a cast
>> for NULL... I've had this problem before and decided to try to find an
>> easy cast free expressive solution for it.
>
> I'm quite confused about what this whole thread is all about.
> I would simply write
>
> std::fill(the_array.begin(), the_array.end(), 0);
>
> and move on. What am I missing ?
I think the issue is that, although the literal "0" can be implicitly
converted to a pointer, when passed to std::fill(), its type is deduced
to be "int", at which point it can no longer be converted to a pointer.
-- Eric Niebler Boost Consulting www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk