Boost logo

Boost :

Subject: Re: [boost] N2346 - Defaulted and Deleted Functions emulation
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-03-02 13:51:40


----- Original Message -----
From: "David Abrahams" <dave_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, March 02, 2009 3:18 PM
Subject: Re: [boost] N2346 - Defaulted and Deleted Functions emulation

>
>
> on Sun Mar 01 2009, "vicente.botet" <vicente.botet-AT-wanadoo.fr> wrote:
>
>> My concern is that:
>>
>> #define BOOST_DEFAULT_CONSTRUCTOR_DEFAULT(T) inline T(){};
>>
>> emulates the syntax but not the semantics of
>>
>> #define BOOST_DEFAULT_CONSTRUCTOR_DEFAULT(T) T()=default;
>>
>> The point of using the C++0x T()=default syntax is probably to ensure
>> that the class is a POD.
>>
>> In C++03, the class designer has to make a design tradeoff. If
>> providing a default constructor is more important than making the
>> class a POD, then your emulation is OK. But if the priorities are the
>> other way around, then the macro should just eliminate the default
>> constructor.
>
> Really the only likely use is to ensure POD-ness, because after all "{}"
> is a lot easier to type and read than "=default;"
>
> One thing we could do in the macro is to
>
> BOOST_MPL_ASSERT((boost::is_pod<T>))
>
> Of course, if you know enough about your implementation you can
> specialize boost::is_pod<YourType> (with the usual caveats if you get it
> wrong).
>
> I'm not sure it'd be worth it though.

You are right these are little things that the developer could do by himself. I'll however try to introduce yous improvements.

Thanks,
Vicente


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