Advertisement
Alex239

Untitled

Apr 22nd, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1.  
  2. struct Vertex
  3. {
  4.     int x, y, id, comp;
  5.     Vertex(int x, int y, int id)
  6.         :x(x), y(y), id(id)
  7.     {}
  8. };
  9.  
  10. struct Line
  11. {
  12.     vector<Vertex> *arr;
  13.     bool swapped = false;
  14.  
  15.     Vertex first()
  16.     {
  17.         Vertex v = (swapped ? (*arr)[arr->size() - 1] : (*arr)[0]);
  18.         cout << "first" << v.x << ' ' << v.y << endl;
  19.         return v;
  20.     }
  21.  
  22.     Vertex last()
  23.     {
  24.         Vertex v = swapped ? (*arr)[0] : (*arr)[arr->size() - 1];
  25.         cout << "last" << v.x << ' ' << v.y << endl;
  26.         return v;
  27.     }
  28.  
  29.     Line(vector<Vertex> *narr, bool x)
  30.     {
  31.         if (narr->size() < 2)
  32.         {
  33.             cout << "noooo!";
  34.             while (1);
  35.         }
  36.         arr = narr;
  37.     }
  38. };
  39. int main()
  40. {
  41.  //just piece
  42.         vector<vector<Vertex>> stupid;
  43.         //fill stupid
  44.     vector<Line> smart;
  45.     for (vector<Vertex> vv : stupid)
  46.     {
  47.         //cout << vv.size() << endl;
  48.         if (vv.size() >= 2)
  49.         {
  50.             //cout << tostr(vv);
  51.             Line l(&vv, true);
  52.             cout << l.arr->size() << endl;
  53.             smart.push_back(l);
  54.             cout << smart[smart.size() - 1].arr->size();
  55.         }
  56.     }
  57.     for (int i = 0; i < smart.size(); ++i)
  58.         cout << smart[i].arr->size() << endl;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement