Author Topic: A little TR1  (Read 1583 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6963
  • AKA Daniel
A little TR1
« 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);
  }
 }

frtfff

  • Bull Frog
  • Posts: 215
Re: A little TR1
« Reply #1 on: December 27, 2009, 10:38:11 AM »
 :?