So I intend to use this stack-based allocator for std::vector, and I use 2 arrays for the allocation(because vectors grow and copy the old buffer to t ...
So I intend to use this stack-based allocator for std::vector, and I use 2 arrays for the allocation(because vectors grow and copy the old buffer to t ...
. Answers to this question are eligible for a +50 reputation bounty. do ...
Say I have a container that uses a hardcoded pmr allocator to store data. What is the consensus among the C++ community: should operator==() compare e ...
in std::vector, why does the stl overload the constructors like that: Why not just do this? Edit: Since rvalues can't bind to a non const lvalu ...
I'm trying to reproduce the std::vector container, and I saw that in one of the vector constructor prototype we can give an allocator. So two quest ...
I have this code snippet Output: With this allocator So it's obvious that construct/destroy are called for each char element of the buffer wh ...
The default std::allocator class is stateless in C++. This means any instance of an std::allocator can deallocate memory allocated by another std::all ...
Is there a way, having one allocator object for type T, to use the SAME object to allocate memory for any other type. Maybe some magic with static_cas ...
The following code: std::pmr::vector<std::pmr::vector<int>> outer_vec(std::pmr::get_default_resource()); outer_vec.emplace_back(std::pmr: ...
The main problem was reallocating memory while expanding it and conserving data and the first starting memory address which is used by many other part ...
How should I make sure that a constructor is noexcept if the allocator does not throw? Here is an MRE: First of all, I wonder why does noexcept( s ...
I'm trying to create a pmr-allocated datastructure (compare code below). This however fails with an awful long error message and I can't quite track t ...
Example: A wrapper for std::vector. I have 2 move constructors: However, I want to do an optimization to avoid a costly constructor of vector in ca ...
I tried one here. Code as following: But it leads to compiling fail on Visual Studio 2019 x86: How to fix it? ...
To count the memory usage of a static library A, we will write a custom memory allocator or rewrite operator new/delete. Since there are other librar ...
I'm trying out these new pmr thingies, and stuff seems really interesting. So in my example I'm hooking up a monotonic_buffer_resource to a buffer an ...
I'm writing a custom allocator for unordered_map to allocate on the stack. I'm a bit lost on how to do this idiomatically: Should I pass the stack res ...
I'm a noob to memory management so please forgive me. Say I have the following code: Is there a good way to "add space" to this buffer, instead of ...
Does polymorphic allocator (I personally use boost and C++17, but guess that it's the same for stl and C++20) in it's destructor automatically destruc ...
I have a goal of cross-compiling some code written in C++ for an ARM processor. There's no OS running on there and we require bare-metal code. However ...