用户定义类型的is_floating_point专用化



我可以为用户定义的类定义is_floating_point吗?我试过了。但是is_floating_point返回false。

class Test
{
public:
Test() { x = 0; }
private:
float x;
};
template<>
struct is_floating_point<Test>
{
static constexpr bool value = true;
};
void main()
{
std::cout<<std::is_floating_point<Test>::value<<endl;
}

否。CCD_ 1被定义为当"0"时返回真;T是浮点型";,然后标准规定";有三种浮点类型:floatdoublelong double

不会留下任何回旋余地。

最新更新