--- Comment #1 from Daniel Gibson <metalcae...@gmail.com> 2011-05-01 21:37:12
An additional comment: Seems like clear() *is* documented - not in the online
documentation but in TLDP on pages 187/188 (for classes) and 253/254 (for
It says: "You can invoke a struct object’s destructor explicitly by calling
clear(obj).", and the last code-example included
auto obj1 = S("first object");
No new there, so it's even correct with the current clear implementation.
It doesn't mention that clear doesn't work with "auto obj = new S("blah");".
And TLDP doesn't mention at all (at least on the pages the index lists for
"clear") that clear can be used with simple types and even pointers, setting
them to T.init.
So I'd suggest to only allow clear() for (class-) Objects, structs and pointers
to structs (in that case dereferencing the pointer and clearing the struct).
If something like clear() that is so generic that it works for *any* type is
needed, just add another function that does what clear() currently does.
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------