Blender  V3.3
BLI_utility_mixins.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 namespace blender {
10 
14 class NonCopyable {
15  public:
16  /* Disable copy construction and assignment. */
17  NonCopyable(const NonCopyable &other) = delete;
18  NonCopyable &operator=(const NonCopyable &other) = delete;
19 
20  /* Explicitly enable default construction, move construction and move assignment. */
21  NonCopyable() = default;
22  NonCopyable(NonCopyable &&other) = default;
23  NonCopyable &operator=(NonCopyable &&other) = default;
24 };
25 
29 class NonMovable {
30  public:
31  /* Disable move construction and assignment. */
32  NonMovable(NonMovable &&other) = delete;
33  NonMovable &operator=(NonMovable &&other) = delete;
34 
35  /* Explicitly enable default construction, copy construction and copy assignment. */
36  NonMovable() = default;
37  NonMovable(const NonMovable &other) = default;
38  NonMovable &operator=(const NonMovable &other) = default;
39 };
40 
41 } // namespace blender
NonCopyable & operator=(const NonCopyable &other)=delete
NonCopyable & operator=(NonCopyable &&other)=default
NonCopyable(NonCopyable &&other)=default
NonCopyable(const NonCopyable &other)=delete
NonMovable & operator=(NonMovable &&other)=delete
NonMovable(const NonMovable &other)=default
NonMovable & operator=(const NonMovable &other)=default
NonMovable(NonMovable &&other)=delete