We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3ffb0f1 + 74acf65 commit 40ee64cCopy full SHA for 40ee64c
include/cppkafka/buffer.h
@@ -141,6 +141,21 @@ class CPPKAFKA_API Buffer {
141
template <typename T, size_t N>
142
Buffer(T(&&data)[N]) = delete;
143
144
+ /**
145
+ * Constructs a buffer from a raw array
146
+ *
147
+ * \param data The the array to be used as input
148
+ */
149
+ template <typename T, size_t N>
150
+ Buffer(const T(&data)[N])
151
+ : data_(reinterpret_cast<const DataType*>(&data[0])), size_(sizeof(T) * N) {
152
+ static_assert(sizeof(T) == sizeof(DataType), "sizeof(T) != sizeof(DataType)");
153
+ }
154
+
155
+ // Don't allow construction from temporary raw arrays
156
157
+ Buffer(const T(&&data)[N]) = delete;
158
159
/**
160
* \brief Construct a buffer from a const string ref
161
*
0 commit comments