Mercurial > octave
changeset 31854:8c37bbe334d4
new macros for disabling and defining default ctors, dtors, and assign ops
* oct-conf-post-public.in.h (OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE,
OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE_DELETE, OCTAVE_DEFAULT_COPY,
OCTAVE_DEFAULT_MOVE, OCTAVE_DEFAULT_COPY_MOVE,
OCTAVE_DEFAULT_CONSTRUCT_COPY, OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE,
OCTAVE_DEFAULT_COPY_DELETE, OCTAVE_DEFAULT_COPY_MOVE_DELETE,
OCTAVE_DEFAULT_CONSTRUCT_COPY_DELETE,
OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE_DELETE): New macros for
consistently disabling or defining various combinations of ctors,
dtors, and assignment ops that all classes should declare.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 17 Feb 2023 23:18:24 -0500 |
parents | 5c046a512888 |
children | 1daf8bfceac3 |
files | oct-conf-post-public.in.h |
diffstat | 1 files changed, 49 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/oct-conf-post-public.in.h Fri Feb 17 23:14:43 2023 -0500 +++ b/oct-conf-post-public.in.h Fri Feb 17 23:18:24 2023 -0500 @@ -334,6 +334,55 @@ # define OCTAVE_DISABLE_COPY_MOVE(X) \ OCTAVE_DISABLE_COPY (X) \ OCTAVE_DISABLE_MOVE (X) + +# define OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE(X) \ + X () = delete; \ + OCTAVE_DISABLE_COPY (X) \ + OCTAVE_DISABLE_MOVE (X) + +# define OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE_DELETE(X) \ + X () = delete; \ + OCTAVE_DISABLE_COPY (X) \ + OCTAVE_DISABLE_MOVE (X) \ + ~X () = delete; + +# define OCTAVE_DEFAULT_COPY(X) \ + X (const X&) = default; \ + X& operator = (const X&) = default; + +# define OCTAVE_DEFAULT_MOVE(X) \ + X (X&&) = default; \ + X& operator = (X&&) = default; + +# define OCTAVE_DEFAULT_COPY_MOVE(X) \ + OCTAVE_DEFAULT_COPY (X) \ + OCTAVE_DEFAULT_MOVE (X) + +# define OCTAVE_DEFAULT_CONSTRUCT_COPY(X) \ + X () = default; \ + OCTAVE_DEFAULT_COPY (X) + +# define OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE(X) \ + X () = default; \ + OCTAVE_DEFAULT_COPY_MOVE (X) + +# define OCTAVE_DEFAULT_COPY_DELETE(X) \ + OCTAVE_DEFAULT_COPY (X) \ + ~X () = default; + +# define OCTAVE_DEFAULT_COPY_MOVE_DELETE(X) \ + OCTAVE_DEFAULT_COPY_MOVE (X) \ + ~X () = default; + +# define OCTAVE_DEFAULT_CONSTRUCT_COPY_DELETE(X) \ + X () = default; \ + OCTAVE_DEFAULT_COPY (X) \ + ~X () = default; + +# define OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE_DELETE(X) \ + X () = default; \ + OCTAVE_DEFAULT_COPY_MOVE (X) \ + ~X () = default; #endif typedef OCTAVE_IDX_TYPE octave_idx_type;