24 #ifndef NDN_CXX_ENCODING_BUFFER_HPP
25 #define NDN_CXX_ENCODING_BUFFER_HPP
29 #include <initializer_list>
41 class Buffer :
public std::vector<uint8_t>
71 : std::vector<uint8_t>(size, 0)
79 Buffer(
const void* buf,
size_t length)
80 : std::vector<uint8_t>(reinterpret_cast<const uint8_t*>(buf),
81 reinterpret_cast<const uint8_t*>(buf) + length)
89 template<
class InputIt>
91 : std::vector<uint8_t>(first, last)
97 Buffer(std::initializer_list<uint8_t> il)
98 : std::vector<uint8_t>(il)
108 return reinterpret_cast<T*
>(data());
117 return reinterpret_cast<const T*
>(data());
131 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.
Common includes and macros used throughout the library.
std::ostream & boost_test_print_type(std::ostream &os, const Buffer &buf)
shared_ptr< const Buffer > ConstBufferPtr
shared_ptr< Buffer > BufferPtr