std::allocator_traits<Alloc>::construct 定义于头文件<memory> template<classT,class...Args> staticvoidconstruct(Alloc&a, T*p, Args&&...args); (C++11 起) (C++20 前) template<classT,class...Args> staticconstexprvoidconstruct(Alloc&a, T*p, Args&&...args); ...
std::allocator_traits<Alloc>::construct Defined in header<memory> template<classT,class...Args> staticvoidconstruct(Alloc&a, T*p, Args&&...args); (since C++11) (constexpr since C++20) If possible, constructs an object of typeTin allocated uninitialized storage pointed to byp, by callinga...
construct(p, std::forward<Args>(args)...) 进行。 若以上不可行(例如 Alloc 无construct() 成员函数),则调用 ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...) (C++20 前) std::construct_at(p, std::forward<Args>(args)...) (C++20 起)...
std::allocator_traits<Alloc>::construct Defined in header<memory> template<classT,class...Args> staticvoidconstruct(Alloc&a, T*p, Args&&...args); (since C++11) If possible, constructs an object of typeTin allocated uninitialized storage pointed to byp, by calling ...