Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Placement new to initialize inplace object
- class SomeClass {
- public:
- SomeClass() {}
- int someInt;
- };
- int main(...) {
- int dummy = 42;
- int *pSomeClass = new (&dummy) SomeClass();
- cout << pSomeStruct->someInt << endl;
- }
Add Comment
Please, Sign In to add comment