各种基本数据类型的长度

  • 阿里云国际版折扣https://www.yundadi.com

  • 阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6


    #include<iostream>
    #include<map>
    using namespace std;
    
    class MapSort{
    public:
        bool operator()(int size1,int size2){
            return size1<size2;
        }
    };
    
    template<typename T>
    void print(T t)
    {
        typename T::const_iterator iter = t.begin();
        while(iter!=t.end()){
            cout << iter->second << iter->first << endl;
            iter++;
        }
    }
    
    int main()
    {
        multimap<int,char*,MapSort> sizeMap;
    
        sizeMap.insert(pair<int,char*>(sizeof(unsigned char),"unsigned char:"));
        sizeMap.insert(pair<int,char*>(sizeof(char),"char:"));
    
        sizeMap.insert(pair<int,char*>(sizeof(unsigned short),"unsigned short:"));
        sizeMap.insert(pair<int,char*>(sizeof(short),"short:"));
    
        sizeMap.insert(pair<int,char*>(sizeof(unsigned int),"unsigned int:"));
        sizeMap.insert(pair<int,char*>(sizeof(int),"int:"));
    
        sizeMap.insert(pair<int,char*>(sizeof(float),"float:"));
        sizeMap.insert(pair<int,char*>(sizeof(double),"double:"));
        sizeMap.insert(pair<int,char*>(sizeof(unsigned long),"unsigned long:"));
        sizeMap.insert(pair<int,char*>(sizeof(long),"long:"));
        sizeMap.insert(pair<int,char*>(sizeof(long long),"long long:"));
    
        sizeMap.insert(pair<int,char*>(sizeof(string)," string:"));
        print(sizeMap);
    }
    gcc:
    unsigned char:1
    char:1
    unsigned short:2
    short:2
    unsigned int:4
    int:4
    float:4
    unsigned long:4
    long:4
     string:4
    double:8
    long long:8
    
    vs2008,xp:
    unsigned char:1
    char:1
    unsigned short:2
    short:2
    unsigned int:4
    int:4
    float:4
    unsigned long:4
    long:4
    double:8
    long long:8
     string:32
  • 阿里云国际版折扣https://www.yundadi.com

  • 阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

    “各种基本数据类型的长度” 的相关文章

    Qt不设置编码,显示其它国家的语言不乱码

    //Russian的unicode static const QChar unicode[] = {0x0420,0x0443,0x0441,0x0441,0x043A,0x0438,0x0439}; int size = sizeof(unicode) / sizeof(QChar...

    10/28-29

    API:应用程序编程接口String功能 public String replace (char oldchar ,char newchar); //符串中某一字符被一新字符替换 public String replace (String oldstr ,String newstr);//字符串...

    在Windows和Linux系统中怎么安装PHP - 编程语言

    本篇内容主要讲解“在Windows和Linux系统中怎么安装PHP”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“在Windows和Linux系统中怎么安装PHP”吧! 一、 在Windows系统...

    复现问题记录 | Stable Diffusion(LDM) (in python3)(一)

    复现 环境代码util.py 测试Text-to-Image 直接使用网页生成 记录复现LDM遇到的问题 环境 conda env create -f environment.yaml 根据environment.yaml创建一个叫ldm的新环境 其中报错是需要gith...

    【Boto3学习笔记】session client resource的区别和使用

    目录 Boto3是什么安装和配置快速开始Session&client&resource Boto3是什么 通过适用于 Python 的 AWS 开发工具包 boto3 可以支持您轻松将 Python 应用程序、库或脚本与 AWS 服务进行集成包括 Amazon S3...

    apche如何去掉index.php - 编程语言

    这篇文章主要介绍了apche如何去掉index.php的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇apche如何去掉index.php文章都会有所收获,下面我们一起来看看吧。 Apache是一种流行的Web服...