std :: is_integer和std :: is_integral之间的区别? [英] Differences between std::is_integer and std::is_integral?

查看:723
本文介绍了std :: is_integer和std :: is_integral之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++ 11提供了两个类型特征模板类:std::is_integerstd::is_integral.但是,我无法分辨它们之间的区别.

C++11 provides two type trait template classes: std::is_integer and std::is_integral. However, I cannot tell the differences between them.

哪种类型(例如T)可以使std::is_integer<T>::value为真,而使std::is_integral<T>::value为假?

What type, say T, can make std::is_integer<T>::value true and make std::is_integral<T>::value false?

推荐答案

std::is_integer<T>不存在.

话虽这么说,std::numeric_limits<T>::is_integer确实存在.

That being said, std::numeric_limits<T>::is_integer does exist.

我不知道std::numeric_limits<T>::is_integerstd::is_integral<T>之间的任何显着差异.后者的设计要晚得多,并且在C ++ 11中成为标准,而前者是在C ++ 98中引入的.

I'm not aware of any significant difference between std::numeric_limits<T>::is_integer and std::is_integral<T>. The latter was designed much later and became standard in C++11, whereas the former was introduced in C++98.

这篇关于std :: is_integer和std :: is_integral之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆