Example #1
0
void String::free()
{
    if (elements) {
        std::for_each(elements, end, [this](char &c){ alloc.destroy(&c); });
        alloc.deallocate(elements, end - elements);
    }   
}
Example #2
0
void StrVec::free() {
	if (elements) {
		for (auto p = first_free; p != elements;) {
			alloc.destroy(--p);
		}
		alloc.deallocate(elements, cap - elements);
	}
}
Example #3
0
inline void BigNumber::release()
{//Free BigNumber space
    if(first_free){
        while(first_free != val) alloc.destroy(--first_free);
        alloc.deallocate(val,cap);
    }
    val=first_free=NULL;
    cap=len=dot=0;
}
Example #4
0
inline BigNumber::~BigNumber()
{//Destructor
    if(val){
        for(;first_free!=val;)
            alloc.destroy(--first_free);
        alloc.deallocate(val,cap);
    }
    val=first_free=NULL;
    cap=0;
    dot=len=0;
}
void String::free()
{
    for(char *p = s;p < s+sz;++p)
        alloc.destroy(p);
    alloc.deallocate(s,sz);
}
Example #6
0
 static void destroy(T* ptr) {
     alloc_.destroy(ptr);
     alloc_.deallocate(ptr, 1);
 }