mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 12:44:40 +03:00
book: fix indent typos (#117)
This commit is contained in:
@@ -314,6 +314,8 @@ struct A {
|
||||
int y;
|
||||
long long z;
|
||||
};
|
||||
|
||||
int main() {
|
||||
std::atomic<A> a;
|
||||
std::cout << std::boolalpha << a.is_lock_free() << std::endl;
|
||||
return 0;
|
||||
@@ -546,4 +548,4 @@ They provide an critical foundation for standardized high performance computing
|
||||
|
||||
## Licenses
|
||||
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />This work was written by [Ou Changkun](https://changkun.de) and licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>. The code of this repository is open sourced under the [MIT license](../../LICENSE).`
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />This work was written by [Ou Changkun](https://changkun.de) and licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>. The code of this repository is open sourced under the [MIT license](../../LICENSE).`
|
||||
|
||||
@@ -186,14 +186,14 @@ Key:[3] Value:[3]
|
||||
|
||||
auto get_student(int id)
|
||||
{
|
||||
// 返回类型被推断为 std::tuple<double, char, std::string>
|
||||
// 返回类型被推断为 std::tuple<double, char, std::string>
|
||||
|
||||
if (id == 0)
|
||||
return std::make_tuple(3.8, 'A', "张三");
|
||||
if (id == 1)
|
||||
return std::make_tuple(2.9, 'C', "李四");
|
||||
if (id == 2)
|
||||
return std::make_tuple(1.7, 'D', "王五");
|
||||
if (id == 0)
|
||||
return std::make_tuple(3.8, 'A', "张三");
|
||||
if (id == 1)
|
||||
return std::make_tuple(2.9, 'C', "李四");
|
||||
if (id == 2)
|
||||
return std::make_tuple(1.7, 'D', "王五");
|
||||
return std::make_tuple(0.0, 'D', "null");
|
||||
// 如果只写 0 会出现推断错误, 编译失败
|
||||
}
|
||||
|
||||
@@ -321,6 +321,8 @@ struct A {
|
||||
int y;
|
||||
long long z;
|
||||
};
|
||||
|
||||
int main() {
|
||||
std::atomic<A> a;
|
||||
std::cout << std::boolalpha << a.is_lock_free() << std::endl;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user