Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct copy_only {
- copy_only(copy_only const&) {} // note: not defaulted on first declaration
- };
- static_assert( std::is_move_constructible<copy_only>::value
- , "This won't trip" );
- #include <type_traits>
- template <typename T, bool P> struct is_movecopy_helper;
- template <typename T>
- struct is_movecopy_helper<T, false>
- {
- typedef T type;
- };
- template <typename T>
- struct is_movecopy_helper<T, true>
- {
- template <typename U>
- struct Dummy : public U
- {
- Dummy(const Dummy&) = delete;
- Dummy(Dummy&&) = default;
- };
- typedef Dummy<T> type;
- };
- template <class T>
- struct has_move_constructor
- : std::integral_constant<bool, std::is_class<T>::value &&
- std::is_move_constructible<typename is_movecopy_helper<T, std::is_class<T>::value>::type>::value> { };
Add Comment
Please, Sign In to add comment