C++11
搬砖道人
这个作者很懒,什么都没留下…
展开
-
利用模板访问私有成员
#include <iostream>class B { int aa = 0,bb=3; int a=10;public: void print() { std::cout << "a=" << a << std::endl; }};typedef int B::* stolen_mem_ptr;template<stolen_mem_ptr MemPtr>class Robb...原创 2021-08-21 09:54:53 · 336 阅读 · 0 评论 -
c++11字符串编码转换
#include<locale>#include<codecvt>/// <summary>/// PS:windows下的locname可以用 .codepage 方式来指定,比如UTF8为65001/// linux下为 ”zh_CN.GB18030″。zh(语言,这里指中文)_CN(地区,这里指中国大陆)或者使用 .GB18030(该语言所使用的字符集)/// </summary>class CStringCovnert{public.原创 2021-02-22 22:04:34 · 1238 阅读 · 0 评论 -
C++11原生字符串
C++的原生字符串。C++11实现了真正的原生字符串。不需要任何转义序列。默认序列为ANSI为 R“(hello word)"Unicode为 LR"(hello word)"当然这样的字符串原生不原生也没区别。而原字符串最大的作用在于"('(?:[^\\\\']|\\\\.)*'|\"(?:[^\\\\\"]|\\\\.)*\")|" 以上是一个正则匹配表达式原创 2017-02-25 21:35:56 · 5343 阅读 · 0 评论