You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The C++ mutation methods fail if the buffer has a field set to the default value and it is asked to mutate it to the same default value. This happens because SetField<T>(field, val) looks for that offset and returns false when it's missing. I think we should pass in defaultval and return val == defaultval instead when the field is unset.
As a workaround, I can add a condition on the outside to check for equality. Long term though, I think it would be best to make this change internally, both for readability and for performance.
The text was updated successfully, but these errors were encountered:
I should add that the behavior implied with the proposed change is that if the value goes from a non-default value back to the default, it should modify the existing field rather than invalidate the operation. The assumption is that mutation is used when you want to maximize reuse, so it should invalidate as infrequently as possible.
The C++ mutation methods fail if the buffer has a field set to the default value and it is asked to mutate it to the same default value. This happens because
SetField<T>(field, val)
looks for that offset and returnsfalse
when it's missing. I think we should pass in defaultval and returnval == defaultval
instead when the field is unset.As a workaround, I can add a condition on the outside to check for equality. Long term though, I think it would be best to make this change internally, both for readability and for performance.
The text was updated successfully, but these errors were encountered: