Skip to content

Commit d39a416

Browse files
committed
Replace NonCopyable in CAN inheritance.
This commit moves the deletion of copy constructor and copy assignment operators to the `mbed::interface::can` class, where both `mbed::CAN` and `mbed::interface::CAN` inherit enum types from. This allows `NonCopyable` to be removed from the inheritance list.
1 parent d79446c commit d39a416

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

drivers/include/drivers/CAN.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "hal/can_api.h"
2626
#include "platform/Callback.h"
2727
#include "platform/PlatformMutex.h"
28-
#include "platform/NonCopyable.h"
2928

3029
namespace mbed {
3130

@@ -39,9 +38,9 @@ namespace mbed {
3938
*/
4039
class CAN
4140
#ifdef FEATURE_EXPERIMENTAL_API
42-
final : public interface::CAN, private NonCopyable<CAN>
41+
final : public interface::CAN
4342
#else
44-
: private NonCopyable<CAN>, public interface::can
43+
: public interface::can
4544
#endif
4645
{
4746

drivers/include/drivers/interfaces/InterfaceCAN.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,12 @@ struct can {
145145
protected:
146146
can() = default;
147147
~can() = default;
148-
can(const can &) = default;
149-
can &operator=(const can &) = default;
148+
149+
public:
150+
151+
/* Copy constructor and copy assignment operators will be deleted in subclasses as well */
152+
can(const can &) = delete;
153+
can &operator=(const can &) = delete;
150154

151155
};
152156

0 commit comments

Comments
 (0)