encoding: don't inherit constructors from std::vector
This is a partial revert of commit 5d0b0106dfc7675f9048976d4dd4ea00e46e6c39,
which caused the following build failure with gcc-7:
./libndn-cxx.so: error: undefined reference to 'std::allocator<unsigned char>::allocator()'
Change-Id: I58136eb1901425158e529e37b6fa288b72fc46f6
diff --git a/src/encoding/buffer.hpp b/src/encoding/buffer.hpp
index 70ffec8..fbfeb00 100644
--- a/src/encoding/buffer.hpp
+++ b/src/encoding/buffer.hpp
@@ -40,18 +40,32 @@
class Buffer : public std::vector<uint8_t>
{
public:
- using std::vector<uint8_t>::vector;
-
/** @brief Creates an empty Buffer
*/
Buffer();
+ /** @brief Creates a Buffer with pre-allocated size
+ * @param size size of the Buffer to be allocated
+ */
+ explicit
+ Buffer(size_t size);
+
/** @brief Creates a Buffer by copying contents from a raw buffer
* @param buf const pointer to buffer to copy
* @param length length of the buffer to copy
*/
Buffer(const void* buf, size_t length);
+ /** @brief Creates a Buffer by copying the elements of the range [first, last)
+ * @param first an input iterator to the first element to copy
+ * @param last an input iterator to the element immediately following the last element to copy
+ */
+ template<class InputIt>
+ Buffer(InputIt first, InputIt last)
+ : std::vector<uint8_t>(first, last)
+ {
+ }
+
/** @return pointer to the first byte of the buffer, cast to the requested type T
*/
template<class T>