take

Functions: takeFrom

takeFrom

T takeFrom<T>(T& slot, T defaultValue)

Moves the value out of the given slot, leaving defaultValue in its place.

This is the primitive behind take() methods; most code should call those instead. The default value must be fully owned and valid, since it becomes the slot's new contents. slot must not alias defaultValue; the copy reads the slot first and would alias.