zoukankan      html  css  js  c++  java
  • 基础知识之C++篇

    //-----------------------------------------------------------------
    // 计算 hash 值,返回的 hash 值数据类型是 uint64_t
    #include <iostream>
    #include <string>
    #include <functional>
     
    int main()
    {
        std::string s = "Stand back! I've got jimmies!";
        std::cout << std::hash<std::string>{}(s) << ' ';
    }
     
    //-----------------------------------------------------------------------------
    // 功能1:给字符串添加双引号和斜杠
    // 功能2:剔除字符串中的双引号和斜杠
    #include <iostream>
    #include <iomanip>
    #include <sstream>
     
    int main()
    {
        std::stringstream ss;
        std::string in = "String with spaces, and embedded "quotes" too";
        std::string out;
     
        // 给字符串添加双引号和斜杠
        ss << std::quoted(in);

        // 剔除字符串中的双引号和斜杠
        ss >> std::quoted(out);
    }
    //----------------------------------------------------------------------------
    // std::setw() 设置缩进字符数量
    // std::setfill() 设置缩进字符
    std::cout << std::setw(4<< j_object << " ";
    std::cout << std::setw(2<< j_array << " ";
    std::cout << std::setw(1<< std::setfill(' '<< j_object << " ";
     
    //----------------------------------------------------------------------------
    // 获取 CPU 硬核数量
    int max_thread_num = std::thread::hardware_concurrency();

  • 相关阅读:
    基于OWin的Web服务器Katana发布版本3
    如何在.NET上处理二维码
    .NET开源OpenID和OAuth解决方案Thinktecture IdentityServer
    ASP.NET Identity V2
    Azure Redis Cache
    CentOS 7 安装RabbitMQ 3.3
    ASP.Net MVC 5 in Xamarin Studio 5.2
    Centos 7.0 安装Mono 3.4 和 Jexus 5.6
    CentOS下GPT分区(转)
    CentOS下使用LVM进行分区(转)
  • 原文地址:https://www.cnblogs.com/micemik/p/12254635.html
Copyright © 2011-2022 走看看