Blender  V2.93
BLI_utility_mixins.hh
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 namespace blender {
24 
28 class NonCopyable {
29  public:
30  /* Disable copy construction and assignment. */
31  NonCopyable(const NonCopyable &other) = delete;
32  NonCopyable &operator=(const NonCopyable &other) = delete;
33 
34  /* Explicitly enable default construction, move construction and move assignment. */
35  NonCopyable() = default;
36  NonCopyable(NonCopyable &&other) = default;
37  NonCopyable &operator=(NonCopyable &&other) = default;
38 };
39 
43 class NonMovable {
44  public:
45  /* Disable move construction and assignment. */
46  NonMovable(NonMovable &&other) = delete;
47  NonMovable &operator=(NonMovable &&other) = delete;
48 
49  /* Explicitly enable default construction, copy construction and copy assignment. */
50  NonMovable() = default;
51  NonMovable(const NonMovable &other) = default;
52  NonMovable &operator=(const NonMovable &other) = default;
53 };
54 
55 } // 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