diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-03-31 11:06:33 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-04-04 12:47:28 +0300 |
commit | 992d51bbcfef73bc577e3161739b1b16540dad00 (patch) | |
tree | c5f7d414b0a18c3914eeb12ea074ac5ae908c690 /source/blender/makesdna/DNA_defs.h | |
parent | e5688f67aa85b4e9500aa746a5dd0e1fde2493b4 (diff) |
Cleanup: Simplify zero-initializing DNA structures in C++
Avoids duplication of type which previously was specified twice in a line.
Diffstat (limited to 'source/blender/makesdna/DNA_defs.h')
-rw-r--r-- | source/blender/makesdna/DNA_defs.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/makesdna/DNA_defs.h b/source/blender/makesdna/DNA_defs.h index bbce4839506..37ccca54f0e 100644 --- a/source/blender/makesdna/DNA_defs.h +++ b/source/blender/makesdna/DNA_defs.h @@ -86,7 +86,7 @@ template<class T> class ShallowDataConstRef { const T &ref_; }; -template<class T> class ShallowZeroInitializeTag { +class ShallowZeroInitializeTag { }; } // namespace blender::dna::internal @@ -113,13 +113,11 @@ template<class T> class ShallowZeroInitializeTag { return *this; \ } \ /* Create object which memory is filled with zeros. */ \ - class_name(const blender::dna::internal::ShallowZeroInitializeTag<class_name> /*tag*/) \ - : class_name() \ + class_name(const blender::dna::internal::ShallowZeroInitializeTag /*tag*/) : class_name() \ { \ _DNA_internal_memzero(this, sizeof(class_name)); \ } \ - class_name &operator=( \ - const blender::dna::internal::ShallowZeroInitializeTag<class_name> /*tag*/) \ + class_name &operator=(const blender::dna::internal::ShallowZeroInitializeTag /*tag*/) \ { \ _DNA_internal_memzero(this, sizeof(class_name)); \ return *this; \ @@ -143,10 +141,9 @@ template<class T> /* DNA object initializer which leads to an object which underlying memory is filled with zeroes. */ -template<class T> -[[nodiscard]] inline internal::ShallowZeroInitializeTag<T> shallow_zero_initialize() +[[nodiscard]] inline internal::ShallowZeroInitializeTag shallow_zero_initialize() { - return internal::ShallowZeroInitializeTag<T>(); + return internal::ShallowZeroInitializeTag(); } } // namespace blender::dna |