预编译
GNU文档:gcc.gnu.org/onlinedocs/…
MSDN文档:docs.microsoft.com/en-us/cpp/b…
预置类型
const char *str = "str";
const wchar_t* wstr = L"str";
对象初始化
zh.cppreference.com/w/cpp/langu…
// Value initialization
std::string s{};
// Direct initialization
std::string s("hello");
拷贝构造/赋值,迁移构造/赋值
- 迁移构造/赋值
zh.cppreference.com/w/cpp/langu…
MSDN文档:docs.microsoft.com/en-us/cpp/c…
类型推断
zh.cppreference.com/w/cpp/langu…
auto a = 1 + 2;
Lambda
zh.cppreference.com/w/cpp/langu…
int divisor = 2;
auto mod = [=, divisor](int num) -> int { return num % divisor; };
int reminder = mod(3); // reminder = 1
并发编程
// Value initialization
std::thread my_thread{ background_task() };
// Value initialization
std::thread my_thread([]{
do_something();
do_something_else();
});