Archived

This topic is now archived and is closed to further replies.

overloading delete[]

This topic is 5377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I''m trying to do a debug system and i had to overload global operator delete[] with 4 parameters, but the msdev gives me this compile error C2660 (function does''t require 4 parameters) in the end of the class declaration. Can anyboby explain me that? PS: If i switch some header files or i overload the operator with 1 parameter (void*) it works.

Share this post


Link to post
Share on other sites
Correct me if I''m wrong, but I don''t believe you are allowed to change the parameters an operator takes with overloading. I don''t know if this would work in your situation, and it isn''t a very elegant solution, but you could just have a couple extra vars in your class that are set by the prog before calling delete. Then the overloaded delete operator checks them.

Share this post


Link to post
Share on other sites
Instead of trying to overload the C++ function, why don''t you just create a function for your class that does what you need, but has a different name.
ex. DeleteItems[blah][blah][blah][blah]


- God is my favorite fictional character

Share this post


Link to post
Share on other sites
I''am trying to do a memory manager than can work with C vartypes.
Making a delete oparator for a class isn''t my goal.
Overloading delete[] works,but my declaration order is bad.

Share this post


Link to post
Share on other sites