basically what I'm trying to do is allocate a parametrized type from a generic function:
public < T > T wishful_thinking( )
{
return new T( );
}
Casting doesn't work either, due to "object slicing" (that is, it compiles, but "segfaults"):
public < T > T wishful_thinking( )
{
return ( T )new Object( );
}
So...is there any workaround for this (perhaps using reflection or some such)?
Thanks!