placement-new
Placement new breaks consts and references?
Following the discussion on my answer to this question, apparently: the following code is allowed struct Foo {[详细]
2023-04-09 17:26 分类:问答what is placement new operator in C++ and does java has it?
I heard about placement new operator of C++. I am confused what it is. However, I can see where it can be used under a question in stackoverflow. I am also confused whether we have this in java or not[详细]
2023-04-05 05:20 分类:问答Can I use placement new(this) in operator=?
Background开发者_StackOverflow: I have a complicated class with many variables.I have a sound and tested copy constructor:[详细]
2023-03-30 16:48 分类:问答How to implement safe copy constructor for class that has internal placement new (with std::string)
Here\'s my code: struct RS_Token { char id; char cleanup; unsigned char array[sizeof (std::string) > sizeof (double) ? sizeof (std::string) : sizeof (double)];[详细]
2023-03-27 10:36 分类:问答Mixing operator new[] and placement new with ordinary delete[]
Just out of curiosity, is the following legal? X* p = static_cast<X*>(operator new[](3 * sizeof(X)));[详细]
2023-03-16 03:50 分类:问答Using placement new in a Vector Container
If I have a container: std::vector<T*> elements; can I use placement new to allocate my objects so that the objects are all allocate开发者_如何学Pythond contiguously? So that I can do somethi[详细]
2023-02-28 04:44 分类:问答Regarding placement new in C++
I am having a problem with the placement new operator. I have two programs: Program1 (operator.cpp) and Program2 (main.cpp):[详细]
2023-02-05 03:23 分类:问答Unusual use of new in historical code. What does it mean?
I am just porting some old code: #define NewArrayOnHeap(TYPE, COUNT, HEAP, NEWPTR, ERROR) \\ ((*(NEWPTR) = new ( #TYPE "[" #COUNT "]", __alignof(TYPE), (HEAP), &hr, (ERROR)) TY[详细]
2023-02-05 02:10 分类:问答When a constructor is called explicitly is the initializer and member variables constructed?
In the use of \"placement new\" it is suggested to call the cons开发者_Go百科tructor and destructor explicitly.[详细]
2023-02-03 14:19 分类:问答Overriding new but telling unordered_map not to use it
I\'m writing a garbage collector for C/C++ as a programming exercise, and part of this involves globally overriding new. However, the garbage collector also uses an unordered_map (to store pointers to[详细]
2023-01-30 20:34 分类:问答