|
Boost : |
Subject: Re: [boost] [smart_ptr] scoped_array / shared_array (size_t) constructor
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2011-11-05 13:09:30
On Saturday, November 05, 2011 17:16:30 Olaf van der Spek wrote:
> On Sat, Nov 5, 2011 at 12:38 PM, Andrey Semashev
>
> > Honestly, can you give me a single reason why e.g. scoped_array can't be
> > initialized with NULL? And why are you so eager to break the interface?
>
> Code simplicity
>
> // typedef boost::shared_array<unsigned char> shared_data;
> 1. shared_data d0(256);
> 2. BOOST_AUTO(d1, make_shared_data(256));
> 3. auto d2 = make_shared_data(256);
>
> 2 is much more verbose than 1, 3 is also more verbose than 1
>
> I'd love to not break (NULL) and (0), but I'd also love to have simple code.
Sometimes less keystrokes does not produce a cleaner code. I mean, in the (1)
case I would expect shared_data to be a container or some custom class. Last
thing I would expect it to be is a pointer.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk