Is it possible in c++ to allocate an object at a specific place in memory? I'm implementing my hobby os kernel memory manager which gives void*
addresses to store my stuff and I would like to know how can I use that pointer to allocate my object there. I have tried this:
string* s = (string*)235987532//Whatever address is given.
*s = string("Hello from string\n\0");//My own string class
//This seems to call the strings destructor here even thought I am using methods from s after this in my code...
The only problem with this is that it calls string objects destructor which it shouldn't do. Any help is appreciated.
EDIT: I cannot use placement new because I'm developing in kernel level.