FIRST
Write a program that prints the sizes of the fundamental types, a few pointer types, and a few enumerations of your choice. Use the sizeof operator.
翻译(编写一个程序,打印基本类型的大小、一些指针类型和一些您选择的枚举。使用sizeof操作符。)
#include <iostream>
#include <typeinfo>
template <typename T>
struct Type
{
static void print()
{
std::cout<<"sizeof("<<typeid(T).name()<<")="
<<sizeof(T)<<std::endl;
}
};
struct Polymorph
{
virtual ~Polymorph(){
}
};
enum Bit{
zero,one};
enum Intensity{
black=0,brigthtest=100};
int main()
{
//基本整形类型:
Type<bool>::print();
Type<char>::print();
Type<signed char>::print(