Mercurial > octave
changeset 31404:3ea38ae97cc6
Array: Move constructor with custom allocator back to header (bug #61711).
* liboctave/array/Array.h (Array::Array): Move definition of constructor with
custom allocator back to header. This partly reverts fa025af77216.
* liboctave/array/Array-base.cc (Array::Array): Remove definition from here.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 06 Nov 2022 18:20:04 +0100 |
parents | 821cdacfdca7 |
children | cd33d20283f4 |
files | liboctave/array/Array-base.cc liboctave/array/Array.h |
diffstat | 2 files changed, 8 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/array/Array-base.cc Sun Nov 06 11:41:58 2022 -0500 +++ b/liboctave/array/Array-base.cc Sun Nov 06 18:20:04 2022 +0100 @@ -90,19 +90,6 @@ m_dimensions.chop_trailing_singletons (); } -// We need to dllexport this constructor from explicit template -// instantiations with specializations. One way to do this is to mark the -// declaration with the corresponding attributes and define the -// constructor separately here. -template <typename T, typename Alloc> -Array<T, Alloc>::Array (T *ptr, const dim_vector& dv, const Alloc& xallocator) - : m_dimensions (dv), - m_rep (new typename Array<T, Alloc>::ArrayRep (ptr, dv, xallocator)), - m_slice_data (m_rep->m_data), m_slice_len (m_rep->m_len) -{ - m_dimensions.chop_trailing_singletons (); -} - template <typename T, typename Alloc> void Array<T, Alloc>::fill (const T& val)
--- a/liboctave/array/Array.h Sun Nov 06 11:41:58 2022 -0500 +++ b/liboctave/array/Array.h Sun Nov 06 18:20:04 2022 +0100 @@ -304,9 +304,15 @@ // object is deleted. The dimension vector DV must be consistent with // the size of the allocated PTR array. - OCTARRAY_API + OCTARRAY_OVERRIDABLE_FUNC_API explicit Array (T *ptr, const dim_vector& dv, - const Alloc& xallocator = Alloc ()); + const Alloc& xallocator = Alloc ()) + : m_dimensions (dv), + m_rep (new typename Array<T, Alloc>::ArrayRep (ptr, dv, xallocator)), + m_slice_data (m_rep->m_data), m_slice_len (m_rep->m_len) + { + m_dimensions.chop_trailing_singletons (); + } //! Reshape constructor. OCTARRAY_API Array (const Array<T, Alloc>& a, const dim_vector& dv);