c++14:std::quoted

C++14引入std::quoted用于给字符串添加双引号 

/*================================================================
*   Copyright (C) 2021 baichao All rights reserved.
*
*   文件名称:quoted.cpp
*   创 建 者:baichao
*   创建日期:2021年01月06日
*   描    述:
*
================================================================*/

#include <iostream>
#include <string>
#include <iomanip>

int main()
{
    std::string str =  "Hello World";
    std::cout<<str<<std::endl;
    std::cout<< std::quoted(str)<<std::endl;
}

运行结果:

注意这是c++14之后的新特性

猜你喜欢

转载自blog.csdn.net/weixin_40179091/article/details/112292219