polygon.cpp

The following code example is taken from the book
C++ Move Semantics - The Complete Guide by Nicolai M. Josuttis, Leanpub, 2020
The code is licensed under a Creative Commons Attribution 4.0 International License. Creative Commons License


#include "geoobj.hpp"
#include "polygon.hpp"

int main()
{
  Polygon p0{"Poly1", {Coord{1,1}, Coord{1,9}, Coord{9,9}, Coord{9,1}}};
  Polygon p1{p0};             // copy
  Polygon p2{std::move(p0)};  // move

  p0.draw();
  p1.draw();
  p2.draw();
}