diff options
Diffstat (limited to 'src/value.cpp')
-rw-r--r-- | src/value.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/value.cpp b/src/value.cpp index 1fec43a..4170404 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -348,6 +348,27 @@ Value &Value::operator=(const Value &value) return validate(); } + +/** + * Assignment operator + * @param value + * @return Value + */ +Value &Value::operator=(std::nullptr_t value) +{ + // if this is not a reference variable, we should detach it to implement copy on write + SEPARATE_ZVAL_IF_NOT_REF(&_val); + + // deallocate current zval (without cleaning the zval structure) + zval_dtor(_val); + + // change to null value + ZVAL_NULL(_val); + + // update the object + return validate(); +} + /** * Assignment operator * @param value |