File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,21 @@ class CPPKAFKA_API Buffer {
111111 template <typename T, size_t N>
112112 Buffer (std::array<T, N>&& data) = delete ;
113113
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+ template <typename T, size_t N>
127+ Buffer (const T (&&data)[N]) = delete;
128+
114129 /* *
115130 * \brief Construct a buffer from a const string ref
116131 *
You can’t perform that action at this time.
0 commit comments