Can a compliant stateful allocator be unequal to its older copy?

  allocator, c++, c++11, dynamic-memory-allocation

The standard prescribes that an allocator must be equal to its copies, with respect to moves and rebinding. But can it become unequal to its previous state after its member functions are invoked, for example after allocating a value? That is, could this be a compliant allocator?

auto allocator_copy = allocator;
std::cout << (allocator == allocator_copy) << std::endl;  // Outputs "1", as prescribed by the standard.
allocator.allocate(1);
std::cout << (allocator == allocator_copy) << std::endl;  // Outputs "0";

Source: Windows Questions C++

LEAVE A COMMENT