How to allocate an element of type T with value x in generic code?

Tobias Pankrath tobias at pankrath.net
Wed Apr 3 04:05:05 PDT 2013


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?


More information about the Digitalmars-d-learn mailing list