当前位置: 首页>>代码示例>>C++>>正文


C++ allocator::destroy方法代码示例

本文整理汇总了C++中allocator::destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ allocator::destroy方法的具体用法?C++ allocator::destroy怎么用?C++ allocator::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在allocator的用法示例。


在下文中一共展示了allocator::destroy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: free

void String::free()
{
    if (elements) {
        std::for_each(elements, end, [this](char &c){ alloc.destroy(&c); });
        alloc.deallocate(elements, end - elements);
    }   
}
开发者ID:magastzheng,项目名称:CppPrimer,代码行数:7,代码来源:ex13_44.cpp

示例2: free

void StrVec::free() {
	if (elements) {
		for (auto p = first_free; p != elements;) {
			alloc.destroy(--p);
		}
		alloc.deallocate(elements, cap - elements);
	}
}
开发者ID:PayneSun,项目名称:FirstRepository,代码行数:8,代码来源:source.cpp

示例3: release

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;
}
开发者ID:hdzz,项目名称:BigNumber,代码行数:9,代码来源:BigNumber+Class.cpp

示例4:

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;
}
开发者ID:hdzz,项目名称:BigNumber,代码行数:11,代码来源:BigNumber+Class.cpp

示例5: free

void String::free()
{
    for(char *p = s;p < s+sz;++p)
        alloc.destroy(p);
    alloc.deallocate(s,sz);
}
开发者ID:Edward-surpass,项目名称:Cplusplusprimer5,代码行数:6,代码来源:14.26ff.cpp

示例6: destroy

 static void destroy(T* ptr) {
     alloc_.destroy(ptr);
     alloc_.deallocate(ptr, 1);
 }
开发者ID:Stone1973,项目名称:crossbow,代码行数:4,代码来源:singleton.hpp


注:本文中的allocator::destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。