Hello,

In the code below, why the first Stdout throws a Exception when the second doesn't ?

/*  -------- CODE --------   */
import tango.io.Stdout;


struct VoidPtr(T)
{
  void* vPtr;

  void value(T val)
  {
    vPtr = &val;
  }

  T value()
  {
    return *(cast(T*)vPtr);
  }
}


void main()
{
  VoidPtr!(char[][]) vPtr ;

  char[][]  arr = [ "hello" , "you" ];

  vPtr.value =  arr ;

Stdout( vPtr.value ).newline; // <-- [tango.core.Exception.OutOfMemoryException: Memory allocation failed

  Stdout( *(cast(char[][]*) vPtr.vPtr ) ); // <-- This works good
}

/*  ------ END CODE ------  */


Thanks in advance for your help,
TSalm

Reply via email to