1. 程式人生 > 其它 >c++14:std::quoted

c++14:std::quoted

技術標籤:c++11/14/17/20 新特性回顧整理c++

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之後的新特性