Skip to content

Commit

Permalink
Add compatible function from Clipper1Lib: operator<< (#941)
Browse files Browse the repository at this point in the history
Path<T>& operator<<(Path<T>& poly, const Point<T2>& p)
Paths<T>& operator<<(Paths<T>& polys, const Path<T>& p)
  • Loading branch information
nonwill authored Jan 30, 2025
1 parent 6901921 commit 065f398
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CPP/Clipper2Lib/include/clipper2/clipper.core.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,20 @@ namespace Clipper2Lib
template <typename T>
using Paths = std::vector<Path<T>>;

template <typename T, typename T2=T>
Path<T>& operator<<(Path<T>& poly, const Point<T2>& p)
{
poly.emplace_back(p);
return poly;
}

template <typename T>
Paths<T>& operator<<(Paths<T>& polys, const Path<T>& p)
{
polys.emplace_back(p);
return polys;
}

using Path64 = Path<int64_t>;
using PathD = Path<double>;
using Paths64 = std::vector< Path64>;
Expand Down

0 comments on commit 065f398

Please sign in to comment.