Closed rasmusbonnedal closed 7 months ago
Thanks for the stackoverflow link, they make the point that we may not need the default copy/move constructor or assignment operator and explictly deleting them may resolve the need for those private methods to be accessed.
I'll see if I can mock a reproducer in godbolt to confirm.
Reproducer with example of fix (delete default copy constructors and assignment operators): https://www.godbolt.org/z/1GT478hE8
So to fix this just add the following to pointcould.h
PointCloud(const PointCloud&) = delete;
PointCloud(const PointCloud&&) = delete;
PointCloud & operator=(const PointCloud&) = delete;
PointCloud & operator=(const PointCloud&&) = delete;
Oh, that's a nice solution!
BTW, I think SortedPointRecord
on pointcloud.h:58 should be std::pair<float, Partio::ParticleIndex>
which gets rid of a warning.
I'll submit a PR for this.
BTW, I think
SortedPointRecord
on pointcloud.h:58 should bestd::pair<float, Partio::ParticleIndex>
which gets rid of a warning.
I believe it might have been intentionally an int vs. the Partio::ParticleIndex which is size_t to improve sorting performance. So choose to fix with adding proper static cast when constucting the SortedPointRecord.
Of course if the particle index > MAX_INT that would be a problem. Do we expect point clouds > 2 billion entries? If so... then maybe should be Partio::ParticleIndex. @lgritz , thoughts?
I think it should probably be ParticleIndex. I wonder if years ago, ParticleIndex was int and later changed to size_t?
Problem
When OSL builds with Partio it gives an error on MSVC: https://gist.github.com/rasmusbonnedal/62c64d076a764b2f7c2ac07189501e49
This issue came when
Pointcloud
was marked OSLEXECPUBLIC because then MSVC needs all symbols of all members resolved. This makes it impossible to useunique_ptr
in an STL container because the container has operations that access deleted members of theunique_ptr
. (https://stackoverflow.com/questions/51033325/dll-exporting-causing-issues-with-unique-pointers).PointCloud
has a memberm_attributes
of typestd::unordered_map<ustringhash, std::unique_ptr<Partio::ParticleAttribute>>
which causes the problem.Could the unique_ptr be replaced with a shared_ptr?
Steps to Reproduce
Versions