TheSwamp

Code Red => ARX Programming => Topic started by: It's Alive! on December 25, 2009, 01:35:33 AM

Title: A little TR1
Post by: It's Alive! on December 25, 2009, 01:35:33 AM
not a very good example, but it's using the some of the new C++0x goodies in VS2008
std::tr1::tuple and array

Code: [Select]
  typedef std::tr1::tuple<AcGePoint3d,AcGePoint3d,AcGePoint3d,AcGePoint3d> MyRectangle;

 static void ArxTr1_doit(void)
 {
  std::tr1::array<MyRectangle, 100> rectangles;

  for(size_t i = 0; i < rectangles.size() ; i++)
  {
   rectangles[i] = MyRectangle(AcGePoint3d(0.0-i,0.0-i,0.0),
                               AcGePoint3d(1.0+i,0.0-i,0.0),
                               AcGePoint3d(1.0+i,1.0+i,0.0),
                               AcGePoint3d(0.0-i,1.0+i,0.0));
  }

  for(size_t i = 0; i < rectangles.size() ; i++)
  {
   acedGrDraw(asDblArray(get<0>(rectangles[i])), asDblArray(get<1>(rectangles[i])),1,0);
   acedGrDraw(asDblArray(get<1>(rectangles[i])), asDblArray(get<2>(rectangles[i])),1,0);
   acedGrDraw(asDblArray(get<2>(rectangles[i])), asDblArray(get<3>(rectangles[i])),1,0);
   acedGrDraw(asDblArray(get<3>(rectangles[i])), asDblArray(get<0>(rectangles[i])),1,0);
  }
 }
Title: Re: A little TR1
Post by: frtfff on December 27, 2009, 10:38:11 AM
 :?