On Wed, 03 Apr 2013 07:05:05 -0400, Tobias Pankrath <tob...@pankrath.net> wrote:

basic idea.
---
T x;
T* px = new T(x);
---
int x
int* px = new int(x); // fails
---

I need to do this for structs and basic types. What's the standard way to do this?

A crude but easy way to do this:

int *px = [x].ptr;

Only caveat is that the allocated block may be slightly bigger than necessary. If you are concerned about footprint, you may want to do it with GC.malloc calls directly.

-Steve

Reply via email to