book: fix indent typos (#117)

This commit is contained in:
changdingfang
2020-08-24 12:59:44 +08:00
committed by GitHub
parent 4de9eb49f7
commit 32bdf85ebd
3 changed files with 12 additions and 8 deletions

View File

@@ -314,6 +314,8 @@ struct A {
int y; int y;
long long z; long long z;
}; };
int main() {
std::atomic<A> a; std::atomic<A> a;
std::cout << std::boolalpha << a.is_lock_free() << std::endl; std::cout << std::boolalpha << a.is_lock_free() << std::endl;
return 0; return 0;

View File

@@ -186,13 +186,13 @@ Key:[3] Value:[3]
auto get_student(int id) auto get_student(int id)
{ {
// 返回类型被推断为 std::tuple<double, char, std::string> // 返回类型被推断为 std::tuple<double, char, std::string>
if (id == 0) if (id == 0)
return std::make_tuple(3.8, 'A', "张三"); return std::make_tuple(3.8, 'A', "张三");
if (id == 1) if (id == 1)
return std::make_tuple(2.9, 'C', "李四"); return std::make_tuple(2.9, 'C', "李四");
if (id == 2) if (id == 2)
return std::make_tuple(1.7, 'D', "王五"); return std::make_tuple(1.7, 'D', "王五");
return std::make_tuple(0.0, 'D', "null"); return std::make_tuple(0.0, 'D', "null");
// 如果只写 0 会出现推断错误, 编译失败 // 如果只写 0 会出现推断错误, 编译失败

View File

@@ -321,6 +321,8 @@ struct A {
int y; int y;
long long z; long long z;
}; };
int main() {
std::atomic<A> a; std::atomic<A> a;
std::cout << std::boolalpha << a.is_lock_free() << std::endl; std::cout << std::boolalpha << a.is_lock_free() << std::endl;
return 0; return 0;