Alf P. Steinbach wrote:
* Juha Nieminen:
Alf P. Steinbach wrote:
You mean, by explaining things carefully, and even posting working code?
The first code you posted didn't work
I beg your pardon, it worked very nicely. I posted tested code to you.
Don't lie.
You posted a smart pointer which only works for incomplete types if
the user provides the smart pointer class with a pointer to a deleter
function, and then you wrote an example of how to use it like that.
However, your code does not work for incomplete types if the user does
not give it the deleter function. Thus it doesn't work for all cases.
because it required the type to be complete at destruction.
It did not have such requirement.
In your original code you directly called the templated deleter
function from the destructor of the smart pointer. That instantiates the
deleter function in the context where the destructor is called and thus
requires for the type to be complete.
Perhaps you managed to misunderstand it.
I understood that in order to work with incomplete types the user has
to give it a deleter function. Too burdensome and unnecessary.
Note that in all codes so far, including your own, there has been a
function that does the destruction, at a point where the type is
complete; I'm assuming that is not what you're referring to, since that
would be a fallacy.
The difference is whether the type must be complete when the
destructor (or assignment operator) of the smart pointer is executed or
not. The destructor must not instantiate the deleter function (because
if it does so, it immediately requires for the type to be complete). The
only way to avoid that is to call the deleter function indirectly
through a pointer.
maintain that it's necessary.
I'd give thanks if your solutions worked, but they don't.
Worked fine for me.
Also regarding the alleged complication.
It's just babble.
Goodbye.
A: Because it messes up the order in which people normally read text.
A: Top-posting.