Stack-buffer based STL allocator?

前端 未结 6 1793
不知归路
不知归路 2020-11-28 03:17

I was wondering if it practicable to have an C++ standard library compliant allocator that uses a (fixed sized) buffer that lives on the stack.

Somehow,

6条回答
  •  無奈伤痛
    2020-11-28 04:08

    It really depends on your requirements, sure if you like you can create an allocator that operates only on the stack but it would be very limited since the same stack object is not accessible from everywhere in the program as a heap object would be.

    I think this article explains allocators it very well

    http://www.codeguru.com/cpp/cpp/cpp_mfc/stl/article.php/c4079

提交回复
热议问题