what does this mean? this leads to failure of calling new operator?
【在 l******c 的大作中提到】 : private new operator : : than
d*0
19 楼
失业保险可以领
【在 k*********s 的大作中提到】 : 不要领那个钱,有纪录太难看了
y*0
20 楼
这个运气其实可以改变的,好好捣拾捣拾比打扮的差等运气要容易多了。。
【在 c**i 的大作中提到】 : (:道理当然是如此。 : 所以说纯粹是运气。
d*i
21 楼
非常感谢2位!
g*y
22 楼
i guess you can pre-allocate some memory in compile time, and then manage that memory yourself (memory pool alloc/free), and then redefine the new operator (class specific operator new)
【在 c***y 的大作中提到】 : what does this mean? this leads to failure of calling new operator?
There are 3 memory storage types for c++ to allocate memory for an object. 1. stack memory for object inside a function. 2. static storage for namespace-scope objects and local static objects 3. heap storage for dynamically-allocated objects. If the stack in you problem refers to the first type of memory storage, there is only one method that you could do this, which is defining a function, allocating memory for an object inside a function, and using it. You cannot use it outside of a function.
【在 c***y 的大作中提到】 : how to enforce an object instance only be allocated on the stack rather than : the heap at compile time? : thanks a lot.