I play with dynamic memory allocation “manually”, and I wanted to see how the repository will be implemented by the guys from MS, but when debugging it “intervened” it moved me to the code:
inline void *__CRTDECL operator new(size_t, void *_Where) _THROW0() { // construct array with placement at _Where return (_Where); }
Can someone explain to me how on earth this code puts my object in the place indicated by my pointer when all I see in this code is a line with a return statement with what I set as an argument. I don’t think that saying in a comment that I would like this fnc to do is actually enough for it to work. Thank you for your constructive answers.
operator new , . , , , " , , ". , operator new, new. operator new , .
operator new
, , new T(...) ( " " ), - : . , . operator new. , , operator new , .
new T(...)
- . , this. , , : no-op, .
this
inline void* operator new(size_t, void *p) throw() { return p; }
- no-op.
Source: https://habr.com/ru/post/1722817/More articles:how to get last row id removed from SQL table - sqlF # Asp.Net CodeDom ProviderOptions Issue - model-view-controllerHow to get Javadoc to include documentation for a subproject? - javaGet a combination of two colors in .NET. - .netРазделение абзаца на 160 символов для текстовых сообщений - stringFunctional Collisions in Go - goExplicit destructor call in a signal handler - c ++Include PHP highlights in VS 2010? - phpDoes ASP.NET MVC Provide Ingestion Data? - c #Subversion Deployment Workflow for Web Development - svnAll Articles