-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Add emplace[_back]
to pcl::PointCloud
#3207
Add emplace[_back]
to pcl::PointCloud
#3207
Conversation
It looks like the tests seredenpitously passed, which is nice I guess. |
Looks good to me.
Pass
It looked ok to me. Clang format will be integrated soon, so there's no need to worry much about it.
Given that I would say we would return the reference as well. It won't hurt C++14 users and by the time we need to adopt C++17, we don't have to do anything.
I'm failing to see the rationale here. Why would you want to explicitly include it? Edit: I forgot to add. The unit tests feel very incomplete, but I also see that you simply followed what was done before. I'm not sure if we want to address them properly on this PR, just for |
I just tend to explicitly include every header I use in my own projects to avoid relying on transitive includes and witnessing some code break when the headers I'm using are not transitively included anymore (which happened from time to time, and broke differently depending on how the standard libraries transitively include standard headers themselves). |
👍 for including 👍 for returning a reference for the reasons Sergio gave. |
Ok, I'll change it tonight so that it returns a reference. Concerning the unit tests, I just somewhat completed the existing ones, but it's otherwise mostly forwarding parameters to the corresponding |
I would suggest to leave that to another PR. In general these tend to create a lot of changes, which might require discussions of their own, delaying the merging of the new functionality. I rather have the functionality merged first and then we proceed with the appropriate replacements. |
emplace[_back]
to pcl::PointCloud
Here is the pull request to implement #3204. It's my first time contributing to PCL, so I opened this pull request quite soon to ask questions about contribution. First of all, I haven't run the tests because I'm not sure how to run the test suite just yet, I merely know that it uses Google Test, and I suppose that there is an option in the CMakeLists.txt to run the test (consider it untested code pushed for the sake of the pull request). Anyway, here are my more specific questions & remarks:
std::vector::emplace_back
returns a reference to the inserted element, but since the next version of PCL targets C++14, I couldn't really implement that short of querying the emplaced element before returning it. Is it okay or do you want the function to return a reference?#include <utility>
but it seems that the whole file doesn't care much about include standard or Boost headers, so I decided to leave it out.That's pretty much it. My IDE automatically removes the blank characters at the end of lines, I hope that it isn't too much noise.