Skip to content

Commit 248d1b0

Browse files
author
Tyler Galdes
committed
Delete construction of buffer with rvalue arrays
1 parent b48036f commit 248d1b0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

include/cppkafka/buffer.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ class CPPKAFKA_API Buffer {
9292
static_assert(sizeof(T) == sizeof(DataType), "sizeof(T) != sizeof(DataType)");
9393
}
9494

95+
// Don't allow construction from temporary vectors
96+
template <typename T>
97+
Buffer(std::vector<T>&& data) = delete;
98+
9599
/**
96100
* Constructs a buffer from an array
97101
*
@@ -103,9 +107,9 @@ class CPPKAFKA_API Buffer {
103107
static_assert(sizeof(T) == sizeof(DataType), "sizeof(T) != sizeof(DataType)");
104108
}
105109

106-
// Don't allow construction from temporary vectors
107-
template <typename T>
108-
Buffer(std::vector<T>&& data) = delete;
110+
// Don't allow construction from temporary arrays
111+
template <typename T, size_t N>
112+
Buffer(std::array<T, N>&& data) = delete;
109113

110114
/**
111115
* \brief Construct a buffer from a const string ref

0 commit comments

Comments
 (0)