Date
2013-09-21.00:00:00
Message id
6690

Content

C++11's minimized allocator requirements are great, but they're still requiring more things from users than absolutely necessary.

  • They require X::value_type, but that can be deduced from SomeAllocator<T, Args>.

  • They require a1 == a2, but that could default to true as most allocators are stateless.

  • They require a1 != a2, but if we start requiring STL implementations to go through allocator_traits to provide an op== default, we won't need to require op!= from users at all. (std::allocator, of course, would continue to provide op!=. Note that this is analogous to reference/const_referencestd::allocator still provides them, but we don't require them from users, and in fact we don't require them to be consistent or meaningful if present.)

  • They require a == b and a != b. This requirement was not present in C++98/03, it is not necessary (a == b is always required to be equivalent to rebind-then-compare), and STL implementations don't even need to compare allocators of different types directly.