placement-new
Invoking Destructor Approach Comparison
I\'m just curious to know if there is any significant/serious difference in these three approaches of invoking destructor. Consider the following code. Please also consider the two cases mentioned in[详细]
2023-01-30 01:07 分类:问答Destructor not called after destroying object placement-new'ed
I had no clue why this doesn\'t work. The following Function is created by placement new. A function is provided that checks whether it should be destructed, and if so, calls its destructor manually.[详细]
2023-01-30 01:03 分类:问答Placement-new vs gcc 4.4.3 strict-aliasing rules
I\'ve got some code that I\'ve been using successfully for some years to implement a \"variant-type object\"; that is, a C++ object that can hold a values of various types, but only uses (approximatel[详细]
2023-01-26 09:00 分类:问答Simple storage class in C++ and strict aliasing
I have the following code for having a small class for storage. #include <iostream> template<typename T>[详细]
2023-01-25 01:58 分类:问答placement new + array +alignment
SomeObj<unsigned int>* Buffer; char* BufferPtr = MemoryManager::giveMeSomeBytes(resX*resY*sizeof(SomeObj<unsigned int>));[详细]
2023-01-21 00:47 分类:问答Placement new and non-default constructors
Can I call the C++ placement new on constructors with parameters? I am implementing a custom allocator and want to avoid having to move functionality from non-default constructors into an init functio[详细]
2023-01-19 19:25 分类:问答Segfault in C++ calling virtual method on object created in pre-allocated buffer
Hmm... Title is a bit of a mouthful, but I\'m really not sure which part of this is causing issues, I\'ve run through it a ton of times, and can\'t pinpoint why...[详细]
2023-01-19 03:54 分类:问答Safe placement new & explicit destructor call
This is an example of my co开发者_运维问答des: template <typename T> struct MyStruct { T object;[详细]
2023-01-03 03:46 分类:问答placement new to defer to a different constructor
Is this safe?I\'m not using any virtual functions in my actual implementation, but I\'m temp开发者_运维知识库ted to believe that even if I was, it would still be safe.[详细]
2022-12-27 15:16 分类:问答operator new for array of class without default constructor
For a class without default constructor, operator new and placement new can be used to declare an array of such class.[详细]
2022-12-25 04:08 分类:问答