Meaning of .clear() for containers
so
so at so.do
Fri Jan 7 04:54:06 PST 2011
> clear as a global function is for destroying a class/struct
>
> clear as a member can do anything. clear is not a keyword.
>
> clear(container) -> same as delete container, but without freeing any
> memory.
>
> container.clear() -> remove all elements
>
> This has been brought up before as a problem, I'm not sure it's that
> terrible, but I can see why there might be confusion.
Thanks for the example, this semantical issue was bugging me for a while
(not the OOP vs whatever flamewar).
Is there a semantical difference between "function(obj)" and
"obj.function()"?
If we are not clear on this simple thing, we should just stop here :)
More information about the Digitalmars-d
mailing list