-
Notifications
You must be signed in to change notification settings - Fork 246
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
Make the fields of Telegram types really optional (right now LinkPreviewOptions, ReplyParameters only) #320
base: master
Are you sure you want to change the base?
Conversation
Code becomes really complicated, tho, wrapping everything in boost optional? |
jsoncpp is promising. |
sure, i didnt know it was closed, now it is open |
cdfb903
to
d5a2690
Compare
d5a2690
to
42567f5
Compare
|
||
// use for: OptionalPtr<std::shared/unique_ptr<TYPE>> | ||
// for pointers, we assume optional value == nullptr (or not owned, etc) | ||
template<typename T> |
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.
You can specialize the Optional template to create a specific implementation for certain types.
8bdef95
to
d336b7a
Compare
This PR is an example approach how to make optional fields of a secondary type classes really optional.
I wrapped optional fields with boost::optional, right now only in LinkPreviewOptions, ReplyParameters classes.
It solves the problem described in issue #308
There are many such classes in Api, so consider this change as an example approach. Any way, it covers most used sendMessage() function, and solves problem with replies.