search for: new_meta

Displaying 1 result from an estimated 1 matches for "new_meta".

Did you mean: new_mem
2017 Jun 21
6
RFC: Cleaning up the Itanium demangler
...t;; +template <class T> using Vector = std::vector<T, Alloc<T>>; + +struct bptr +{ + static constexpr size_t alloc_size = 2048; + + struct meta + { + meta* next; + unsigned current; + }; + + meta* buf = nullptr; + + void grow() + { + char* new_meta = new char[alloc_size]; + buf = new (new_meta) meta{buf, 0}; + } + +public: + bptr() { grow(); } + + void* allocate(size_t n) { + assert(n % sizeof(void *) == 0); + if (n + buf->current > (alloc_size - sizeof(meta))) + grow(); + buf->current...