diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 0000000..af646e2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,24 @@ +--- +name: Bug report +about: 报告错误 + +--- + +## 实际描述 + +- 文件路径:例如,book/zh-cn/02-usability.md +- 原文段落: + +``` +复制原文段落 +``` + +## 预期描述 + +``` +修改后的段落 +``` + +## 附图 + +必要时,请附上相关截图 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md new file mode 100644 index 0000000..44433b3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -0,0 +1,13 @@ +--- +name: Feature request +about: 内容建议 + +--- + +## 动机 + +请描述你提交内容建议的动机。 + +## 需求说明 + +请描述你提交内容建议的详单,例如具体是增加哪个知识点的说明。 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/Question.md b/.github/ISSUE_TEMPLATE/Question.md new file mode 100644 index 0000000..0f68bd5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Question.md @@ -0,0 +1,9 @@ +--- +name: Question +about: 提交问题 + +--- + +## 问题描述 + +请在此描述你的问题,提问前请参考[提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md) \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..06fd67f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +resolve #issue_id + +## 说明 + +此处详细说明 PR 的动机是什么、解决了什么样的问题。 + +## 变化箱单 + +- 修复了 XXX 的 typo 错误 +- 增加了 XXX 相关的说明 +- 解决了关于 XXX 的描述性错误 + +## 参考文献 + +如果有请注明 \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3fe0efb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# 如何参与贡献 + +[![](https://img.shields.io/badge/chat-%E4%BA%A4%E6%B5%81-667ed5.svg)](./assets/community.md) + +## 提交 Issue + +『C++ 11/14/17』的 issue 用于追踪书中存在的原则性的描述错误、存在的 `typo` 错误,以及向本书作者提问等。 + +- 通常情况下,你可能会发现书中某个段落存在错别字、语义错误、文法错误等。 +这都是 `typo` 错误。如果该错误已经对你的阅读造成了一定障碍, +你也强烈的认为该 `typo` 也会影响到其他人的阅读, +那么非常欢迎[提交 issue](https://github.com/changkun/modern-cpp-tutorial/issues) +来报告 `typo` 错误。 + +- 对于书中存在的原则性错误,例如对源码进行分析的内容产生明显的错误、 +且内容对其他人会产生严重的误导,请不要犹豫, +立即[提交 issue](https://github.com/changkun/modern-cpp-tutorial/issues) 来报告此错误,以免继续传播错误的知识。 +如果可以,也请附上相关改进说明。通常情况下,如果存在这类问题,我们鼓励你一并提交改进 PR。 + +- 如果你在阅读本书的时候发现有部分内容难于理解,也欢迎[提交 issue](https://github.com/changkun/modern-cpp-tutorial/issues) 来询问作者表达你的疑惑。 +作者会根据实际情况重新优化这一部分的内容,进而帮助他人更易阅读这部分的内容。 + +- 我们也欢迎你提交针对本书内容的相关建议,具体来说如果你认为书中未涉及的某个模块或者文件的源码值得讨论,也欢迎 [提交 issue](https://github.com/changkun/go-under-the-hood/issues) 来进一步讨论。 + +## 提交 Pull request + +『C++ 11/14/17』是一本开源书籍,任何人都可以参与贡献自己 PR。但在提交 PR 之前请仔细阅读下面的说明: + +- 当你认为需要提交一个 PR 时,请确保 [issue 列表](https://github.com/changkun/modern-cpp-tutorial/issues)中,已经包含了你想要解决的问题。 +如果没有,请参考**提交 Issue** 一节中的描述,提交你的 issue,再提交你的 PR。 + +- 当你准备提交一个 typo 错误的 PR 时,请确保你的 PR 改进了 **超过 50 个汉字(或英文单词)** 的 `typo` 错误,否则请不要提交 PR。 +- 对于一个修复原则性错误的 PR,请不要犹豫,笔者对此表示非常感谢! +- 如果非常喜欢本书,以至于希望参与本书的合著,成为作者,请发邮件询问:`hi at changkun dot us`。 + +本仓库提供了多种阅读方式,如果你提交一个 Pull request,则请确保你检查的如下的 checklist: + +- [ ] 只改动原书正文 `book` 下的部分内容,不涉及代码片段的修改,则无需进行修改 +- [ ] 如果同时还改动了正文中的代码片段,则需要同步 `code` 文件夹下对应的代码片段 +- [ ] 如果改动还涉及习题的设计,则需要同步 `exercises` 文件夹下的内容 diff --git a/README.md b/README.md index f52ecb7..d6e450c 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,8 @@ # 《高速上手 C++11/14/17》 -![](https://img.shields.io/badge/version-v2-green.svg) [![](https://img.shields.io/badge/language-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-red.svg)](./README.md) [![](https://img.shields.io/badge/language-English-blue.svg)](./README-en-us.md) [![](https://img.shields.io/badge/%C2%A5-%E8%B5%9E%E5%8A%A9-ff69b4.svg)](./assets/donate.md) -[![](https://img.shields.io/badge/chat-%E4%BA%A4%E6%B5%81-667ed5.svg)](./assets/community.md) ## 本书目的 @@ -42,7 +40,7 @@ ## 致谢 -笔者时间和水平有限,如果读者发现书中内容的错误,欢迎提 [Issue](https://github.com/changkun/modern-cpp-tutorial/issues),或者直接提 [Pull request](https://github.com/changkun/modern-cpp-tutorial/pulls)。由衷感谢每一位指出本书中出现错误的读者,包括但不限于 [Contributors](https://github.com/changkun/modern-cpp-tutorial/graphs/contributors)。 +笔者时间和水平有限,如果读者发现书中内容的错误,欢迎提 [Issue](https://github.com/changkun/modern-cpp-tutorial/issues),或者直接提 [Pull request](https://github.com/changkun/modern-cpp-tutorial/pulls)。详细贡献指南请参考[如何参与贡献](CONTRIBUTING.md),由衷感谢每一位指出本书中出现错误的读者,包括但不限于 [Contributors](https://github.com/changkun/modern-cpp-tutorial/graphs/contributors)。 ## 许可 diff --git a/book/zh-cn/05-pointers.md b/book/zh-cn/05-pointers.md index 20980cf..3c583d5 100644 --- a/book/zh-cn/05-pointers.md +++ b/book/zh-cn/05-pointers.md @@ -47,7 +47,7 @@ int main() } ``` -`std::shared_ptr` 可以通过 `get()` 方法来获取原始指针,通过 `reset()` 来减少一个引用计数,并通过`get_count()`来查看一个对象的引用计数。例如: +`std::shared_ptr` 可以通过 `get()` 方法来获取原始指针,通过 `reset()` 来减少一个引用计数,并通过`use_count()`来查看一个对象的引用计数。例如: ```cpp auto pointer = std::make_shared(10); diff --git a/pdf/en-us/modern-cpp-tutorial.md b/pdf/en-us/modern-cpp-tutorial.md new file mode 100644 index 0000000..26d124b --- /dev/null +++ b/pdf/en-us/modern-cpp-tutorial.md @@ -0,0 +1,5 @@ +--- +title: "C++11/14/17 On the Fly" +author: Changkun Ou +copyright: cc-by-nc-nd 4.0 +--- diff --git a/pdf/en-us/toc.md b/pdf/en-us/toc.md new file mode 100644 index 0000000..5049ed3 --- /dev/null +++ b/pdf/en-us/toc.md @@ -0,0 +1,109 @@ +# C++ 11/14/17 On The Fly + +> This book adapting to C++17 and translating to English + +## Table of Contents + +- [**Preface**](./00-preface.md) +- [**Chapter 01 Towards C++11/14/17**](./01-intro.md) + + 1.1 Deprecated Features + + 1.2 Compatibility with C + + Further Readings +- [**Chapter 02 Language Usability Enhancements**](./02-usability.md) + + 2.1 Constants + - nullptr + - constexpr + + 2.2 Variables & Initialization + - Conditional Statement + - Initializer List + - Structured binding + + 2.3 Type Deduction + - auto + - decltype + - Tail return type + - decltype(auto) + + 2.4 Control Flow + - if constexpr + - Range-based for loop + + 2.5 Templates + - External templates + - The ">" + - Type alias templates + - Default template parameters + - Variadic templates + - Fold expression + + 2.6 Object-oriented + - Delegate constructor + - Inheritance constructor + - Explicit virtual function overwrite + - override + - final + - Explicit delete default function + - Strongly typed enumerations +- [**Chapter 03 Language Runtime Enhancements**](./03-runtime.md) + + Lambda expression + + Basics + + Value capture + + Reference capture + + Implicit capture + + Expression capture + + Generic lambda + + Function object wrapper + + std::function + + std::bind/std::placeholder + + rvalue reference + + lvalue, rvalue, prvalue, xvalue + + rvalue reference & lvalue reference + + Move semantics + + Perfect forwarding +- [**Chapter 04 Sandard Library: Containers**](./04-containers.md) + + `std::array` + + `std::forward_list` + + `std::unordered_set` + + `std::unordered_map` + + `std::tuple` + + basic operation + + runtime indexing + + merge and iteration +- [**Chapter 05 Sandard Library: Pointers**](./05-pointers.md) + + RAII and reference counting + + `std::shared_ptr` + + `std::unique_ptr` + + `std::weak_ptr` +- [**Chapter 06 Sandard Library: Regular Expression**](./06-regex.md) + + Regular Expression Introduction + + Normal characters + + Special characters + + Determinative + + `std::regex` + + `std::regex` + + `std::regex_match` + + `std::match_results` +- [**Chapter 07 Sandard Library: Threads and Concurrency**](./07-thread.md) + + `std::thread` + + `std::mutex` + + `std::unique_lock` + + `std::future` + + `std::packaged_task` + + `std::condition_variable` +- [**Chapter 08 Sandard Library: File System**](./08-filesystem.md) +- [**Chapter 09 Minor Features**](./09-others.md) + + New Types + + `long long int` + + `noexcept` + + Literal + + Raw string literal + + Custom string literal + + Math Library +- [**Chapter 10 Outlook: Introduction of C++20**](./10-cpp20.md) + + Concept + + Range + + Module + + Coroutine +- [**Appendix: Further Study Materials**](./appendix.md) + +Table of Content | Last Chapter | [Next Chapter: Preface](./00-preface.md) + +## Licenses + +Creative Commons License
This work is written by [Ou Changkun](https://changkun.de) and licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. The code of this repository is open sourced under the [MIT license](./LICENSE). \ No newline at end of file diff --git a/pdf/zh-cn/modern-cpp-tutorial.pdf b/pdf/zh-cn/modern-cpp-tutorial.pdf index adb2f6d..86d2e8a 100644 Binary files a/pdf/zh-cn/modern-cpp-tutorial.pdf and b/pdf/zh-cn/modern-cpp-tutorial.pdf differ diff --git a/pdf/zh-cn/revision.tex b/pdf/zh-cn/revision.tex deleted file mode 100644 index 3d197ed..0000000 --- a/pdf/zh-cn/revision.tex +++ /dev/null @@ -1,2 +0,0 @@ -% Autogenerated, do not edit -\newcommand{\revision}{v1.0.1-91-g6f6531f} diff --git a/website/src/modern-cpp/about/donate.md b/website/src/modern-cpp/about/donate.md deleted file mode 100644 index 112b5de..0000000 --- a/website/src/modern-cpp/about/donate.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: 资助 -type: about -order: 1 ---- - -# 资助 - -如果你认为本书对你起到了帮助,并希望赞助作者,可以通过下面的二维码给予支持: - -|微信|支付宝| -|:--:|:--:| -|![](../assets/wechat.jpg) | ![](../assets/alipay.jpg)| \ No newline at end of file diff --git a/website/src/modern-cpp/assets/alipay.jpg b/website/src/modern-cpp/assets/alipay.jpg deleted file mode 100644 index 63abc14..0000000 Binary files a/website/src/modern-cpp/assets/alipay.jpg and /dev/null differ diff --git a/website/src/modern-cpp/assets/wechat.jpg b/website/src/modern-cpp/assets/wechat.jpg deleted file mode 100644 index 0ae6403..0000000 Binary files a/website/src/modern-cpp/assets/wechat.jpg and /dev/null differ