Does STL Vector use 'new' and 'delete' for memory allocation by default?

前端 未结 5 1775
小鲜肉
小鲜肉 2021-02-08 14:57

I am working on a plugin for an application, where the memory should be allocated by the Application and keep track of it. Hence, memory handles should be obtained from the host

5条回答
  •  春和景丽
    2021-02-08 15:40

    From this article, "The concept of allocators was originally introduced to provide an abstraction for different memory models to handle the problem of having different pointer types on certain 16-bit operating systems (such as near, far, and so forth)" ...

    "The standard provides an allocator that internally uses the global operators 'new' and 'delete'"

    The author also points out the alocator interface isn't that scary. As Neil Buchanan would say, "try it yourself!"

提交回复
热议问题