Merge topic 'realloc-moved-vector'
f598656d5 Enable reallocation of ArrayHandleBasic with moved std::vector Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Li-Ta Lo <ollie@lanl.gov> Merge-request: !2811
This commit is contained in:
commit
ad8657a670
@ -91,10 +91,6 @@ struct BufferState
|
||||
{
|
||||
if (this->Info.GetSize() != newSize)
|
||||
{
|
||||
if (this->Pinned)
|
||||
{
|
||||
throw vtkm::cont::ErrorBadAllocation("Attempted to reallocate a pinned buffer.");
|
||||
}
|
||||
this->Info.Reallocate(newSize);
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ namespace internal
|
||||
|
||||
VTKM_CONT void InvalidRealloc(void*&, void*&, vtkm::BufferSizeType, vtkm::BufferSizeType)
|
||||
{
|
||||
vtkm::cont::ErrorBadAllocation("User provided memory does not have a reallocater.");
|
||||
throw vtkm::cont::ErrorBadAllocation("User provided memory does not have a reallocater.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -274,7 +274,7 @@ VTKM_CONT inline void StdVectorReallocater(void*& memory,
|
||||
using vector_type = std::vector<T, Allocator>;
|
||||
vector_type* vector = reinterpret_cast<vector_type*>(container);
|
||||
VTKM_ASSERT(vector->empty() || (memory == vector->data()));
|
||||
VTKM_ASSERT(oldSize == static_cast<vtkm::BufferSizeType>(vector->size()));
|
||||
VTKM_ASSERT(oldSize == static_cast<vtkm::BufferSizeType>(vector->size() * sizeof(T)));
|
||||
|
||||
vector->resize(static_cast<std::size_t>(newSize));
|
||||
memory = vector->data();
|
||||
|
Loading…
Reference in New Issue
Block a user