Mercurial > jwe > octave
changeset 30438:c6cd2f582254 stable
Provide header file for forward declaration of Sparse<T> template (bug #59820).
* liboctave/array/Sparse-fwd.h: New file.
* liboctave/array/module.mk: Add new file to build system.
* liboctave/array/idx-vector.h, liboctave/array/Sparse.h: Include Sparse-fwd.h
instead of repeating Sparse<T> template forward declaration in each file.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 05 Dec 2021 10:52:55 +0100 |
parents | db045364dca9 |
children | b6fdc8574e7d 1f0a2689cab2 |
files | liboctave/array/Sparse-fwd.h liboctave/array/Sparse.h liboctave/array/idx-vector.h liboctave/array/module.mk |
diffstat | 4 files changed, 37 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/array/Sparse-fwd.h Sun Dec 05 10:52:55 2021 +0100 @@ -0,0 +1,33 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or <https://octave.org/copyright/>. +// +// This file is part of Octave. +// +// Octave is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Octave is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Octave; see the file COPYING. If not, see +// <https://www.gnu.org/licenses/>. +// +//////////////////////////////////////////////////////////////////////// + +#if ! defined (octave_Sparse_fwd_h) +#define octave_Sparse_fwd_h 1 + +#include "octave-config.h" + +template <typename T> class OCTAVE_API Sparse; + +#endif
--- a/liboctave/array/Sparse.h Sat Dec 04 21:30:32 2021 +0100 +++ b/liboctave/array/Sparse.h Sun Dec 05 10:52:55 2021 +0100 @@ -36,17 +36,16 @@ #include <string> #include "Array-fwd.h" +#include "Sparse-fwd.h" class PermMatrix; // Two dimensional sparse class. Handles the reference counting for // all the derived classes. -// forward declare template with visibility attribute -template <typename T> class OCTAVE_API Sparse; - template <typename T> class +OCTAVE_API Sparse { public:
--- a/liboctave/array/idx-vector.h Sat Dec 04 21:30:32 2021 +0100 +++ b/liboctave/array/idx-vector.h Sun Dec 05 10:52:55 2021 +0100 @@ -39,8 +39,7 @@ #include "dim-vector.h" #include "oct-inttypes-fwd.h" #include "oct-refcount.h" - -template <typename T> class Sparse; +#include "Sparse-fwd.h" namespace octave {
--- a/liboctave/array/module.mk Sat Dec 04 21:30:32 2021 +0100 +++ b/liboctave/array/module.mk Sun Dec 05 10:52:55 2021 +0100 @@ -44,6 +44,7 @@ %reldir%/MSparse.h \ %reldir%/PermMatrix.h \ %reldir%/Range.h \ + %reldir%/Sparse-fwd.h \ %reldir%/Sparse.h \ %reldir%/uint16NDArray.h \ %reldir%/uint32NDArray.h \