Skip to content

Commit 46b01c2

Browse files
committed
Add DISABLE_DEFAULT macro
1 parent 89f346a commit 46b01c2

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

include/Common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <cstdint>
44
#include <string_view>
55

6+
#define DISABLE_DEFAULT(TypeName) TypeName() = delete
67
#define DISABLE_COPY(TypeName) \
78
TypeName(const TypeName&) = delete; \
89
TypeName& operator=(const TypeName&) = delete

include/PinPatternManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace OpenShock {
1414
class PinPatternManager {
15+
DISABLE_DEFAULT(PinPatternManager);
1516
DISABLE_COPY(PinPatternManager);
1617
DISABLE_MOVE(PinPatternManager);
1718

@@ -21,7 +22,6 @@ namespace OpenShock {
2122
uint32_t duration;
2223
};
2324

24-
PinPatternManager() = delete;
2525
PinPatternManager(gpio_num_t gpioPin);
2626
~PinPatternManager();
2727

include/RGBPatternManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
namespace OpenShock {
1616
class RGBPatternManager {
17+
DISABLE_DEFAULT(RGBPatternManager);
1718
DISABLE_COPY(RGBPatternManager);
1819
DISABLE_MOVE(RGBPatternManager);
1920

2021
public:
21-
RGBPatternManager() = delete;
2222
RGBPatternManager(gpio_num_t gpioPin);
2323
~RGBPatternManager();
2424

include/TinyVec.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include "Common.h"
4+
35
#include <cstdint>
46
#include <cstdlib>
57
#include <cstring>
@@ -13,6 +15,7 @@ template<typename T, typename SizeType = uint32_t>
1315
class TinyVec {
1416
static_assert(std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T>, "TinyVec requires a trivially copyable & destructible type (POD).");
1517

18+
DISABLE_COPY(TinyVec);
1619
public:
1720
TinyVec() noexcept = default;
1821

@@ -32,9 +35,6 @@ class TinyVec {
3235

3336
~TinyVec() { free(_data); }
3437

35-
TinyVec(const TinyVec&) = delete;
36-
TinyVec& operator=(const TinyVec&) = delete;
37-
3838
TinyVec(TinyVec&& other) noexcept
3939
{
4040
_data = other._data;

0 commit comments

Comments
 (0)