From 12d59465cb78ba058192ec4ce3039aa097bf2696 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Tue, 30 Sep 2014 14:57:54 +0200 Subject: bug #884: Copy constructor of Ref shall never malloc, constructing from other RefBase shall only malloc if the memory layout is incompatible. --- Eigen/src/Core/Ref.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Eigen/src/Core/Ref.h') diff --git a/Eigen/src/Core/Ref.h b/Eigen/src/Core/Ref.h index 09921c9e7..2653f2bbe 100644 --- a/Eigen/src/Core/Ref.h +++ b/Eigen/src/Core/Ref.h @@ -232,6 +232,15 @@ template class Ref< construct(expr.derived(), typename Traits::template match::type()); } + inline Ref(const Ref& other) : Base(other) { + // copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy + } + + template + inline Ref(const RefBase& other) { + construct(other.derived(), typename Traits::template match::type()); + } + protected: template -- cgit v1.2.3