mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-01 19:18:04 +00:00
Merge pull request #138 from tgaldes/master
Add support for constructing Buffer from std::array
This commit is contained in:
@@ -96,6 +96,21 @@ public:
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
Buffer(std::vector<T>&& data) = delete;
|
Buffer(std::vector<T>&& data) = delete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a buffer from an array
|
||||||
|
*
|
||||||
|
* \param data The the array to be used as input
|
||||||
|
*/
|
||||||
|
template <typename T, size_t N>
|
||||||
|
Buffer(const std::array<T, N>& data)
|
||||||
|
: data_(reinterpret_cast<const DataType*>(data.data())), size_(data.size()) {
|
||||||
|
static_assert(sizeof(T) == sizeof(DataType), "sizeof(T) != sizeof(DataType)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't allow construction from temporary arrays
|
||||||
|
template <typename T, size_t N>
|
||||||
|
Buffer(std::array<T, N>&& data) = delete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Construct a buffer from a const string ref
|
* \brief Construct a buffer from a const string ref
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user