예제 #1
0
 ~Array1D()  {
     Alloc alloc;
     for (int i = 0; i < mSize; ++i) {
         alloc.destroy(&mData[i]);
     }
     alloc.deallocate(mData, mSize);
 }
예제 #2
0
파일: details.hpp 프로젝트: chinjao/ros_src
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
0
파일: details.hpp 프로젝트: chinjao/ros_src
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
0
 void allocator_traits<Alloc>::destroy(Alloc& a, T* p) {
   a.destroy(p); //TODO: It may not be implemented
 }