mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 04:34:40 +03:00
update: build english pdf
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 01:Towards Modern C++
|
title: "Chapter 01: Towards Modern C++"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 1
|
order: 1
|
||||||
---
|
---
|
||||||
@@ -12,7 +12,7 @@ order: 1
|
|||||||
and always use the `-std=c++2a` compilation flag in your code.
|
and always use the `-std=c++2a` compilation flag in your code.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ clang++ -v
|
> clang++ -v
|
||||||
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
|
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
|
||||||
Target: x86_64-apple-darwin18.6.0
|
Target: x86_64-apple-darwin18.6.0
|
||||||
Thread model: posix
|
Thread model: posix
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 02:Language Usability Enhancements
|
title: "Chapter 02: Language Usability Enhancements"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 2
|
order: 2
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 03:Language Runtime Enhancements
|
title: "Chapter 03: Language Runtime Enhancements"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 3
|
order: 3
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 04 Sandard Library:Containers
|
title: "Chapter 04 Sandard Library: Containers"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 4
|
order: 4
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 05 Sandard Library:Pointers
|
title: "Chapter 05 Sandard Library: Pointers"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 5
|
order: 5
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 06 Sandard Library:Regular Expression
|
title: "Chapter 06 Sandard Library: Regular Expression"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 6
|
order: 6
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 07 Sandard Library:Threads and Concurrency
|
title: "Chapter 07 Sandard Library: Threads and Concurrency"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 7
|
order: 7
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 08 Sandard Library:File System
|
title: "Chapter 08 Sandard Library: File System"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 8
|
order: 8
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Chapter 10 Outlook:Introduction of C++20
|
title: "Chapter 10 Outlook: Introduction of C++20"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 10
|
order: 10
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: Appendix 1:Further Study Materials
|
title: "Appendix 1: Further Study Materials"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 11
|
order: 11
|
||||||
---
|
---
|
||||||
|
|
||||||
# Appendix 1:Further Study Materials
|
# Appendix 1: Further Study Materials
|
||||||
|
|
||||||
First of all, congratulations 🎉 on reading this book! I hope this book has raised your interest in modern C++.
|
First of all, congratulations 🎉 on reading this book! I hope this book has raised your interest in modern C++.
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: Appendix 2:Modern C++ Best Practices
|
title: "Appendix 2: Modern C++ Best Practices"
|
||||||
type: book-en-us
|
type: book-en-us
|
||||||
order: 12
|
order: 12
|
||||||
---
|
---
|
||||||
|
|
||||||
# Appendix 2:Modern C++ Best Practices
|
# Appendix 2: Modern C++ Best Practices
|
||||||
|
|
||||||
In this appendix we will briefly talk about the best practices of modern C++. In general, the author's thoughts on C++'s best practices are mainly absorbed from [Effective Modern C++](https://www.amazon.com/dp/1491903996/ref=cm_sw_em_r_mt_dp_U_-ZgjDb81ERBNP) and [C++ Style Guide](https://google.github.io/styleguide/cppguide.html). In this appendix, we will briefly discuss and use the actual examples to illustrate the methods, and introduce some of **the author's personal**, **non-common**, **non-sensible** best practices, and how to ensure the overall quality of the code.
|
In this appendix we will briefly talk about the best practices of modern C++. In general, the author's thoughts on C++'s best practices are mainly absorbed from [Effective Modern C++](https://www.amazon.com/dp/1491903996/ref=cm_sw_em_r_mt_dp_U_-ZgjDb81ERBNP) and [C++ Style Guide](https://google.github.io/styleguide/cppguide.html). In this appendix, we will briefly discuss and use the actual examples to illustrate the methods, and introduce some of **the author's personal**, **non-common**, **non-sensible** best practices, and how to ensure the overall quality of the code.
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ order: 1
|
|||||||
**编译环境**:本书将使用 `clang++` 作为唯一使用的编译器,同时总是在代码中使用 `-std=c++2a` 编译标志。
|
**编译环境**:本书将使用 `clang++` 作为唯一使用的编译器,同时总是在代码中使用 `-std=c++2a` 编译标志。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ clang++ -v
|
> clang++ -v
|
||||||
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
|
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
|
||||||
Target: x86_64-apple-darwin18.6.0
|
Target: x86_64-apple-darwin18.6.0
|
||||||
Thread model: posix
|
Thread model: posix
|
||||||
|
|||||||
@@ -963,8 +963,6 @@ std::cout << new_enum::value3 << std::endl
|
|||||||
|
|
||||||
2. 尝试用[折叠表达式](#折叠表达式)实现用于计算均值的函数,传入允许任意参数。
|
2. 尝试用[折叠表达式](#折叠表达式)实现用于计算均值的函数,传入允许任意参数。
|
||||||
|
|
||||||
3.
|
|
||||||
|
|
||||||
> 参考答案[见此](../exercises/2)。
|
> 参考答案[见此](../exercises/2)。
|
||||||
|
|
||||||
[返回目录](./toc.md) | [上一章](./01-intro.md) | [下一章 运行时强化](./03-runtime.md)
|
[返回目录](./toc.md) | [上一章](./01-intro.md) | [下一章 运行时强化](./03-runtime.md)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import os
|
|||||||
|
|
||||||
chapters = ['00-preface.md', '01-intro.md', '02-usability.md', '03-runtime.md', '04-containers.md', '05-pointers.md', '06-regex.md', '07-thread.md', '08-filesystem.md', '09-others.md', '10-cpp20.md', 'appendix1.md', 'appendix2.md']
|
chapters = ['00-preface.md', '01-intro.md', '02-usability.md', '03-runtime.md', '04-containers.md', '05-pointers.md', '06-regex.md', '07-thread.md', '08-filesystem.md', '09-others.md', '10-cpp20.md', 'appendix1.md', 'appendix2.md']
|
||||||
|
|
||||||
ignores = ['TOC', 'Return to TOC', 'License', 'license']
|
ignores = ['TOC', 'Table of Content', 'License', 'license']
|
||||||
|
|
||||||
|
|
||||||
with open('modern-cpp-tutorial.md', 'w') as outfile:
|
with open('modern-cpp-tutorial.md', 'w') as outfile:
|
||||||
|
|||||||
@@ -15,11 +15,7 @@
|
|||||||
\usepackage{amssymb,amsmath}
|
\usepackage{amssymb,amsmath}
|
||||||
\usepackage{ifxetex,ifluatex}
|
\usepackage{ifxetex,ifluatex}
|
||||||
|
|
||||||
\linespread{1.2}\selectfont % 行距
|
\linespread{1.2}\selectfont
|
||||||
%\XeTeXlinebreaklocale "zh" % 针对中文自动换行
|
|
||||||
%\XeTeXlinebreakskip = 0pt plus 1pt % 字与字之间加入 0pt 至 1pt 的间距,确保左右对齐
|
|
||||||
%\parindent 0em % 段落缩进
|
|
||||||
%\setlength{\parskip}{20pt} % 段落间距
|
|
||||||
\ifxetex
|
\ifxetex
|
||||||
\usepackage{xltxtra,xunicode}
|
\usepackage{xltxtra,xunicode}
|
||||||
\fi
|
\fi
|
||||||
@@ -140,22 +136,23 @@ $endif$
|
|||||||
\author{$for(author)$$author$$sep$ \and $endfor$}
|
\author{$for(author)$$author$$sep$ \and $endfor$}
|
||||||
\date{$date$}
|
\date{$date$}
|
||||||
|
|
||||||
%%%% 段落首行缩进两个字 %%%%
|
|
||||||
\makeatletter
|
\makeatletter
|
||||||
\let\@afterindentfalse\@afterindenttrue
|
\let\@afterindentfalse\@afterindenttrue
|
||||||
\@afterindenttrue
|
\@afterindenttrue
|
||||||
\makeatother
|
\makeatother
|
||||||
\setlength{\parindent}{2em} %中文缩进两个汉字位
|
\setlength{\parindent}{2em}
|
||||||
|
|
||||||
%%%% 下面的命令设置行间距与段落间距 %%%%
|
|
||||||
\linespread{1.4}
|
\linespread{1.4}
|
||||||
\setlength{\parskip}{1ex}
|
\setlength{\parskip}{1ex}
|
||||||
\setlength{\parskip}{0.5\baselineskip}
|
\setlength{\parskip}{0.5\baselineskip}
|
||||||
|
|
||||||
|
\input{revision}
|
||||||
|
% fix build, see https://github.com/laboon/ebook/issues/139#issuecomment-408696480
|
||||||
|
|
||||||
|
\newcommand{\passthrough}[1]{\lstset{mathescape=false}#1\lstset{mathescape=true}}
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
\newcommand{\tightlist}{%
|
\newcommand{\tightlist}{
|
||||||
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
||||||
|
|
||||||
\thispagestyle{plain}
|
\thispagestyle{plain}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Reference in New Issue
Block a user