No -- this thread is from 2016; few opinions survive that long. ![]()
Deque uses ManagedBufferPointer so that it can implement a shared empty singleton with type punning. This is roughly the same use case that Dave mentioned three years ago.
ManagedBuffer and ManagedBufferPointer both have unnecessarily unpleasant interfaces, and we can do (and Swift programmers deserve) so much better.
But of these two types, ManagedBufferPointer is probably sitting ever so slightly closer to what would be a better replacement. One big contributor to ManagedBuffer's unpleasantness is the way it pollutes the member namespace of the class -- even clobbering desirable names, such as capacity. In data structure internals, we often cannot avoid dealing with references to the storage object, and these prominent, non-hidable members are inviting accidental misuse, or layering violations.
(Note: at this point, I think it'd be best to wait with the overhaul until non-copyable types (and, probably more crucially, related language improvements such as borrowing/consuming) are usable, and until we have gained enough experience with them to learn their limits. It would be a shame to add alternative API only to regret and rework it again soon after. Meanwhile, specialized packages can experiment with alternative formulations to propose later.)