本文整理汇总了C++中Alloc::destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ Alloc::destroy方法的具体用法?C++ Alloc::destroy怎么用?C++ Alloc::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alloc
的用法示例。
在下文中一共展示了Alloc::destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
~Array1D() {
Alloc alloc;
for (int i = 0; i < mSize; ++i) {
alloc.destroy(&mData[i]);
}
alloc.deallocate(mData, mSize);
}
示例2: uninitialized_fill_n_with_alloc
inline void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const T& item, Alloc& alloc) {
ForwardIterator next = first;
BOOST_TRY {
for (; n > 0; ++first, --n)
alloc.construct(first, item);
} BOOST_CATCH(...) {
for (; next != first; ++next)
alloc.destroy(next);
BOOST_RETHROW
}
BOOST_CATCH_END
}
示例3: uninitialized_copy_with_alloc
inline ForwardIterator uninitialized_copy_with_alloc(InputIterator first, InputIterator last, ForwardIterator dest,
Alloc& alloc) {
ForwardIterator next = dest;
BOOST_TRY {
for (; first != last; ++first, ++dest)
alloc.construct(dest, *first);
} BOOST_CATCH(...) {
for (; next != dest; ++next)
alloc.destroy(next);
BOOST_RETHROW
}
BOOST_CATCH_END
return dest;
}
示例4:
void allocator_traits<Alloc>::destroy(Alloc& a, T* p) {
a.destroy(p); //TODO: It may not be implemented
}