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)
5  2012, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
27 #ifndef LIB_NOCOPY_H
28 #define LIB_NOCOPY_H
29 
30 
31 
32 namespace util {
33 
38  {
39  protected:
40  ~NonCopyable() = default;
41  NonCopyable() = default;
42  NonCopyable (NonCopyable const&) = delete;
43  NonCopyable& operator= (NonCopyable const&) = delete;
44  };
45 
49  class MoveOnly
50  {
51  protected:
52  ~MoveOnly() = default;
53  MoveOnly() = default;
54  MoveOnly (MoveOnly&&) = default;
55  MoveOnly (MoveOnly const&) = delete;
56  MoveOnly& operator= (MoveOnly&&) = delete;
57  MoveOnly& operator= (MoveOnly const&) = delete;
58  };
59 
63  class MoveAssign
64  {
65  protected:
66  ~MoveAssign() = default;
67  MoveAssign() = default;
68  MoveAssign (MoveAssign&&) = default;
69  MoveAssign (MoveAssign const&) = delete;
70  MoveAssign& operator= (MoveAssign&&) = default;
71  MoveAssign& operator= (MoveAssign const&) = delete;
72  };
73 
79  class NonAssign
80  {
81  protected:
82  ~NonAssign() = default;
83  NonAssign() = default;
84  NonAssign (NonAssign&&) = default;
85  NonAssign (NonAssign const&) = default;
86  NonAssign& operator= (NonAssign&&) = delete;
87  NonAssign& operator= (NonAssign const&) = delete;
88  };
89 
95  class Cloneable
96  {
97  protected:
98  ~Cloneable() = default;
99  Cloneable() = default;
100  Cloneable (Cloneable&&) = delete;
101  Cloneable (Cloneable const&) = default;
102  Cloneable& operator= (Cloneable&&) = delete;
103  Cloneable& operator= (Cloneable const&) = delete;
104  };
105 
113  {
114  protected:
115  NoInstance() = delete;
116  };
117 
118 
119 } // namespace util
120 #endif /*LIB_NOCOPY_H*/
Types marked with this mix-in may be moved and move-assigned.
Definition: nocopy.hpp:63
Not meant to be instantiated in any way.
Definition: nocopy.hpp:112
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
Types marked with this mix-in may be moved but not copied.
Definition: nocopy.hpp:49
Types marked with this mix-in may be duplicated by copy-construction, yet may not be moved or transfe...
Definition: nocopy.hpp:95
Types marked with this mix-in may be created and moved liberally at construction, while any further a...
Definition: nocopy.hpp:79