Lumiera  0.pre.03
»edit your freedom«
nocopy.hpp
Go to the documentation of this file.
1 /*
2  NOCOPY.hpp - some flavours of non-copyable entities
3 
4  Copyright (C) Lumiera.org
5  2012, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
36 #ifndef LIB_NOCOPY_H
37 #define LIB_NOCOPY_H
38 
39 
40 
41 namespace util {
42 
47  {
48  protected:
49  ~NonCopyable() = default;
50  NonCopyable() = default;
51  NonCopyable (NonCopyable const&) = delete;
52  NonCopyable& operator= (NonCopyable const&) = delete;
53  };
54 
58  class MoveOnly
59  {
60  protected:
61  ~MoveOnly() = default;
62  MoveOnly() = default;
63  MoveOnly (MoveOnly&&) = default;
64  MoveOnly (MoveOnly const&) = delete;
65  MoveOnly& operator= (MoveOnly&&) = delete;
66  MoveOnly& operator= (MoveOnly const&) = delete;
67  };
68 
72  class MoveAssign
73  {
74  protected:
75  ~MoveAssign() = default;
76  MoveAssign() = default;
77  MoveAssign (MoveAssign&&) = default;
78  MoveAssign (MoveAssign const&) = delete;
79  MoveAssign& operator= (MoveAssign&&) = default;
80  MoveAssign& operator= (MoveAssign const&) = delete;
81  };
82 
91  class Cloneable
92  {
93  protected:
94  ~Cloneable() = default;
95  Cloneable() = default;
96  Cloneable (Cloneable&&) = default;
97  Cloneable (Cloneable const&) = default;
98  Cloneable& operator= (Cloneable&&) = delete;
99  Cloneable& operator= (Cloneable const&) = delete;
100  };
101 
109  {
110  protected:
111  NoInstance() = delete;
112  };
113 
114 
115 } // namespace util
116 #endif /*LIB_NOCOPY_H*/
Types marked with this mix-in may be moved and move-assigned.
Definition: nocopy.hpp:72
Not meant to be instantiated in any way.
Definition: nocopy.hpp:108
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Types marked with this mix-in may be moved but not copied.
Definition: nocopy.hpp:58
Types marked with this mix-in may be created by copy-construction (or move construction), but may be not reassigned thereafter.
Definition: nocopy.hpp:91