variadic templates and out/inout

Tyro nospam at home.com
Mon Dec 18 22:01:52 PST 2006


The following compiles without any errors or warning. However it
fails if line 12 is uncommented (error messages provided below). Is
there a compelling reason why this should not work? If not, what
are the possibilities of getting this implemented?

void get(A...)(inout A a)
{
  foreach(inout t; a)
  {
    if(typeid(typeof(t)) is typeid(double))
      t = 0.0;
  }
}

void main()
{
  double d;
  //get(d); // fails
}


/+
Error messages:

io.d(3): no storage class for t
io.d(12): template instance io.get!(double) error instantiating
+/

------------
Andrew Edwards



More information about the Digitalmars-d mailing list