diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/BLI_utility_mixins.h | 29 | ||||
-rw-r--r-- | source/blender/blenlib/CMakeLists.txt | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utility_mixins.h b/source/blender/blenlib/BLI_utility_mixins.h new file mode 100644 index 00000000000..66164fdcd24 --- /dev/null +++ b/source/blender/blenlib/BLI_utility_mixins.h @@ -0,0 +1,29 @@ +#pragma once + +namespace BLI { + +class NonCopyable { + public: + /* Disable copy construction and assignment. */ + NonCopyable(const NonCopyable &other) = delete; + NonCopyable &operator=(const NonCopyable &other) = delete; + + /* Explicitly enable default construction, move construction and move assignment. */ + NonCopyable() = default; + NonCopyable(NonCopyable &&other) = default; + NonCopyable &operator=(NonCopyable &&other) = default; +}; + +class NonMovable { + public: + /* Disable move construction and assignment. */ + NonMovable(NonMovable &&other) = delete; + NonMovable &operator=(NonMovable &&other) = delete; + + /* Explicitly enable default construction, copy construction and copy assignment. */ + NonMovable() = default; + NonMovable(const NonMovable &other) = default; + NonMovable &operator=(const NonMovable &other) = default; +}; + +} // namespace BLI diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 2780e2becf8..1e4e07d63b3 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -243,6 +243,7 @@ set(SRC BLI_utildefines_iter.h BLI_utildefines_stack.h BLI_utildefines_variadic.h + BLI_utility_mixins.h BLI_uvproject.h BLI_vector.h BLI_vector_set.h |