diff options
author | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2014-09-30 14:57:54 +0200 |
---|---|---|
committer | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2014-09-30 14:57:54 +0200 |
commit | 12d59465cb78ba058192ec4ce3039aa097bf2696 (patch) | |
tree | 42fceca92913238e736e3dfca8e88e92666ad81d /Eigen/src/Core/Ref.h | |
parent | e404841235cf9d995f59e9b629ebf111f9271e0b (diff) |
bug #884: Copy constructor of Ref shall never malloc, constructing from other RefBase shall only malloc if the memory layout is incompatible.
Diffstat (limited to 'Eigen/src/Core/Ref.h')
-rw-r--r-- | Eigen/src/Core/Ref.h | 9 |
1 files changed, 9 insertions, 0 deletions
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<typename TPlainObjectType, int Options, typename StrideType> class Ref< construct(expr.derived(), typename Traits::template match<Derived>::type()); } + inline Ref(const Ref& other) : Base(other) { + // copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy + } + + template<typename OtherRef> + inline Ref(const RefBase<OtherRef>& other) { + construct(other.derived(), typename Traits::template match<OtherRef>::type()); + } + protected: template<typename Expression> |