struct construct with array

Caligo iteronvexor at gmail.com
Sat Mar 12 10:42:40 PST 2011


struct Test{

  public double[3] ar_;
  this(double[3] ar){
    this.ar_ = ar;
  }
}

void main(){

  double[3] v1 = [1.0, 2.0, 3.0];
  double[3] v2 = [2.0, 3.0, 4.0];

  auto t1 = Test(v1[0..$] + v2[0..$]);     // error

}


I want to add those two arrays and call the constructor in one line, but I'm
getting an error.  Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20110312/26592104/attachment.html>


More information about the Digitalmars-d-learn mailing list