Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding emplace methods to pcl::PointCloud #3204

Closed
Morwenn opened this issue Jul 2, 2019 · 2 comments
Closed

Adding emplace methods to pcl::PointCloud #3204

Morwenn opened this issue Jul 2, 2019 · 2 comments
Labels
kind: proposal Type of issue

Comments

@Morwenn
Copy link
Contributor

Morwenn commented Jul 2, 2019

Since PCL seems to be moving toward C++14 it could be a good opportunity to add the methods emplace and emplace_back to pcl::PointCloud to take advantage of the C++11 additions to std::vector.

Your Environment

  • PCL Version: 1.9.1

Context

I had to interface PCL with another type of 3D points, and writing the following to convert between both would have been nice to ensure that everything in written in-place:

pcl::PointCloud<pcl::PointXYZ> out;
out.reserve(legacy_point_collection.size());
for (auto&& point : legacy_point_collection) {
    out.emplace_back(point.getX(), point.getY(), point.getZ());
}

Currently the solution is to use push_back, which is fine, but exposing the emplace family of functions would allow for terser code with an in-place construction guarantee even in debug mode.

@taketwo taketwo added the kind: proposal Type of issue label Jul 4, 2019
@taketwo
Copy link
Member

taketwo commented Jul 4, 2019

That should be a fairly trivial patch. Contributions welcome!

@Morwenn
Copy link
Contributor Author

Morwenn commented Jul 4, 2019

Sure, I will try to implement that properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: proposal Type of issue
Projects
None yet
Development

No branches or pull requests

2 participants