CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.98k stars 1.39k forks source link

Use rvalue ref for arguments that are destroyed #4403

Open mglisse opened 4 years ago

mglisse commented 4 years ago

/! Builds an alpha shape of mode m from the triangulation dt. \attention This operation destroys the triangulation dt. / Alpha_shape_3(Dt& dt, FT alpha = 0, Mode m = REGULARIZED);

Since C++11, it would seem more natural to make the first argument Dt&& dt. Of course, that would break some code, although it is easy enough to add std::move. The most inconvenient part is for users that must support multiple versions of CGAL, because I don't know how to write code that works with both, without a macro to actually have different code for both.

lrineau commented 4 years ago

Could we add an overload?

Alpha_shape_3(Dt& dt, FT alpha = 0, Mode m = REGULARIZED);
Alpha_shape_3(Dt&& dt, FT alpha = 0, Mode m = REGULARIZED);
mglisse commented 4 years ago

Makes sense (and possibly deprecate the old one at some point).