Skip to content

Commit 5ecb6fa

Browse files
committed
deploy: 900b641
1 parent 8e45e2d commit 5ecb6fa

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ <h2 id="_1">前言</h2>
292292
<blockquote>
293293
<p><img src="./img/bulb.png" height="30px" width="auto" style="margin: 0; border: none"/> 本书还在持续更新中……要追番的话,可以在 <a href="https://github.com/parallel101/cppguidebook">GitHub</a> 点一下右上角的 “Watch” 按钮,每当小彭老师提交新 commit,GitHub 会向你发送一封电子邮件,提醒你小彭老师更新了。</p>
294294
</blockquote>
295-
<p>更新时间:2024年10月26日 15:16:22 (UTC+08:00)</p>
295+
<p>更新时间:2024年10月26日 15:20:27 (UTC+08:00)</p>
296296
<p><a href="https://parallel101.github.io/cppguidebook">在 GitHub Pages 浏览本书</a> | <a href="https://142857.red/book">在小彭老师自己维护的镜像上浏览本书</a></p>
297297
<h2 id="_2">格式约定</h2>
298298
<blockquote>

lambda/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ <h3 id="_3">狂想:没有函数的世界?</h3>
512512
<p>不仅完全没有可读性、可维护性,甚至都没有可移植性。</p>
513513
<p>除非你只写应付导师的“一次性”程序,一旦要实现复杂的业务需求,不可避免的要自己封装函数或类。网上所有鼓吹“不封装”“设计模式是面子工程”的反智言论,都是没有做过大型项目的。</p>
514514
<h3 id="_4">设计模式追求的是“可改”而不是“可读”!</h3>
515-
<p>很多设计模式教材片面强调<strong>可读性</strong>,仿佛设计模式就是为了“优雅”“高大上”“美学”?使得很多人认为,“我这个是自己的项目,不用美化给领导看”而拒绝设计模式。实际上设计模式的主要价值在于<em>方便后续修改</em>*</p>
515+
<p>很多设计模式教材片面强调<strong>可读性</strong>,仿佛设计模式就是为了“优雅”“高大上”“美学”?使得很多人认为,“我这个是自己的项目,不用美化给领导看”而拒绝设计模式。实际上设计模式的主要价值在于<strong>方便后续修改</strong></p>
516516
<blockquote>
517517
<p><img src="../img/awesomeface.png" height="30px" width="auto" style="margin: 0; border: none"/> 例如 B 站以前只支持上传普通视频,现在叔叔突然提出:要支持互动视频,充电视频,视频合集,还废除了视频分 p,还要支持上传短视频,竖屏开关等……每一个叔叔的要求,都需要大量程序员修改代码,无论涉及前端还是后端。</p>
518518
</blockquote>

print_page/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ <h2 id="index-_1">前言</h2>
421421
<blockquote>
422422
<p><img src="../img/bulb.png" height="30px" width="auto" style="margin: 0; border: none"/> 本书还在持续更新中……要追番的话,可以在 <a href="https://github.com/parallel101/cppguidebook">GitHub</a> 点一下右上角的 “Watch” 按钮,每当小彭老师提交新 commit,GitHub 会向你发送一封电子邮件,提醒你小彭老师更新了。</p>
423423
</blockquote>
424-
<p>更新时间:2024年10月26日 15:16:22 (UTC+08:00)</p>
424+
<p>更新时间:2024年10月26日 15:20:27 (UTC+08:00)</p>
425425
<p><a href="https://parallel101.github.io/cppguidebook">在 GitHub Pages 浏览本书</a> | <a href="https://142857.red/book">在小彭老师自己维护的镜像上浏览本书</a></p>
426426
<h2 id="index-_2">格式约定</h2>
427427
<blockquote>
@@ -2915,7 +2915,7 @@ <h3 id="lambda-_3">狂想:没有函数的世界?</h3>
29152915
<p>不仅完全没有可读性、可维护性,甚至都没有可移植性。</p>
29162916
<p>除非你只写应付导师的“一次性”程序,一旦要实现复杂的业务需求,不可避免的要自己封装函数或类。网上所有鼓吹“不封装”“设计模式是面子工程”的反智言论,都是没有做过大型项目的。</p>
29172917
<h3 id="lambda-_4">设计模式追求的是“可改”而不是“可读”!</h3>
2918-
<p>很多设计模式教材片面强调<strong>可读性</strong>,仿佛设计模式就是为了“优雅”“高大上”“美学”?使得很多人认为,“我这个是自己的项目,不用美化给领导看”而拒绝设计模式。实际上设计模式的主要价值在于<em>方便后续修改</em>*!</p>
2918+
<p>很多设计模式教材片面强调<strong>可读性</strong>,仿佛设计模式就是为了“优雅”“高大上”“美学”?使得很多人认为,“我这个是自己的项目,不用美化给领导看”而拒绝设计模式。实际上设计模式的主要价值在于<strong>方便后续修改</strong>!</p>
29192919
<blockquote>
29202920
<p><img src="../img/awesomeface.png" height="30px" width="auto" style="margin: 0; border: none"/> 例如 B 站以前只支持上传普通视频,现在叔叔突然提出:要支持互动视频,充电视频,视频合集,还废除了视频分 p,还要支持上传短视频,竖屏开关等……每一个叔叔的要求,都需要大量程序员修改代码,无论涉及前端还是后端。</p>
29212921
</blockquote>
@@ -5298,7 +5298,7 @@ <h2 id="type_rich_api-_21">&mdash;</h2>
52985298
auto restSize = size - start;
52995299
if (length &gt; restSize) // 如果长度超过上限,则自动截断
53005300
length = restSize;
5301-
return Span(data + start, restSize + length);
5301+
return Span(data + start, length);
53025302
}
53035303
};
53045304
</code></pre>
@@ -5467,7 +5467,7 @@ <h2 id="type_rich_api-_28">&mdash;</h2>
54675467
<pre><code class="language-cpp">parseInt(&quot;233&quot;).value_or(0);
54685468
</code></pre>
54695469
<p>parseInt 内部实现可能如下:</p>
5470-
<pre><code class="language-cpp">std::optional&lt;int&gt; parseInt(std::string_view sv) {
5470+
<pre><code class="language-cpp">std::optional&lt;int&gt; parseInt(std::string_view str) {
54715471
int value;
54725472
auto result = std::from_chars(str.data(), str.data() + str.size(), std::ref(value));
54735473
if (result.ec == std::errc())
@@ -6067,9 +6067,9 @@ <h2 id="type_rich_api-_63">&mdash;</h2>
60676067

60686068
FileHandle file_open(std::filesystem::path path, OpenMode mode) {
60696069
#ifdef _WIN32
6070-
return std::shared_ptr&lt;FILE&gt;(_wfopen(path.wstring().c_str(), modeLut.at(mode)), fclose);
6070+
return std::shared_ptr&lt;FILE&gt;(_wfopen(path.wstring().c_str(), modeLut.at(mode).c_str()), fclose);
60716071
#else
6072-
return std::shared_ptr&lt;FILE&gt;(fopen(path.string().c_str(), modeLut.at(mode)), fclose);
6072+
return std::shared_ptr&lt;FILE&gt;(fopen(path.string().c_str(), modeLut.at(mode).c_str()), fclose);
60736073
#endif
60746074
}
60756075

@@ -6083,7 +6083,7 @@ <h2 id="type_rich_api-_63">&mdash;</h2>
60836083
FileResult file_read(FileHandle file, std::span&lt;T&gt; elements) {
60846084
auto n = fread(elements.data(), sizeof(T), elements.size(), file.get());
60856085
return {
6086-
.numElements = n == 0 ? n : std::nullopt,
6086+
.numElements = n == 0 ? std::optional(n) : std::nullopt,
60876087
.errorCode = std::errc(ferror(file.get())),
60886088
.isEndOfFile = (bool)feof(file.get()),
60896089
};

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

type_rich_api/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ <h2 id="_21">&mdash;</h2>
10881088
auto restSize = size - start;
10891089
if (length &gt; restSize) // 如果长度超过上限,则自动截断
10901090
length = restSize;
1091-
return Span(data + start, restSize + length);
1091+
return Span(data + start, length);
10921092
}
10931093
};
10941094
</code></pre>
@@ -1257,7 +1257,7 @@ <h2 id="_28">&mdash;</h2>
12571257
<pre><code class="language-cpp">parseInt(&quot;233&quot;).value_or(0);
12581258
</code></pre>
12591259
<p>parseInt 内部实现可能如下:</p>
1260-
<pre><code class="language-cpp">std::optional&lt;int&gt; parseInt(std::string_view sv) {
1260+
<pre><code class="language-cpp">std::optional&lt;int&gt; parseInt(std::string_view str) {
12611261
int value;
12621262
auto result = std::from_chars(str.data(), str.data() + str.size(), std::ref(value));
12631263
if (result.ec == std::errc())
@@ -1857,9 +1857,9 @@ <h2 id="_63">&mdash;</h2>
18571857

18581858
FileHandle file_open(std::filesystem::path path, OpenMode mode) {
18591859
#ifdef _WIN32
1860-
return std::shared_ptr&lt;FILE&gt;(_wfopen(path.wstring().c_str(), modeLut.at(mode)), fclose);
1860+
return std::shared_ptr&lt;FILE&gt;(_wfopen(path.wstring().c_str(), modeLut.at(mode).c_str()), fclose);
18611861
#else
1862-
return std::shared_ptr&lt;FILE&gt;(fopen(path.string().c_str(), modeLut.at(mode)), fclose);
1862+
return std::shared_ptr&lt;FILE&gt;(fopen(path.string().c_str(), modeLut.at(mode).c_str()), fclose);
18631863
#endif
18641864
}
18651865

@@ -1873,7 +1873,7 @@ <h2 id="_63">&mdash;</h2>
18731873
FileResult file_read(FileHandle file, std::span&lt;T&gt; elements) {
18741874
auto n = fread(elements.data(), sizeof(T), elements.size(), file.get());
18751875
return {
1876-
.numElements = n == 0 ? n : std::nullopt,
1876+
.numElements = n == 0 ? std::optional(n) : std::nullopt,
18771877
.errorCode = std::errc(ferror(file.get())),
18781878
.isEndOfFile = (bool)feof(file.get()),
18791879
};

0 commit comments

Comments
 (0)