-
Notifications
You must be signed in to change notification settings - Fork 83
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
traits: ability to define what optional means #146
Comments
Am I right to assume that working with |
yes because that is an API change and it wouldn't be true. The object always has the bool (or int or string for that matter), it's just about how to serialize this object to json. |
After checking the source I believe that |
Now I'm wondering whether we still need |
Great, I agree with that so far. Yes, I like |
After the most recent change Consequently template< typename A, template< typename... > class Traits, typename C >
[[nodiscard]] static bool require_encode( const C& x )
{
return ( N == for_nothing_value::encode ) || ( A::kind == member_kind::required ) || ( !A::template is_nothing< Traits >( x ) );
} |
Yes, I agree and the logic is very good. Thanks a lot! |
Hi, here is another idea: right now there the possibility to define what "nothing" means by implementing
is_nothing
in a trait. However, this is applied to bothTAO_JSON_BIND_REQUIRED
andTAO_JSON_BIND_OPTIONAL
. Would it be possible to limit it toTAO_JSON_BIND_OPTIONAL
? Or is it possible to find another way to define what it means for a value to be optional? Sometimes I want to serialize afalse
value and sometimes I don't (need to). But I can only implement oneis_nothing
forbool
.The text was updated successfully, but these errors were encountered: