GCC up to 4.5 doesn't have standard C++0x type trait template has_nothrow_move_constructor
. I could use it in my package for optimization, but I don't want to rule out one of the common compilers and don't want to overload configuration with symbols like HAVE_STD_HAS_NOTHROW_MOVE_CONSTRUCTOR
. Is it somehow possible to use that template if present and just fall back to copying if not present without using any predefined configuration symbols? I also don't want to depend on Boost, since my library is small and doesn't need Boost for any other reasons.
In pseudocode, I need something like:
template <typename type>
struct has_nothrow_move_constructor_robust
: public integral_constant <bool,
/* if possible */ has_nothrow_move_constructor <type>::value
/* otherwise */ false>
{ };
Since move constructors are only for C++0x anyway, I don't mind using other C++0x features for the above definition, if at all possible.