From 6c0c6a1f489a9c3307f7f81b6243bedb9311e415 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 6 Jun 2021 18:26:25 +1000 Subject: [PATCH] AP_Common: added CLASS_NO_COPY() macro used to make it easy to forbid copy of classes --- libraries/AP_Common/AP_Common.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AP_Common/AP_Common.h b/libraries/AP_Common/AP_Common.h index 67bd125fae..fe36858431 100644 --- a/libraries/AP_Common/AP_Common.h +++ b/libraries/AP_Common/AP_Common.h @@ -45,6 +45,9 @@ #define FMT_PRINTF(a,b) __attribute__((format(printf, a, b))) #define FMT_SCANF(a,b) __attribute__((format(scanf, a, b))) +// used to forbid copy of objects +#define CLASS_NO_COPY(c) c(const c &other) = delete; c &operator=(const c&) = delete + #ifdef __has_cpp_attribute # if __has_cpp_attribute(fallthrough) # define FALLTHROUGH [[fallthrough]]