• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++POD类型

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
POD( Plain Old Data)概念:
Arithmetic types (3.9.1), enumeration types, pointer types, and pointer to member types (3.9.2), and cv-qualified(注2) versions of these types (3.9.3) are collectively called scalar types. Scalar types, POD-struct types,POD-union types (clause 9), arrays of such types and cv-qualified versions of these types (3.9.3) are collectively called POD types. 
 
如果一个class没有non-trivial 的 constructor, destructor, 以及 copy assignmet operator这些东西的话,这个class事实上已经退化成一个POD类型了,就相当于C中的struct。
 
POD类型包括下面类型:
1、标量类型,c/c++的基本类型
  • signed integer types (signed char, short, int, long),
  • unsigned integer types (unsigned char,unsigned short, unsigned int,unsigned long),
  • char and wchar_t, and
  • bool.
  • float, double, and long double
  • pointer-to-void (void *),
  • pointer-to-object and pointer-to-static-member-data (both of the form T* when pointing to an object of typeT), and
  • pointer-to-function and pointer-to-static-member-function (both of the form T (*)(...) when pointing to a function that returns an object of typeT).
  • pointer-to-nonstatic-member-data (of the form T C::* when pointing to one of classC's data members that has type T), and
  • pointer-to-nonstatic-member-functions (of the form T (C::*)(...) when pointing to one of classC's member functions that returns an object of typeT).
2、用户自定义的类类型:
  • non-static data (including arrays) of any pointer-to-member type,
  • non-static data (including arrays) of any non-POD class type,
  • non-static data of any reference type,
  • user-defined copy assignment operator, nor
  • user-defined destructor.
  • user-declared constructors,
  • private or protected non-static data members,
  • base classes, nor
  • virtual functions.

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
使用ifstream和getline读取文件内容[c++]发布时间:2022-07-13
下一篇:
C语言的变量存储类型发布时间:2022-07-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap