//判断类型是否支持序列化
template
struct is_serializable
{
private:
// 去除指针类型
using base_type = std::remove_pointer_t;
public:
template
static auto test(int) -> decltype(std::declval() << std::declval(), std::true_type());
template
static auto test(...) -> std::false_type;
static constexpr bool value = decltype(test(0))::value;
};
//判断类型是否支持重载了等于==符号
template
struct is_equality_comparable
{
private:
// 去除引用和const限定符
using base_type = std::remove_cv_t>;
template
static auto test(int) -> decltype(std::declval() == std::declval(), std::true_type());
template
static auto test(...) -> std::false_type;
public:
static constexpr bool value = decltype(test(0))::value;
};
0