Skip to content

Commit

Permalink
[faq] 优化 note 描述
Browse files Browse the repository at this point in the history
  • Loading branch information
FeignClaims committed Jan 31, 2024
1 parent 0cf0cb4 commit 52f1a1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/faq/copy_functions_parameter/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

拷贝函数用 :cpp:`Widget(Widget const& other)` 和 :cpp:`operator=(Widget const& other)`.

.. note::
.. hint::

本解答是很多人用 :cpp:`&` 作为参数出错而提问, 我忍无可忍的结果.

Expand Down
6 changes: 4 additions & 2 deletions docs/faq/pointer_output/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

:cpp:`cout` 即认为 :cpp:`char const*` 是字符串, 提供了以下函数重载:

.. note::
.. hint::

注意此处我放弃了说谎, 直接写出了 :cpp:`operator<<`, 这就是 :cpp:`cout << value` 的由来: 标准库定义了一个名为 :cpp:`operator<<` 的函数.
所谓 :cpp:`cout << value` 不过是定义了一个名为 :cpp:`operator<<` 的函数.

例如 :cpp:`ostream& operator<<(ostream& cout, int value);`

:cpp:`ostream& operator<<(ostream& cout, char const*)`: 作为字符串进行输出.
:cpp:`char*` 和 :cpp:`char const*`, 可以转换/直接传参为 :cpp:`char const*`, 都优先采用这个版本.
Expand Down

0 comments on commit 52f1a1f

Please sign in to comment.