????C++????????????????????????????C++???????????????????????C++???????????????????????????????????????C++?е?????????????????н????????????????ü??C++????
????1. ????(Function)
????(1) operator new function
????void * ::operator new(size_t);                  //Global
????void * class-name::operator new(size_t);    //Class
??????????C++??operator new function???????????????????????????????????????????operator new??????????????????±????????????????C++?????built-in??????????????????????????????????????operator new?????????????????????????????? ?????????????????????У???????operator new????????????????new?????????????????? ??????????????????operator new?? ??????????operator new??
??????????????????????????к??????????void *????? ??????????size_t??????????C++??????????????????????operator new????????????????void* ???????????????????size_t??????????????????????′????????
????error: ‘operator new’ takes type ‘size_t’ (‘unsigned int’) as first parameter
????????????????????????????????operator new function????????????????????????????Щ?????????????????????????й???????磬?????????????????????????????????к????????????????????????????????????
void * operator new(size_t unSize?? int nLine?? const char * pFunc)
{
prinft("Line: %d?? Func: %s?? allocate %u byte(s) "?? nLine?? pFunc?? unSize);
return malloc(unSize);
}
????(2) operator delete function
void operator delete( void * );
void operator delete( void *?? size_t );
??????????operator delete function??????operator delete function??????????????????????????????????????????operator delete function??????????????????????????????е?????????????????????????????????????????operator delete function????????????????????????????????????????ó??operator delete function?? ???????????
??????????????????????????????????????????????????????????????????????????????????????????????????С????????????????????????????????????????????????????operator delete function?????????????????????????????????????棨????ο?????????????
????2. ?????(Operator)
????(1) new operator
????[::] new [placement] new-type-name [new-initializer]
????[::] new [placement] ( type-name ) [new-initializer]
????????????’[]‘????????е??????optional????????
??????????new operator????????C++?У?????????????????????new operator???????????new operator?????????棬?????????????????????
????a. ????operator new function??????棨allocate the memory??
????b. ???ù???????call the constructor???????г????
?????????????new operator??????и????????????????
????placement: ???????????operator new function?? placement???????????????????
????type-name: ???????????????????????????(built-in)????????????????????????
????new-initializer: ????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????棬??????????????????