fixed: in MemBuffer::MemBuffer(const MemBuffer<> & arg)

we have to initialize some variables before calling the operator=



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@434 e52654a7-88a9-db11-a3e9-0013d4bc506e
master
Tomasz Sowa 10 years ago
parent 1e48455942
commit 6e57002a90

@ -156,6 +156,9 @@ private:
size_t size_allocated; // how many memory is reserved
size_t size_reserved; // memory reserved by reserve(), it is used by clear()
// used by ctors
void Initialize();
void add_dynamic_node();
};
@ -440,7 +443,7 @@ bool MemBuffer<item_type, stack_size, heap_block_size>::const_iterator::operator
template<typename item_type, size_t stack_size, size_t heap_block_size>
MemBuffer<item_type, stack_size, heap_block_size>::MemBuffer()
void MemBuffer<item_type, stack_size, heap_block_size>::Initialize()
{
size_reserved = 0;
size_used = 0;
@ -452,6 +455,13 @@ MemBuffer<item_type, stack_size, heap_block_size>::MemBuffer()
}
template<typename item_type, size_t stack_size, size_t heap_block_size>
MemBuffer<item_type, stack_size, heap_block_size>::MemBuffer()
{
Initialize();
}
template<typename item_type, size_t stack_size, size_t heap_block_size>
MemBuffer<item_type, stack_size, heap_block_size>::~MemBuffer()
{
@ -468,6 +478,7 @@ MemBuffer<item_type, stack_size, heap_block_size>::~MemBuffer()
template<typename item_type, size_t stack_size, size_t heap_block_size>
MemBuffer<item_type, stack_size, heap_block_size>::MemBuffer(const MemBuffer<item_type, stack_size, heap_block_size> & arg)
{
Initialize();
operator=(arg);
}

Loading…
Cancel
Save