博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C++ POD类型
阅读量:5123 次
发布时间:2019-06-13

本文共 1694 字,大约阅读时间需要 5 分钟。

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.

转载于:https://www.cnblogs.com/wubugui/p/4247729.html

你可能感兴趣的文章
aboutMe
查看>>
【Debug】IAR在线调试时报错,Warning: Stack pointer is setup to incorrect alignmentStack,芯片使用STM32F103ZET6...
查看>>
一句话说清分布式锁,进程锁,线程锁
查看>>
python常用函数
查看>>
FastDFS使用
查看>>
服务器解析请求的基本原理
查看>>
[HDU3683 Gomoku]
查看>>
【工具相关】iOS-Reveal的使用
查看>>
数据库3
查看>>
存储分类
查看>>
下一代操作系统与软件
查看>>
【iOS越狱开发】如何将应用打包成.ipa文件
查看>>
[NOIP2013提高组] CODEVS 3287 火车运输(MST+LCA)
查看>>
Yii2 Lesson - 03 Forms in Yii
查看>>
Python IO模型
查看>>
Ugly Windows
查看>>
DataGridView的行的字体颜色变化
查看>>
Java再学习——关于ConcurrentHashMap
查看>>
如何处理Win10电脑黑屏后出现代码0xc0000225的错误?
查看>>
局域网内手机访问电脑网站注意几点
查看>>