
28 Jan
2005
28 Jan
'05
9:22 p.m.
Rob Stewart wrote: [...]
Note, however, that a namespace scope reset() can be construed as meaning different things to different types. For example, it could be specialized to provide the fastest means to reset any object to its initial state. Thus, it might do std::vector<T>().swap(v) or something uglier for other types.
Thus, reset() should be designed and documented to be customizable for a reasonable meaning of "reset" for any type.
Everybody is free to overload reset for his own types, which makes perfect sense e.g. for smart prts: template <typename T> void reset(shared_ptr<T> &p) { p.reset(); } ...is found via ADL Stefan