c++ 真的是复杂

2020-01-03  本文已影响0人  皿卜土

https://zh.cppreference.com/w/Cppreference:FAQ

https://chenxiaowei.gitbook.io/cpp_concurrency_in_action/

第二版
https://chenxiaowei.gitbook.io/c-concurrency-in-action-second-edition-2019/praise_for_the_first_edition

nt* a[2][3];

int(p)[3] = a;


(T)0 * (U)0 这是什么鬼
template<typename T, typename U>
decltype((T)0 * (U)0) mul(T x, U y)
{
return x * y;
}
强制把0变成T型指针指向的地址,T也就是所谓指针的跳跃范围,再解指针,后面也是一样的。
c++11这么写的
template<typename T, typename U>
decltype(static_cast<T>(nullptr) * static_cast<U>(nullptr)) mul(T x, U y)
{
return x * y;
}
又引出static_cast,reinterpret_cast,const_cast,哭。
c++14这么写
template<typename T, typename U>
auto mul(T x, U y)
{
return x * y;
}

vs条件断点,字符串支持的函数
strlen, wcslen, strnlen, wcsnlen, strcmp, wcscmp, _stricmp, _wcsicmp, strncmp, wcsncmp, _strnicmp, _wcsnicmp, strchr, wcschr, strstr, wcsstr.
// ASCII strings
strcmp(charArrayPointer, "my value")==0 // check if two strings are equal
strstr(charArrayPointer, "substring")!=0 // check if a string contains the other

// Unicode strings
wcscmp(wcharArrayPointer, L"my value")==0 // check if two strings are equal
wcsstr(wcharArrayPointer, L"substring")!=0 // check if a string contains the other

// If you are working with std::string, you can get the char array pointer
// in this way:aString._Bx.Ptr(vs不能用)
strcmp(&bone_name
[0],"L_Wrist_End")==0

上一篇下一篇

猜你喜欢

热点阅读