¡@

Home 

c++ Programming Glossary: new_size

Is realloc guaranteed to be in-place when the buffer is shrinking?

http://stackoverflow.com/questions/3162502/is-realloc-guaranteed-to-be-in-place-when-the-buffer-is-shrinking

So that the following new_ptr data_type realloc old_ptr new_size sizeof data_type will always give new_ptr old_ptr if new_size.. sizeof data_type will always give new_ptr old_ptr if new_size old_size except of course when new_size 0 . It seems sensible.. new_ptr old_ptr if new_size old_size except of course when new_size 0 . It seems sensible to me that it would work this way but..

Does std::vector *have* to move objects when growing capacity? Or, can allocators “reallocate”?

http://stackoverflow.com/questions/8003233/does-stdvector-have-to-move-objects-when-growing-capacity-or-can-allocator

to clarify. Current resize pointer p alloc.allocate new_size for size_t i 0 i old_size i alloc.construct p i T std move buf.. std move buf i alloc.destroy buf i for size_t i old_size i new_size i alloc.construct p i T alloc.deallocate buf buf p New implementation.. implementation pair pointer bool pp alloc.reallocate buf new_size if pp.second as before else only construct new elements c..