We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 248d1b0 commit 74acf65Copy full SHA for 74acf65
include/cppkafka/buffer.h
@@ -111,6 +111,21 @@ class CPPKAFKA_API Buffer {
111
template <typename T, size_t N>
112
Buffer(std::array<T, N>&& data) = delete;
113
114
+ /**
115
+ * Constructs a buffer from a raw array
116
+ *
117
+ * \param data The the array to be used as input
118
+ */
119
+ template <typename T, size_t N>
120
+ Buffer(const T(&data)[N])
121
+ : data_(reinterpret_cast<const DataType*>(&data[0])), size_(sizeof(T) * N) {
122
+ static_assert(sizeof(T) == sizeof(DataType), "sizeof(T) != sizeof(DataType)");
123
+ }
124
+
125
+ // Don't allow construction from temporary raw arrays
126
127
+ Buffer(const T(&&data)[N]) = delete;
128
129
/**
130
* \brief Construct a buffer from a const string ref
131
*
0 commit comments