Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the description error in the buffer document #92

Merged
merged 1 commit into from
Mar 19, 2023

Conversation

4kangjc
Copy link
Contributor

@4kangjc 4kangjc commented Mar 19, 2023

Barrier中的empty_completion可以单独拿出来
Buffer.md里有点错误

@@ -0,0 +1,26 @@
// Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不建议这么改,这个在buffer/barrier中的重复抽离出来有点“巧合内聚”的意思。

类似的,std::barrier选择把CompletionFunction定义成"an unspecified function object type",而不是提供一个std::empty_completion我想也有类似的考量。(不然的话我们在这儿就可以直接使用std::empty_completion了)

其实类似的还有一些no-op的对象,比如如果我们扩展成:

struct noop {
  template <class... Ts> void operator()(const Ts&&...) const noexcept {}
};

这样不但可以用于现在的case,还可以用于类似于std::shared_ptr{ptr, noop()}等等。(当然这儿我挺希望某一天std里面能有一个std::null_deleter的,偶尔确实能用到)

不这么做(不引入struct noop)的原因也是类似的,这种“重用性”过于巧合,而且没有节省太多的代码量,所以带来的理解成本就不是特别划算了。


buffer.md部分的修改我是ok的,这部分可以合进来

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯好

@4kangjc 4kangjc changed the title Refactor MakeReferencingBuffer Fix the description error in the buffer document Mar 19, 2023
@@ -56,7 +56,7 @@ flare::NoncontiguousBuffer RepackNoncontiguousBuffer(

这通常通过[`MakeReferencingBuffer(...)`](../base/buffer.h)实现。

这个方法接受一个[`std::string_view`](https://en.cppreference.com/w/cpp/string/basic_string_view),指向需要引用的缓冲区。
这个方法接受两个参数(const void* ptr, std::size_t size),指向需要引用的缓冲区。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(const void* ptr, std::size_t size)前后加上"`"感觉可能会好一些

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -56,7 +56,7 @@ flare::NoncontiguousBuffer RepackNoncontiguousBuffer(

这通常通过[`MakeReferencingBuffer(...)`](../base/buffer.h)实现。

这个方法接受一个[`std::string_view`](https://en.cppreference.com/w/cpp/string/basic_string_view),指向需要引用的缓冲区。
这个方法接受两个参数"(const void* ptr, std::size_t size)",指向需要引用的缓冲区。
Copy link
Collaborator

@0x804d8000 0x804d8000 Mar 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emm不是说引号,是说`这个符号(代码块的那个)

主要是comment里面直接打```的话,渲染不出来单个`的效果

所以我刚才的comment里面打了"`"

edit:加了几个换行,不然`又给github渲染乱了……

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

噢噢, 看错了

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就是类似于这样:

这个方法接受两个参数`(const void* ptr, std::size_t size)`,指向需要引用的缓冲区。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

呃呃

@0x804d8000
Copy link
Collaborator

已合并,感谢🙏

4kangjc pushed a commit to 4kangjc/flare that referenced this pull request Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants