libcamera: class: Provide move and copy disablers
It can be difficult to correctly parse the syntax for copy/move and the associated assignment operators. Provide helpers as syntactic sugar to facilitate disabling either the copy constructor, and copy assignment operator, and the move constructor and move assignment operator in a way which is explicit and clear. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -11,6 +11,24 @@
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
#ifndef __DOXYGEN__
|
||||
#define LIBCAMERA_DISABLE_COPY(klass) \
|
||||
klass(const klass &) = delete; \
|
||||
klass &operator=(const klass &) = delete;
|
||||
|
||||
#define LIBCAMERA_DISABLE_MOVE(klass) \
|
||||
klass(klass &&) = delete; \
|
||||
klass &operator=(klass &&) = delete;
|
||||
|
||||
#define LIBCAMERA_DISABLE_COPY_AND_MOVE(klass) \
|
||||
LIBCAMERA_DISABLE_COPY(klass) \
|
||||
LIBCAMERA_DISABLE_MOVE(klass)
|
||||
#else
|
||||
#define LIBCAMERA_DISABLE_COPY(klass)
|
||||
#define LIBCAMERA_DISABLE_MOVE(klass)
|
||||
#define LIBCAMERA_DISABLE_COPY_AND_MOVE(klass)
|
||||
#endif
|
||||
|
||||
#ifndef __DOXYGEN__
|
||||
#define LIBCAMERA_DECLARE_PRIVATE(klass) \
|
||||
public: \
|
||||
|
||||
Reference in New Issue
Block a user