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:
Kenneth Moreland 2022-07-11 15:28:48 +00:00 committed by Kitware Robot
commit ad8657a670
3 changed files with 2 additions and 6 deletions

@ -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();