pcl_ros: Use vec.data() instead of &vec[0] (#348)
Update pcl_ros to use the data() member function of STL containers to get the pointer to the underlying storage, instead of dereferencing the zeroth element and taking its reference. When a container is of size 0, dereferencing element 0 with operator[]() is undefined behavior, and will trigger assertions when features like _GLIBCXX_ASSERTIONS are enabled. Fixes #333.
This commit is contained in:
@@ -166,7 +166,7 @@ transformPointCloud(
|
||||
out.is_dense = in.is_dense;
|
||||
out.data.resize(in.data.size());
|
||||
// Copy everything as it's faster than copying individual elements
|
||||
memcpy(&out.data[0], &in.data[0], in.data.size());
|
||||
memcpy(out.data.data(), in.data.data(), in.data.size());
|
||||
}
|
||||
|
||||
Eigen::Array4i xyz_offset(in.fields[x_idx].offset, in.fields[y_idx].offset,
|
||||
|
||||
Reference in New Issue
Block a user