std::allocator
의 construct
및 destroy
멤버 함수는 요소의 유형에 매개 변수를 구성 할 수 있습니다왜 std :: allocator :: construct와 std :: allocator :: destroy는 요소 유형에 템플릿을 사용합니까?
template<class T>
class allocator
{
public:
typedef T value_type;
typedef T* pointer;
template<class U, class... Args>
void construct(U *p, Args&&... args);
template<class U>
void destroy(U *p);
...
};
이에 대한 근거 무엇입니까? 왜 그들은 value_type*
또는 pointer
중 하나를 선택하지 않습니까? allocator<T>
은 T
유형의 개체를 구성하거나 파괴하는 방법 만 알고 있어야합니다.