-
Notifications
You must be signed in to change notification settings - Fork 199
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
Conversation
flare/base/empty_completion.h
Outdated
@@ -0,0 +1,26 @@ | |||
// Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved. |
There was a problem hiding this comment.
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的,这部分可以合进来
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯好
MakeReferencingBuffer
flare/doc/buffer.md
Outdated
@@ -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),指向需要引用的缓冲区。 |
There was a problem hiding this comment.
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)
前后加上"`"感觉可能会好一些
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好
flare/doc/buffer.md
Outdated
@@ -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)",指向需要引用的缓冲区。 |
There was a problem hiding this comment.
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渲染乱了……
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
噢噢, 看错了
There was a problem hiding this comment.
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)`,指向需要引用的缓冲区。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
呃呃
已合并,感谢🙏 |
Barrier
中的empty_completion
可以单独拿出来Buffer.md里有点错误