24 #ifndef NDN_CXX_ENCODING_BUFFER_HPP
25 #define NDN_CXX_ENCODING_BUFFER_HPP
28 #include <initializer_list>
42 class Buffer :
public std::vector<uint8_t>
72 : std::vector<uint8_t>(size, 0)
80 Buffer(
const void* buf,
size_t length)
81 : std::vector<uint8_t>(reinterpret_cast<const uint8_t*>(buf),
82 reinterpret_cast<const uint8_t*>(buf) + length)
90 template<
class InputIt>
92 : std::vector<uint8_t>(first, last)
98 Buffer(std::initializer_list<uint8_t> il)
99 : std::vector<uint8_t>(il)
109 return reinterpret_cast<T*
>(data());
118 return reinterpret_cast<const T*
>(data());
132 Buffer::operator=(Buffer&&) noexcept = default;
General-purpose automatically managed/resized buffer.
Buffer & operator=(const Buffer &)
Copy assignment operator.
Buffer(const Buffer &)
Copy constructor.
Buffer()=default
Creates an empty Buffer.
Buffer(InputIt first, InputIt last)
Creates a Buffer by copying the elements of the range [first, last)
Buffer(std::initializer_list< uint8_t > il)
Creates a Buffer with the contents of an initializer list.
const T * get() const noexcept
Buffer(const void *buf, size_t length)
Creates a Buffer by copying contents from a raw buffer.
Buffer(Buffer &&) noexcept
Move constructor.
std::ostream & boost_test_print_type(std::ostream &os, const Buffer &buf)
std::shared_ptr< Buffer > BufferPtr
std::shared_ptr< const Buffer > ConstBufferPtr