What is a <T> spreader
2 answers
This is an abstraction of memory management.
In C programming, you essentially use the functions malloc()and free()to allocate memory fragments, without the need to know how the pieces are distributed. In C ++, the functions operator new()and operator delete().
std::allocator - , , . std::allocator operator new() operator delete() , , std::allocator<T> , T , , T.
std::allocator<T>:
allocate(size_type n)operator new()n * sizeof (T). :nT;new T(),Tno-arg,allocate(size_type n)nT.construct().deallocate(pointer p, size_type n)operator delete(), , ,allocate(). ,deallocate().destroy()nT, .construct(pointer p, const T& val)TT,p.destroy(pointer p)TT,p.
+6