encoding: remove duplicate buf() and get() methods from Buffer class

Change-Id: If885d4199d6c9df9b9b46664c3641c9a14a77eab
diff --git a/src/encoding/buffer.cpp b/src/encoding/buffer.cpp
index 0d9550b..9390079 100644
--- a/src/encoding/buffer.cpp
+++ b/src/encoding/buffer.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -35,14 +35,7 @@
               "Buffer must be MoveAssignable with noexcept");
 #endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE
 
-Buffer::Buffer()
-{
-}
-
-Buffer::Buffer(size_t size)
-  : std::vector<uint8_t>(size, 0)
-{
-}
+Buffer::Buffer() = default;
 
 Buffer::Buffer(const void* buf, size_t length)
   : std::vector<uint8_t>(reinterpret_cast<const uint8_t*>(buf),
diff --git a/src/encoding/buffer.hpp b/src/encoding/buffer.hpp
index 994fbf8..70ffec8 100644
--- a/src/encoding/buffer.hpp
+++ b/src/encoding/buffer.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -30,104 +30,50 @@
 
 namespace ndn {
 
-class Buffer;
-typedef shared_ptr<const Buffer> ConstBufferPtr;
-typedef shared_ptr<Buffer> BufferPtr;
-
 /**
- * @brief Class representing a general-use automatically managed/resized buffer
+ * @brief General-purpose automatically managed/resized buffer
  *
- * In most respect, Buffer class is equivalent to std::vector<uint8_t> and is in fact
- * uses it as a base class.  In addition to that, it provides buf() and buf<T>() helper
- * method for easier access to the underlying data (buf<T>() casts pointer to the requested class)
+ * In most respect, the Buffer class is equivalent to a `std::vector<uint8_t>`, and it in fact
+ * uses the latter as a base class. In addition to that, it provides the get<T>() helper method
+ * that automatically casts the returned pointer to the requested type.
  */
 class Buffer : public std::vector<uint8_t>
 {
 public:
-  /** @brief Creates an empty buffer
+  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 Create a buffer by copying contents from a buffer
-   *  @param buf const pointer to buffer
+  /** @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 Create a buffer by copying contents of the range [first, last)
-   *  @tparam InputIterator an InputIterator compatible with std::vector<uint8_t> constructor
-   *  @param first iterator to the first element to copy
-   *  @param last  iterator to the element immediately following the last element to copy
-   */
-  template <class InputIterator>
-  Buffer(InputIterator first, InputIterator last)
-    : std::vector<uint8_t>(first, last)
-  {
-  }
-
-  /** @return pointer to the first byte of the buffer
-   */
-  uint8_t*
-  get()
-  {
-    return &front();
-  }
-
-  /** @return pointer to the first byte of the buffer
-   *
-   *  This is same as \p .get()
-   */
-  uint8_t*
-  buf()
-  {
-    return &front();
-  }
-
-  /** @return pointer to the first byte of the buffer and reinterpret_cast
-   *          it to the requested type T
+  /** @return pointer to the first byte of the buffer, cast to the requested type T
    */
   template<class T>
   T*
-  get()
+  get() noexcept
   {
-    return reinterpret_cast<T*>(&front());
+    return reinterpret_cast<T*>(data());
   }
 
-  /** @return pointer to the first byte of the buffer
-   *
-   *  This is same as \p .get()
-   */
-  const uint8_t*
-  buf() const
-  {
-    return &front();
-  }
-
-  /** @return pointer to the first byte of the buffer
-   */
-  const uint8_t*
-  get() const
-  {
-    return &front();
-  }
-
-  /** @return const pointer to the first byte of the buffer and reinterpret_cast
-   *          it to the requested type T
+  /** @return const pointer to the first byte of the buffer, cast to the requested type T
    */
   template<class T>
   const T*
-  get() const
+  get() const noexcept
   {
-    return reinterpret_cast<const T*>(&front());
+    return reinterpret_cast<const T*>(data());
   }
 };
 
+using BufferPtr = shared_ptr<Buffer>;
+using ConstBufferPtr = shared_ptr<const Buffer>;
+
 } // namespace ndn
 
 #endif // NDN_ENCODING_BUFFER_HPP