diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index 32016f8..4ec1d6b 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -433,6 +433,129 @@
                begin, end);
 }
 
+Block::operator boost::asio::const_buffer() const
+{
+  return boost::asio::const_buffer(wire(), size());
+}
+
+bool
+Block::empty() const
+{
+  return m_type == std::numeric_limits<uint32_t>::max();
+}
+
+bool
+Block::hasWire() const
+{
+  return m_buffer && (m_begin != m_end);
+}
+
+Buffer::const_iterator
+Block::begin() const
+{
+  if (!hasWire())
+    throw Error("Underlying wire buffer is empty");
+
+  return m_begin;
+}
+
+Buffer::const_iterator
+Block::end() const
+{
+  if (!hasWire())
+    throw Error("Underlying wire buffer is empty");
+
+  return m_end;
+}
+
+const uint8_t*
+Block::wire() const
+{
+  if (!hasWire())
+    throw Error("(Block::wire) Underlying wire buffer is empty");
+
+  return &*m_begin;
+}
+
+size_t
+Block::size() const
+{
+  if (hasWire() || hasValue()) {
+    return m_size;
+  }
+  else
+    throw Error("Block size cannot be determined (undefined block size)");
+}
+
+bool
+Block::hasValue() const
+{
+  return static_cast<bool>(m_buffer);
+}
+
+const uint8_t*
+Block::value() const
+{
+  if (!hasValue())
+    return 0;
+
+  return &*m_value_begin;
+}
+
+size_t
+Block::value_size() const
+{
+  if (!hasValue())
+    return 0;
+
+  return m_value_end - m_value_begin;
+}
+
+Block::element_iterator
+Block::erase(Block::element_iterator position)
+{
+  resetWire();
+  return m_subBlocks.erase(position);
+}
+
+Block::element_iterator
+Block::erase(Block::element_iterator first, Block::element_iterator last)
+{
+  resetWire();
+  return m_subBlocks.erase(first, last);
+}
+
+void
+Block::push_back(const Block& element)
+{
+  resetWire();
+  m_subBlocks.push_back(element);
+}
+
+Block::element_const_iterator
+Block::elements_begin() const
+{
+  return m_subBlocks.begin();
+}
+
+Block::element_const_iterator
+Block::elements_end() const
+{
+  return m_subBlocks.end();
+}
+
+size_t
+Block::elements_size() const
+{
+  return m_subBlocks.size();
+}
+
+bool
+Block::operator!=(const Block& other) const
+{
+  return !this->operator==(other);
+}
+
 bool
 Block::operator==(const Block& other) const
 {
@@ -440,9 +563,4 @@
          std::equal(this->begin(), this->end(), other.begin());
 }
 
-Block::operator boost::asio::const_buffer() const
-{
-  return boost::asio::const_buffer(wire(), size());
-}
-
 } // namespace ndn
diff --git a/src/encoding/block.hpp b/src/encoding/block.hpp
index 6ba60ee..7c45543 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -319,67 +319,12 @@
   return m_buffer;
 }
 
-inline bool
-Block::empty() const
-{
-  return m_type == std::numeric_limits<uint32_t>::max();
-}
-
-inline bool
-Block::hasWire() const
-{
-  return m_buffer && (m_begin != m_end);
-}
-
-inline Buffer::const_iterator
-Block::begin() const
-{
-  if (!hasWire())
-    throw Error("Underlying wire buffer is empty");
-
-  return m_begin;
-}
-
-inline Buffer::const_iterator
-Block::end() const
-{
-  if (!hasWire())
-    throw Error("Underlying wire buffer is empty");
-
-  return m_end;
-}
-
-inline const uint8_t*
-Block::wire() const
-{
-  if (!hasWire())
-    throw Error("(Block::wire) Underlying wire buffer is empty");
-
-  return &*m_begin;
-}
-
-inline size_t
-Block::size() const
-{
-  if (hasWire() || hasValue()) {
-    return m_size;
-  }
-  else
-    throw Error("Block size cannot be determined (undefined block size)");
-}
-
 inline uint32_t
 Block::type() const
 {
   return m_type;
 }
 
-inline bool
-Block::hasValue() const
-{
-  return static_cast<bool>(m_buffer);
-}
-
 inline Buffer::const_iterator
 Block::value_begin() const
 {
@@ -392,75 +337,12 @@
   return m_value_end;
 }
 
-inline const uint8_t*
-Block::value() const
-{
-  if (!hasValue())
-    return 0;
-
-  return &*m_value_begin;
-}
-
-inline size_t
-Block::value_size() const
-{
-  if (!hasValue())
-    return 0;
-
-  return m_value_end - m_value_begin;
-}
-
-inline Block::element_iterator
-Block::erase(Block::element_iterator position)
-{
-  resetWire();
-  return m_subBlocks.erase(position);
-}
-
-inline Block::element_iterator
-Block::erase(Block::element_iterator first, Block::element_iterator last)
-{
-  resetWire();
-  return m_subBlocks.erase(first, last);
-}
-
-inline void
-Block::push_back(const Block& element)
-{
-  resetWire();
-  m_subBlocks.push_back(element);
-}
-
 inline const Block::element_container&
 Block::elements() const
 {
   return m_subBlocks;
 }
 
-inline Block::element_const_iterator
-Block::elements_begin() const
-{
-  return m_subBlocks.begin();
-}
-
-inline Block::element_const_iterator
-Block::elements_end() const
-{
-  return m_subBlocks.end();
-}
-
-inline size_t
-Block::elements_size() const
-{
-  return m_subBlocks.size();
-}
-
-inline bool
-Block::operator!=(const Block& other) const
-{
-  return !this->operator==(other);
-}
-
 } // namespace ndn
 
 #endif // NDN_ENCODING_BLOCK_HPP
