Index of /~TDDD38/exercises/Container_Design/src/Step_7

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[TXT]Container.h2015-02-11 09:50 2.3K 
[   ]Container.tcc2016-12-13 10:12 11K 
[   ]Makefile2015-02-11 09:50 595  
[TXT]README2016-12-02 14:04 1.0K 
[TXT]container-test.cc2015-02-11 09:50 4.1K 

README Container Design, Step 7
----------------------------------------------------------------------------
Here we have remodeled memory allocation and deallocation, to make it more
efficient, by avoiding initialization of yet unused storage, and logically
more correct, by also destroying elements when removed. To accomplish this
we have replaced the array of T allocation with a new expression like, 'new
T[n]', with a call to the global memory allocation function operator new, 
'::operator new(sizeof(T)*n)'. In this way the T default constructor will
not be invoked, instead we invoke the copy/move constructor when inserting
a T object into the container, using placement new. When removing an element
we explicitly call the destructor for that element, and when the container
object is to seize to exist, we first destroy all stored elements, and then
deallocate the memory using the global memory deallocation function 
::operator delete().
----------------------------------------------------------------------------