我编写了一个类来测试"type == type"但是当类型没有operator ==时失败了;
template <typename _Type>
double _test(...){
return 0;
}
template <typename _Type>
auto _test(_Type&& t)->decltype(t == t){
return 0;
}
template <typename _Type>
struct has_equal_to
{
static const bool value = sizeof(_test(std::declval<_Type>())) == sizeof(char);
};
struct test{};
int main()
{
std::cout << has_equal_to<test>::value << std::endl; // compile failed ~~~~
return 1;
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?或者写一个这样的课是不可能的.....
我使用 flatbuffer 将数据编码为名为“person.txt”的文件,如何将其转换为 json 文件?
我尝试 'flatc --json person.txt person.json' 但它失败了。
我有“person.fbs,person.txt”,怎么做?