jhasse / poly2tri

2D constrained Delaunay triangulation library
BSD 3-Clause "New" or "Revised" License
439 stars 89 forks source link

make_unique #38

Closed EmmanuelMess closed 2 years ago

EmmanuelMess commented 2 years ago

Shouldn't this be make_unique?

https://github.com/jhasse/poly2tri/blob/8b5fa15800ab8ef44ed7b0ec7061e907d5e49059/unittest/main.cpp#L19

jhasse commented 2 years ago

p2t::CDT's ctor requires std::vector<p2t::Point*>, therefore we can't using std::unique_ptr there.

EmmanuelMess commented 2 years ago

p2t::CDT's ctor requires std::vector<p2t::Point*>, therefore we can't using std::unique_ptr there.

Why does it require pointers?

jhasse commented 2 years ago

It doesn't really "require" them , but it was written that way at a time where C++11 wasn't a thing. We could overload it with a variant which accepts a unique_ptr vector, but just changing the unit test won't work.

EmmanuelMess commented 2 years ago

We could overload it with a variant which accepts a unique_ptr vector,

That seems like a good idea.