c – 构造不同的元素时,’std :: allocator :: construct’是否是线程安全的?
c标准是否保证使用std :: allocator构造不同的元素是线程安全的?例如:
// main thread
std::allocator<T> alloc;
auto *p = alloc.allocate(2);
// thread1
alloc.construct(p);
// thread2
alloc.construct(p + 1)
另外,对于不同的元素,std :: allocator :: destroy是否是线程安全的?
谢谢!