1. Make your types regular (if possible)
2. Make your types’ move operations noexcept (if possible)
class RegularCxx11 {
RegularCxx11();
RegularCxx11(RegularCxx11 const &);
RegularCxx11(RegularCxx11 &&) noexcept;
~RegularCxx11();
RegularCxx11 & operator=(RegularCxx11 const &);
RegularCxx11 & operator=(RegularCxx11 &&) noexcept;
friend bool operator==(RegularCxx11 const &, RegularCxx11 const &);
friend bool operator!=(RegularCxx11 const &, RegularCxx11 const &);
friend bool operator<(RegularCxx11 const &, RegularCxx11 const &);
// friend void swap(RegularCxx11 &, RegularCxx11 &); // throw()
};
namespace std {
template<> struct hash<RegularCxx11>;
}
template<typename T>
struct is_regular
: std::integral_constant< bool,
std::is_default_constructible<T>::value &&
std::is_copy_constructible<T>::value &&
std::is_move_constructible<T>::value &&
std::is_copy_assignable<T>::value &&
std::is_move_assignable<T>::value >
{};
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.