Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++custom allocatorsSingle-choice MCQ

Under the C++17 allocator model, why must a container call `std::allocator_traits<Alloc>` instead of the allocator's members directly?

// Inside a container: using Traits = std::allocator_traits<Alloc>; Traits::construct(alloc, ptr, args...); Traits::destroy(alloc, ptr);