Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Pick Variant from Standalone Maybe #6856
Pick Variant from Standalone Maybe #6856
Changes from 28 commits
45aba9b
7010891
ae926b5
67be133
30e2a0b
e41efcf
cb9f4bb
01be3c7
42ecdc1
fdbbadc
f46a1bd
a07112f
620c681
61fc090
ee0666f
0e90621
eac99c1
faf244d
12699a5
2b2545e
405e709
31476a7
0b89912
605633a
af6eb1e
f905b2b
74be59d
da224cf
6aab4cb
058e5fb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
NullOpt其实从字面意思上讲就是专门给Optional用的,这里强行合并感觉不大好。如果只是为了统一一些接口的话,是不是可以提供一个基类,NullOpt和monostate都继承一个公共的基类
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.
因为我定义了一个 using OptionalVariant<T...> = Variant<NullOpt, T...> 类型,所以 NullOpt 在 Variant 中的含义很容易被解释通(Variant 本身是不允许存在 null 状态的,除了一些比较极端的情况)。
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.
那这个注释最好也把Variant改成OptionalVariant
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.
InPlaceTypeT和InPlaceT的区别是?
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.
InPlaceType 可以接受一个类型,比如
InPlaceType<int>
,用来初始化 variant 到 int 类型。InPlace 是给 Optional 用的,用来初始化 optional 到存在值的类型,本身没有模板参数。(我重写了个不带 shared_ptr 的 Optional,这个 pr 里没有,在原本的那个 standalone maybe 里)