Skip to main content
GameDev.net gamedev.net
🔒 Locked

overloading delete[]

Started by steli Mar 24, 2003 at 4:08 AM 3 replies 200+ views
Original Post
steli
steli
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.
AikonIV
AikonIV
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.
steli
steli
I can change the parameters following the c++ standard: first param is void*, and second is size_t, etc...
deadlydog
deadlydog
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
steli
steli
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.