
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. -- Dave Abrahams BoostPro Computing http://www.boostpro.com