Method m_delete()


Method m_delete

mixed m_delete(object|mapping|multiset map, mixed index, mixed|void expected)

Description

If map is an object that implements lfun::_m_delete(), that function will be called with index as its single argument.

Otherwise if map is a mapping or multiset the entry with index index will be removed from map destructively.

If the mapping or multiset does not have an entry with index index, nothing is done.

If expected has been specified, the entry will only be removed if its value matches (with `==()).

Returns

The value that was removed will be returned, and UNDEFINED otherwise.

Note

Note that m_delete() changes map destructively.

Note

The third argument (expected) was added in Pike 9.0, and can be used for atomic test and unset.

See also

mappingp()