Boost logo

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
> ?
> 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?


Boost list run by bdawes at, gregod at, cpdaniel at, john at