Commit 1f86878f authored by Robert Maynard's avatar Robert Maynard

Make the ArrayHandle move constructors noexcept.

std::containers only activate fast emplace operations if the
T types move operators are noexcept
parent 8475db6f
......@@ -294,7 +294,7 @@ public:
/// with CUDA), then the automatically generated move constructor could be
/// created for all devices, and it would not be valid for all devices.
///
ArrayHandle(vtkm::cont::ArrayHandle<ValueType, StorageTag>&& src);
ArrayHandle(vtkm::cont::ArrayHandle<ValueType, StorageTag>&& src) noexcept;
/// Special constructor for subclass specializations that need to set the
/// initial state of the control array. When this constructor is used, it
......@@ -307,7 +307,7 @@ public:
/// initial state of the control array. When this constructor is used, it
/// is assumed that the control array is valid.
///
ArrayHandle(StorageType&& storage);
ArrayHandle(StorageType&& storage) noexcept;
/// Destructs an empty ArrayHandle.
///
......@@ -328,7 +328,7 @@ public:
///
VTKM_CONT
vtkm::cont::ArrayHandle<ValueType, StorageTag>& operator=(
vtkm::cont::ArrayHandle<ValueType, StorageTag>&& src);
vtkm::cont::ArrayHandle<ValueType, StorageTag>&& src) noexcept;
/// Like a pointer, two \c ArrayHandles are considered equal if they point
/// to the same location in memory.
......
......@@ -38,7 +38,7 @@ ArrayHandle<T, S>::ArrayHandle(const ArrayHandle<T, S>& src)
}
template <typename T, typename S>
ArrayHandle<T, S>::ArrayHandle(ArrayHandle<T, S>&& src)
ArrayHandle<T, S>::ArrayHandle(ArrayHandle<T, S>&& src) noexcept
: Internals(std::move(src.Internals))
{
}
......@@ -53,7 +53,7 @@ ArrayHandle<T, S>::ArrayHandle(const typename ArrayHandle<T, S>::StorageType& st
}
template <typename T, typename S>
ArrayHandle<T, S>::ArrayHandle(typename ArrayHandle<T, S>::StorageType&& storage)
ArrayHandle<T, S>::ArrayHandle(typename ArrayHandle<T, S>::StorageType&& storage) noexcept
: Internals(new InternalStruct)
{
this->Internals->ControlArray = std::move(storage);
......@@ -74,7 +74,7 @@ ArrayHandle<T, S>& ArrayHandle<T, S>::operator=(const ArrayHandle<T, S>& src)
}
template <typename T, typename S>
ArrayHandle<T, S>& ArrayHandle<T, S>::operator=(ArrayHandle<T, S>&& src)
ArrayHandle<T, S>& ArrayHandle<T, S>::operator=(ArrayHandle<T, S>&& src) noexcept
{
this->Internals = std::move(src.Internals);
return *this;
......
......@@ -239,15 +239,15 @@ public:
VTKM_CONT ArrayHandle();
VTKM_CONT ArrayHandle(const Thisclass& src);
VTKM_CONT ArrayHandle(Thisclass&& src);
VTKM_CONT ArrayHandle(Thisclass&& src) noexcept;
VTKM_CONT ArrayHandle(const StorageType& storage);
VTKM_CONT ArrayHandle(StorageType&& storage);
VTKM_CONT ArrayHandle(const StorageType& storage) noexcept;
VTKM_CONT ArrayHandle(StorageType&& storage) noexcept;
VTKM_CONT ~ArrayHandle();
VTKM_CONT Thisclass& operator=(const Thisclass& src);
VTKM_CONT Thisclass& operator=(Thisclass&& src);
VTKM_CONT Thisclass& operator=(Thisclass&& src) noexcept;
VTKM_CONT bool operator==(const Thisclass& rhs) const;
VTKM_CONT bool operator!=(const Thisclass& rhs) const;
......
......@@ -40,19 +40,19 @@ ArrayHandle<T, StorageTagBasic>::ArrayHandle(const Thisclass& src)
}
template <typename T>
ArrayHandle<T, StorageTagBasic>::ArrayHandle(Thisclass&& src)
ArrayHandle<T, StorageTagBasic>::ArrayHandle(Thisclass&& src) noexcept
: Internals(std::move(src.Internals))
{
}
template <typename T>
ArrayHandle<T, StorageTagBasic>::ArrayHandle(const StorageType& storage)
ArrayHandle<T, StorageTagBasic>::ArrayHandle(const StorageType& storage) noexcept
: Internals(new internal::ArrayHandleImpl(storage))
{
}
template <typename T>
ArrayHandle<T, StorageTagBasic>::ArrayHandle(StorageType&& storage)
ArrayHandle<T, StorageTagBasic>::ArrayHandle(StorageType&& storage) noexcept
: Internals(new internal::ArrayHandleImpl(std::move(storage)))
{
}
......@@ -70,7 +70,8 @@ ArrayHandle<T, StorageTagBasic>& ArrayHandle<T, StorageTagBasic>::operator=(cons
}
template <typename T>
ArrayHandle<T, StorageTagBasic>& ArrayHandle<T, StorageTagBasic>::operator=(Thisclass&& src)
ArrayHandle<T, StorageTagBasic>& ArrayHandle<T, StorageTagBasic>::operator=(
Thisclass&& src) noexcept
{
this->Internals = std::move(src.Internals);
return *this;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment