??????????reallocate()???????
template <class T> void VECTOR<T>::reallocate()
{
ptrdiff_t size = first_free - elements;
ptrdiff_t newCapacity = 2 * max(size?? 1);
T *newElement = alloc.allocate(newCapacity);                //???????????
uninitialized_copy(elements?? first_free?? newElement);        //?????????????????
for (T *p = first_free; p != elements; )                    //??????????????????????
{
alloc.destroy(--p);
}
if (elements)
{
alloc.deallocate(elements?? end - elements);                //??????????
}
elements = newElement;                                        //?????????????????
first_free = elements + size;
end = elements + newCapacity;
}
?????????????????????????????vector??STL?????????????????STL???????????飬???????????????????
????2??operator new??????operator delete????
?????????string *sp = new string("initialized");????????????裺
??????1?????????operator new???????????????????????δ?????????棬????????????????????
??????2?????и???????????????????????????????????
??????3??????????·???????????????
?????????delete sp;????????????裺
??????1????sp??????????????????????????
??????2?????????operator delete?????????????????????檔
????operator new??operator delete??????????????汾??????汾???????new??????
????void *operator new(size_t);
????void *operator new[](size_t);
????void *operator delete(size_t);
????void *operator delete[](size_t);
????????????operator new??operator delete???????????new????????????????????????е?????????????????δ???????檔???????£?
????T *newElement = alloc.allocate(newCapacity);                //???????????
????T *newElement = static_cast<T*>(operator new[](sizeof(T) * newCapacity));
?????????????????????????????????????????
????alloc.deallocate(elements?? end - elements);                //??????????
????operator delete[](elements);
?????????allocator??????????????棬???????????????????λ???????棬??????operator new??????????????????????????????operator new??operator delete????????
??????????????????
????C++??????????????????й???????????
??????1??allocator?????construct??destroy??
??????2????λnew??????
??????3???????????????????????????????????????????????????檔
??????4????uninitialized_copy??uninitialized_fill???????
????????????????λnew???????????????????????????
??????λnew??????????????????г?????????????????????棬????????????δ????????????????????г?????????????λnew????????????
????new (place_address) type
????new (place_address) type(initializer-list)
????????place_address????????initializer-list????????????????????б?????????£?
????alloc.construct(first_free?? t);
????new (first_free) T(t);
????string *sp = alloc.allocate(2);
????new (sp) string(b?? e);
???????
??????1????λnew?????????????????????????κι???????????????????allocator???construct?????????????????????
??????2??????????????????????????????????????п???????????????????????????塣?????Щ?????????????????????????????????????????????е?????????????????????????????????????λnew??????