Mercurial > octave
changeset 30429:e38202d3628d stable
provide header file for forward declaration of Array<T> template
* Array-fwd.h: New file.
* liboctave/array/module.mk: Update.
* oct-stream.h, pr-output.h, Array.h, Range.h, Sparse.h, dim-vector.h,
idx-vector.h, oct-spparms.h, qr.h, oct-base64.h, url-transfer.h:
Include Array-fwd.h instead of repeating Array<T> template declaration
in each file.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 04 Dec 2021 08:40:07 -0500 |
parents | 2ac26917bdec |
children | e5ff1b174ddf 60a4fcf2d51b |
files | libinterp/corefcn/oct-stream.h libinterp/corefcn/pr-output.h liboctave/array/Array-fwd.h liboctave/array/Array.h liboctave/array/Range.h liboctave/array/Sparse.h liboctave/array/dim-vector.h liboctave/array/idx-vector.h liboctave/array/module.mk liboctave/numeric/oct-spparms.h liboctave/numeric/qr.h liboctave/util/oct-base64.h liboctave/util/url-transfer.h |
diffstat | 13 files changed, 47 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.h Sat Dec 04 08:34:05 2021 -0500 +++ b/libinterp/corefcn/oct-stream.h Sat Dec 04 08:40:07 2021 -0500 @@ -37,12 +37,12 @@ // These only appear as reference arguments or return values. -template <typename T> class Array; class Cell; class octave_value; class octave_value_list; class string_vector; +#include "Array-fwd.h" #include "data-conv.h" #include "mach-info.h"
--- a/libinterp/corefcn/pr-output.h Sat Dec 04 08:34:05 2021 -0500 +++ b/libinterp/corefcn/pr-output.h Sat Dec 04 08:40:07 2021 -0500 @@ -30,12 +30,12 @@ #include <iosfwd> +#include "Array-fwd.h" #include "oct-cmplx.h" #include "oct-inttypes-fwd.h" #include "pr-flt-fmt.h" -template <typename T> class Array; class ComplexMatrix; class FloatComplexMatrix; class ComplexDiagMatrix;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/array/Array-fwd.h Sat Dec 04 08:40:07 2021 -0500 @@ -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_Array_fwd_h) +#define octave_Array_fwd_h 1 + +#include "octave-config.h" + +template <typename T> class OCTARRAY_API Array; + +#endif
--- a/liboctave/array/Array.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/array/Array.h Sat Dec 04 08:40:07 2021 -0500 @@ -35,6 +35,7 @@ #include <iosfwd> #include <string> +#include "Array-fwd.h" #include "dim-vector.h" #include "idx-vector.h" #include "lo-error.h" @@ -122,9 +123,6 @@ //! - string_vector: Array<std::string> with 1 column //! - Cell: Array<octave_value>, equivalent to an Octave cell. -// forward declare template with visibility attribute -template <typename T> class OCTARRAY_API Array; - template <typename T> class Array
--- a/liboctave/array/Range.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/array/Range.h Sat Dec 04 08:40:07 2021 -0500 @@ -30,13 +30,12 @@ #include <iosfwd> +#include "Array-fwd.h" #include "dMatrix.h" #include "dim-vector.h" #include "lo-error.h" #include "oct-sort.h" -template <typename T> class Array; - namespace octave { template <typename T>
--- a/liboctave/array/Sparse.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/array/Sparse.h Sat Dec 04 08:40:07 2021 -0500 @@ -35,8 +35,9 @@ #include <iosfwd> #include <string> +#include "Array-fwd.h" + class PermMatrix; -template <typename T> class Array; // Two dimensional sparse class. Handles the reference counting for // all the derived classes.
--- a/liboctave/array/dim-vector.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/array/dim-vector.h Sat Dec 04 08:40:07 2021 -0500 @@ -36,11 +36,10 @@ #include <initializer_list> #include <string> +#include "Array-fwd.h" #include "oct-atomic.h" #include "oct-refcount.h" -template <typename T> class Array; - //! Vector representing the dimensions (size) of an Array. //! //! A dim_vector is used to represent dimensions of an Array. It is used
--- a/liboctave/array/idx-vector.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/array/idx-vector.h Sat Dec 04 08:40:07 2021 -0500 @@ -35,11 +35,11 @@ #include <iosfwd> #include <memory> +#include "Array-fwd.h" #include "dim-vector.h" #include "oct-inttypes-fwd.h" #include "oct-refcount.h" -template <typename T> class Array; template <typename T> class Sparse; namespace octave
--- a/liboctave/array/module.mk Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/array/module.mk Sat Dec 04 08:40:07 2021 -0500 @@ -1,6 +1,7 @@ ARRAY_INC = \ + %reldir%/Array-fwd.h \ + %reldir%/Array-util.h \ %reldir%/Array.h \ - %reldir%/Array-util.h \ %reldir%/boolMatrix.h \ %reldir%/boolNDArray.h \ %reldir%/boolSparse.h \
--- a/liboctave/numeric/oct-spparms.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/numeric/oct-spparms.h Sat Dec 04 08:40:07 2021 -0500 @@ -31,11 +31,10 @@ #include <iosfwd> #include <string> +#include "Array-fwd.h" #include "str-vec.h" #include "dColVector.h" -template <typename T> class Array; - #define OCTAVE_SPARSE_CONTROLS_SIZE 13 namespace octave
--- a/liboctave/numeric/qr.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/numeric/qr.h Sat Dec 04 08:40:07 2021 -0500 @@ -28,7 +28,7 @@ #include "octave-config.h" -template <typename T> class Array; +#include "Array-fwd.h" namespace octave {
--- a/liboctave/util/oct-base64.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/util/oct-base64.h Sat Dec 04 08:40:07 2021 -0500 @@ -30,10 +30,9 @@ #include <string> +#include "Array-fwd.h" #include "intNDArray.h" -template <typename T> class Array; - namespace octave { extern OCTAVE_API bool
--- a/liboctave/util/url-transfer.h Sat Dec 04 08:34:05 2021 -0500 +++ b/liboctave/util/url-transfer.h Sat Dec 04 08:40:07 2021 -0500 @@ -33,10 +33,9 @@ #include <ostream> #include <string> +#include "Array-fwd.h" #include "str-vec.h" -template <typename T> class Array; - namespace octave { struct weboptions