define a move constructor for Ref<const...>

This commit is contained in:
wilfried.karel
2023-06-14 20:10:51 +00:00
committed by Rasmus Munk Larsen
parent d8f3eb87bf
commit 6c1411e521
2 changed files with 42 additions and 0 deletions

View File

@@ -363,6 +363,15 @@ template<typename TPlainObjectType, int Options, typename StrideType> class Ref<
// copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy
}
EIGEN_DEVICE_FUNC inline Ref(Ref&& other) {
if (other.data() == other.m_object.data()) {
m_object = std::move(other.m_object);
Base::construct(m_object);
}
else
Base::construct(other);
}
template<typename OtherRef>
EIGEN_DEVICE_FUNC inline Ref(const RefBase<OtherRef>& other) {
EIGEN_STATIC_ASSERT(Traits::template match<OtherRef>::type::value || may_map_m_object_successfully,