1、CString是MFC里面封装的一个关于字符串处理的功能很强大的类,所以如果在MFC框架内使用是不用自己加头文件的,
如果不在的话,就不能使用CString了 。
2、using中指定别名的用法
using value_type = _Ty value;
以后使用value_type value; 就代表_Ty value;
https://blog.youkuaiyun.com/shift_wwx/article/details/78742459
3、C++中的nodiscard是什么意思?
4、constexpr
A constexpr specifier used in an object declaration or non-static member function (until C++14) implies const. A constexpr specifier used in a function or static member variable (since C++17) declaration implies inline. If any declaration of a function or function template has a constexpr
specifier, then every declaration must contain that specifier.
5、xstring[功能] stl的string的功能扩展,继承了string
6、vector<string>转LPCTSTR
.cpp:
vector<string> ivec;
ivec.push_back("hello");
ivec.push_back("world");
CString cstr = (CString)(ivec[0].c_str());
LPCTSTR lpstr = (LPCTSTR)cstr;
MessageBox(lpstr);
.h:
#include <vector>
#include<string>
using namespace std;
extern vector <string> ivec;
7、BOOL QueryPerformanceCounter (LARGE_INTEGER *lpCount);来精确计算执行时间
BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency);返回硬件支持的高精度计数器的频率。
typedef union _LARGE_INTEGER
{
struct { DWORD LowPart ;// 4字节整型数
LONG HighPart;// 4字节整型数 };
LONGLONG QuadPart ;// 8字节整型数
}LARGE_INTEGER ;
在进行定时之前,先调用QueryPerformanceFrequency()函数获得机器内部定时器的时钟频率, 然后在需要严格定时的事件发生之前和发生之后分别调用QueryPerformanceCounter()函数,利用两次获得的计数之差及时钟频率,计算出事件经 历的精确时间。
LARGE_INTEGER litmp;
LONGLONG QPart1,QPart2;
double dfMinus, dfFreq, dfTim;
QueryPerformanceFrequency(&litmp);
dfFreq = (double)litmp.QuadPart;// 获得计数器的时钟频率
QueryPerformanceCounter(&litmp);
QPart1 = litmp.QuadPart;// 获得初始值
do
{
QueryPerformanceCounter(&litmp);
QPart2 = litmp.QuadPart;//获得中止值
dfMinus = (double)(QPart2-QPart1);
dfTim = dfMinus / dfFreq;// 获得对应的时间值,单位为秒
}while(dfTim<0.001);
其定时误差不超过1微秒,精度与CPU等机器配置有关。
http://www.cnblogs.com/sifenkesi/archive/2011/06/01/2065673.html
8、