-
Notifications
You must be signed in to change notification settings - Fork 232
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
[feat][dynamic reflection] small edit #290
Conversation
171930433
commented
Jun 28, 2024
- add const to_* but to_pb
- using auto const& in range for
2. using auto const& in range for
ok, please resolve the conflicts |
done |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #290 +/- ##
==========================================
+ Coverage 48.19% 49.09% +0.89%
==========================================
Files 53 53
Lines 6241 6363 +122
==========================================
+ Hits 3008 3124 +116
- Misses 3233 3239 +6 ☔ View full report in Codecov by Sentry. |
iguana/reflection.hpp
Outdated
@@ -564,15 +564,16 @@ struct field_info { | |||
struct base { | |||
virtual void to_pb(std::string &str) {} |
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?
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.
to_pb 的实现较为复杂,直接改成const会有大量的编译错误,所以这次没做修改
std::string str; | ||
p1.to_json(str); | ||
|
||
// p1.to_pb(str); // compile failed |
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.
to_pb为什么会编译失败?
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.
原来的to_*都是非const的函数,所以任意的T const a; a.to_*都会编译失败,所以写了这个测试用例
我晚点看一下。 |
你把cache_zize变量前加一个mutable,然后就能用const了。 |
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.
LGTM