Get the latest tech news

What's so hard about constexpr allocation?


Setting the Stage

Today, this is ill-formed, because the allocation persists past the constant evaluation that is the initialization of the global variable p. But we want to change that. I think they can be divided into two categories: attempt to come up with as coherent and safe a solution as possible within the confines of the C++ type system, or trust the programmer. It’ll probably pass most tests that you write, since int* is usable as a constant iterator just fine as long as you don’t try to mutate through it.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of constexpr allocation

constexpr allocation