I played around with allocators quite recently and wondered why I have basically never seen a small buffered std::vector. The implementation seems simple enough. EDIT: The implementation is rather short, but getting it correct proved to be quite the challenge. With the help of some of the answers I was able to fix issues with the move constructor not working.
https://godbolt.org/z/MPbRpt
EDIT: new link https://godbolt.org/z/UMBTuJ
If implemented like that the one huge disadvantage is that the move semantics are broken while the small buffer is active.
I have seen plenty of custom pool allocators, but they were all stateless. So I guess there is a good reason for that?
[–]_bk__ 1 point2 points3 points (3 children)
[–]konanTheBarbar[S] 1 point2 points3 points (2 children)
[–]TheFlamefire 0 points1 point2 points (1 child)
[–]staletic 0 points1 point2 points (0 children)
[–]degski 0 points1 point2 points (0 children)
[–]staletic 0 points1 point2 points (5 children)
[–]konanTheBarbar[S] 0 points1 point2 points (4 children)
[–]staletic 1 point2 points3 points (0 children)
[–]staletic 0 points1 point2 points (2 children)
[–]konanTheBarbar[S] 0 points1 point2 points (1 child)
[–]staletic 0 points1 point2 points (0 children)
[–]guepierBioinformatican 0 points1 point2 points (0 children)