|
Boost : |
Subject: Re: [boost] move library / trait needed
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2009-04-30 13:52:51
David Abrahams wrote:
> Hi Ion,
>
> are you familiar with
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2855.html
> ?
>
> Until the committee decides exactly how to handle it and compilers catch
> up with the feature they add, we need a workaround for that problem,
> both for C++03 and C++0x. The simplest approach requires a trait called
> has_nothrow_move<T> which can be used to SFINAE-out pair's move
> constructor unless its members all have a nonthrowing move constructor.
> It would be reasonable to say
>
> template <class T>
> struct has_nothrow_move : has_move_constructor {};
>
> as a default, since move constructors shouldn't throw. But still, we
> need an implementation of has_move_constructor. Obviously, that will
> require compiler support to be optimal, but in the meantime it can be
> specialized.
>
What if we say
template <class T>
struct move_is_nothrow : mpl::true_type {};
and have it defined whether there actually is a move constructor or not?
Would that work? Or would it interact badly with copy-only types?
Sebastian
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk