Boost logo

Boost :

Subject: Re: [boost] [type_traits] copy constructor
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2011-09-30 09:42:06


John Maddock-3 wrote:
>
>>> The proposed Boost.Conversion provides some interesting traits (included
>>> in C++11) that you could be interested in.
>>> is_constructible, is_default_constructible, is_copy_constructible,
>>> is_move_constructible as well as is_assignable, is_copy_assignable and
>>> is_move_assignable.
>>>
>>> If John is interested in we can work together to include them in
>>> TypeTraits.
>
> For sure, care to provide a submission/patch?
>
> Thanks, John.
>

If these (IMO very useful) traits are added, I'd suggest to have macros
#defined when the traits can actually do the job-- same as
BOOST_HAS_TRIVIAL_COPY, etc.

For example, I'd use it this way:

template< typename T >
struct has_oldof :
#if defined(BOOST_HAS_COPY_CONSTRUCTOR)
    boost::has_copy_constructor<T> // from Boost.Conversion's
is_copy_constructible
#else
    boost::mpl::true_ // user specializes has_oldof when can't copy T :(
#endif
{};

Thanks,
--Lorenzo

--
View this message in context: http://boost.2283326.n4.nabble.com/type-traits-copy-constructor-tp3854192p3859832.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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