mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-17 04:31:22 +08:00
doc: Update cpp.md (#933)
This commit is contained in:
22
docs/cpp.md
22
docs/cpp.md
@ -30,7 +30,7 @@ Hello Quick Reference
|
|||||||
int number = 5; // 整数
|
int number = 5; // 整数
|
||||||
float f = 0.95; // 浮点数
|
float f = 0.95; // 浮点数
|
||||||
double PI = 3.14159; // 浮点数
|
double PI = 3.14159; // 浮点数
|
||||||
char yes = 'Y'; // 特点
|
char yes = 'Y'; // 字符
|
||||||
std::string s = "ME"; // 字符串(文本)
|
std::string s = "ME"; // 字符串(文本)
|
||||||
bool isRight = true; // 布尔值
|
bool isRight = true; // 布尔值
|
||||||
// 常量
|
// 常量
|
||||||
@ -327,14 +327,14 @@ else
|
|||||||
|
|
||||||
#### 位运算符
|
#### 位运算符
|
||||||
|
|
||||||
| Operator | Description |
|
| 运算符 | 描述 |
|
||||||
|----------|-------------------------|
|
|--------|------|
|
||||||
| `a & b` | Binary AND |
|
| `a & b` | 按位与 |
|
||||||
| `a | b` | Binary OR |
|
| <code>a | b</code> | 按位或 |
|
||||||
| `a ^ b` | Binary XOR |
|
| `a ^ b` | 按位异或 |
|
||||||
| `a ~ b` | Binary One's Complement |
|
| `~a` | 按位取反 |
|
||||||
| `a << b` | Binary Shift Left |
|
| `a << b` | 左移 |
|
||||||
| `a >> b` | Binary Shift Right |
|
| `a >> b` | 右移 |
|
||||||
|
|
||||||
### 三元运算符
|
### 三元运算符
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ auto func = []() -> return_type { };
|
|||||||
? val1 : val2;
|
? val1 : val2;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto func2 = [&, val1]() -> int
|
auto func2 = [&, val1]() -> string
|
||||||
{
|
{
|
||||||
return str1 == std::to_string(val1)
|
return str1 == std::to_string(val1)
|
||||||
? str1 : str2;
|
? str1 : str2;
|
||||||
@ -926,7 +926,7 @@ int val = result.get();
|
|||||||
extern double foo(int val) {}
|
extern double foo(int val) {}
|
||||||
|
|
||||||
std::future<double> result =
|
std::future<double> result =
|
||||||
async(foo, 5);
|
std::async(foo, 5);
|
||||||
|
|
||||||
//返回值类型
|
//返回值类型
|
||||||
std::future_status status;
|
std::future_status status;
|
||||||
|
Reference in New Issue
Block a user