diff --git a/daemon/table/pit-iterator.cpp b/daemon/table/pit-iterator.cpp
new file mode 100644
index 0000000..0cdb395
--- /dev/null
+++ b/daemon/table/pit-iterator.cpp
@@ -0,0 +1,72 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2016,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "pit-iterator.hpp"
+
+#include <boost/concept/assert.hpp>
+#include <boost/concept_check.hpp>
+#include <type_traits>
+
+namespace nfd {
+namespace pit {
+
+BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Iterator>));
+static_assert(std::is_default_constructible<Iterator>::value,
+              "Iterator must be default-constructible");
+
+Iterator::Iterator()
+  : m_iPitEntry(0)
+{
+}
+
+Iterator::Iterator(const NameTree::const_iterator& ntIt)
+  : m_ntIt(ntIt)
+  , m_iPitEntry(0)
+{
+}
+
+Iterator&
+Iterator::operator++()
+{
+  ++m_iPitEntry;
+  if (m_iPitEntry < m_ntIt->getPitEntries().size()) {
+    return *this;
+  }
+
+  ++m_ntIt;
+  m_iPitEntry = 0;
+  return *this;
+}
+
+Iterator
+Iterator::operator++(int)
+{
+  Iterator copy = *this;
+  this->operator++();
+  return copy;
+}
+
+} // namespace pit
+} // namespace nfd
diff --git a/daemon/table/pit-iterator.hpp b/daemon/table/pit-iterator.hpp
new file mode 100644
index 0000000..061e077
--- /dev/null
+++ b/daemon/table/pit-iterator.hpp
@@ -0,0 +1,86 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2016,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_DAEMON_TABLE_PIT_ITERATOR_HPP
+#define NFD_DAEMON_TABLE_PIT_ITERATOR_HPP
+
+#include "name-tree.hpp"
+#include "pit-entry.hpp"
+
+namespace nfd {
+namespace pit {
+
+/** \brief PIT iterator
+ */
+class Iterator : public std::iterator<std::forward_iterator_tag, const Entry>
+{
+public:
+  Iterator();
+
+  /** \brief constructor
+   *  \param ntIt a name tree iterator that visits name tree entries with one or more PIT entries
+   */
+  explicit
+  Iterator(const NameTree::const_iterator& ntIt);
+
+  const Entry&
+  operator*() const
+  {
+    return *this->operator->();
+  }
+
+  shared_ptr<Entry>
+  operator->() const
+  {
+    return m_ntIt->getPitEntries().at(m_iPitEntry);
+  }
+
+  Iterator&
+  operator++();
+
+  Iterator
+  operator++(int);
+
+  bool
+  operator==(const Iterator& other) const
+  {
+    return m_ntIt == other.m_ntIt && m_iPitEntry == other.m_iPitEntry;
+  }
+
+  bool
+  operator!=(const Iterator& other) const
+  {
+    return !this->operator==(other);
+  }
+
+private:
+  NameTree::const_iterator m_ntIt; ///< current name tree entry
+  size_t m_iPitEntry; ///< current PIT entry within m_ntIt->getPitEntries()
+};
+
+} // namespace pit
+} // namespace nfd
+
+#endif // NFD_DAEMON_TABLE_PIT_ITERATOR_HPP
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 6c378dc..6bb246c 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -24,40 +24,17 @@
  */
 
 #include "pit.hpp"
-#include <type_traits>
-
-#include <boost/concept/assert.hpp>
-#include <boost/concept_check.hpp>
-#include <type_traits>
 
 namespace nfd {
 namespace pit {
 
-#if HAVE_IS_MOVE_CONSTRUCTIBLE
-static_assert(std::is_move_constructible<DataMatchResult>::value,
-              "DataMatchResult must be MoveConstructible");
-#endif // HAVE_IS_MOVE_CONSTRUCTIBLE
-
-} // namespace pit
-
-// http://en.cppreference.com/w/cpp/concept/ForwardIterator
-BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Pit::const_iterator>));
-// boost::ForwardIterator follows SGI standard http://www.sgi.com/tech/stl/ForwardIterator.html,
-// which doesn't require DefaultConstructible
-#ifdef HAVE_IS_DEFAULT_CONSTRUCTIBLE
-static_assert(std::is_default_constructible<Pit::const_iterator>::value,
-              "Pit::const_iterator must be default-constructible");
-#else
-BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<Pit::const_iterator>));
-#endif // HAVE_IS_DEFAULT_CONSTRUCTIBLE
-
 Pit::Pit(NameTree& nameTree)
   : m_nameTree(nameTree)
   , m_nItems(0)
 {
 }
 
-std::pair<shared_ptr<pit::Entry>, bool>
+std::pair<shared_ptr<Entry>, bool>
 Pit::findOrInsert(const Interest& interest, bool allowInsert)
 {
   // determine which NameTree entry should the PIT entry be attached onto
@@ -79,9 +56,9 @@
 
   // check if PIT entry already exists
   size_t nteNameLen = nteName.size();
-  const std::vector<shared_ptr<pit::Entry>>& pitEntries = nte->getPitEntries();
+  const std::vector<shared_ptr<Entry>>& pitEntries = nte->getPitEntries();
   auto it = std::find_if(pitEntries.begin(), pitEntries.end(),
-    [&interest, nteNameLen] (const shared_ptr<pit::Entry>& entry) -> bool {
+    [&interest, nteNameLen] (const shared_ptr<Entry>& entry) -> bool {
       // initial part of the name is guaranteed to be the same
       BOOST_ASSERT(entry->getInterest().getName().compare(0, nteNameLen,
                    interest.getName(), 0, nteNameLen) == 0);
@@ -99,21 +76,21 @@
     return {nullptr, true};
   }
 
-  auto entry = make_shared<pit::Entry>(interest);
+  auto entry = make_shared<Entry>(interest);
   nte->insertPitEntry(entry);
   ++m_nItems;
   return {entry, true};
 }
 
-pit::DataMatchResult
+DataMatchResult
 Pit::findAllDataMatches(const Data& data) const
 {
   auto&& ntMatches = m_nameTree.findAllMatches(data.getName(),
     [] (const name_tree::Entry& entry) { return entry.hasPitEntries(); });
 
-  pit::DataMatchResult matches;
+  DataMatchResult matches;
   for (const name_tree::Entry& nte : ntMatches) {
-    for (const shared_ptr<pit::Entry>& pitEntry : nte.getPitEntries()) {
+    for (const shared_ptr<Entry>& pitEntry : nte.getPitEntries()) {
       if (pitEntry->getInterest().matchesData(data))
         matches.emplace_back(pitEntry);
     }
@@ -123,13 +100,7 @@
 }
 
 void
-Pit::erase(shared_ptr<pit::Entry> entry)
-{
-  this->erase(entry, true);
-}
-
-void
-Pit::erase(shared_ptr<pit::Entry> entry, bool canDeleteNte)
+Pit::erase(shared_ptr<Entry> entry, bool canDeleteNte)
 {
   name_tree::Entry* nte = m_nameTree.getEntry(*entry);
   BOOST_ASSERT(nte != nullptr);
@@ -142,7 +113,7 @@
 }
 
 void
-Pit::deleteInOutRecords(shared_ptr<pit::Entry> entry, const Face& face)
+Pit::deleteInOutRecords(shared_ptr<Entry> entry, const Face& face)
 {
   BOOST_ASSERT(entry != nullptr);
 
@@ -159,4 +130,11 @@
     [] (const name_tree::Entry& entry) { return entry.hasPitEntries(); }).begin());
 }
 
+Pit::const_iterator
+Pit::end() const
+{
+  return const_iterator(m_nameTree.end());
+}
+
+} // namespace pit
 } // namespace nfd
diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp
index cbfac86..ab22691 100644
--- a/daemon/table/pit.hpp
+++ b/daemon/table/pit.hpp
@@ -26,8 +26,8 @@
 #ifndef NFD_DAEMON_TABLE_PIT_HPP
 #define NFD_DAEMON_TABLE_PIT_HPP
 
-#include "name-tree.hpp"
 #include "pit-entry.hpp"
+#include "pit-iterator.hpp"
 
 namespace nfd {
 namespace pit {
@@ -36,12 +36,10 @@
  *  \brief an unordered iterable of all PIT entries matching Data
  *
  *  This type shall support:
- *    iterator<shared_ptr<pit::Entry>> begin()
- *    iterator<shared_ptr<pit::Entry>> end()
+ *    iterator<shared_ptr<Entry>> begin()
+ *    iterator<shared_ptr<Entry>> end()
  */
-typedef std::vector<shared_ptr<pit::Entry>> DataMatchResult;
-
-} // namespace pit
+typedef std::vector<shared_ptr<Entry>> DataMatchResult;
 
 /** \brief represents the Interest Table
  */
@@ -54,102 +52,73 @@
   /** \return number of entries
    */
   size_t
-  size() const;
+  size() const
+  {
+    return m_nItems;
+  }
 
   /** \brief finds a PIT entry for Interest
    *  \param interest the Interest
    *  \return an existing entry with same Name and Selectors; otherwise nullptr
    */
-  shared_ptr<pit::Entry>
-  find(const Interest& interest) const;
+  shared_ptr<Entry>
+  find(const Interest& interest) const
+  {
+    return const_cast<Pit*>(this)->findOrInsert(interest, false).first;
+  }
 
   /** \brief inserts a PIT entry for Interest
    *  \param interest the Interest; must be created with make_shared
    *  \return a new or existing entry with same Name and Selectors,
    *          and true for new entry, false for existing entry
    */
-  std::pair<shared_ptr<pit::Entry>, bool>
-  insert(const Interest& interest);
+  std::pair<shared_ptr<Entry>, bool>
+  insert(const Interest& interest)
+  {
+    return this->findOrInsert(interest, true);
+  }
 
   /** \brief performs a Data match
    *  \return an iterable of all PIT entries matching data
    */
-  pit::DataMatchResult
+  DataMatchResult
   findAllDataMatches(const Data& data) const;
 
-  /**
-   *  \brief erases a PIT Entry
+  /** \brief erases a PIT Entry
    */
   void
-  erase(shared_ptr<pit::Entry> entry);
+  erase(shared_ptr<Entry> entry)
+  {
+    this->erase(entry, true);
+  }
 
   /** \brief deletes in-record and out-record for face
    */
   void
-  deleteInOutRecords(shared_ptr<pit::Entry> entry, const Face& face);
+  deleteInOutRecords(shared_ptr<Entry> entry, const Face& face);
 
 public: // enumeration
-  class const_iterator;
+  typedef Iterator const_iterator;
 
-  /** \brief returns an iterator pointing to the first PIT entry
+  /** \return an iterator to the beginning
    *  \note Iteration order is implementation-specific and is undefined
-   *  \note The returned iterator may get invalidated if PIT or another NameTree-based
-   *        table is modified
+   *  \warning Undefine behavior may occur if a FIB/PIT/Measurements/StrategyChoice entry
+   *           is inserted or deleted during PIT enumeration.
    */
   const_iterator
   begin() const;
 
-  /** \brief returns an iterator referring to the past-the-end PIT entry
-   *  \note The returned iterator may get invalidated if PIT or another NameTree-based
-   *        table is modified
+  /** \return an iterator to the end
+   *  \sa begin()
    */
   const_iterator
   end() const;
 
-  class const_iterator : public std::iterator<std::forward_iterator_tag, const pit::Entry>
-  {
-  public:
-    const_iterator();
-
-    explicit
-    const_iterator(const NameTree::const_iterator& it);
-
-    ~const_iterator();
-
-    const pit::Entry&
-    operator*() const;
-
-    shared_ptr<pit::Entry>
-    operator->() const;
-
-    const_iterator&
-    operator++();
-
-    const_iterator
-    operator++(int);
-
-    bool
-    operator==(const const_iterator& other) const;
-
-    bool
-    operator!=(const const_iterator& other) const;
-
-  private:
-    NameTree::const_iterator m_nameTreeIterator;
-    /** \brief Index of the current visiting PIT entry in NameTree node
-     *
-     * Index is used to ensure that dereferencing of m_nameTreeIterator happens only when
-     * const_iterator is dereferenced or advanced.
-     */
-    size_t m_iPitEntry;
-  };
-
 private:
-  /**
-   *  \brief erases a PIT Entry
+  /** \brief erases a PIT Entry
    */
   void
-  erase(shared_ptr<pit::Entry> pitEntry, bool canDeleteNte);
+  erase(shared_ptr<Entry> pitEntry, bool canDeleteNte);
 
   /** \brief finds or inserts a PIT entry for Interest
    *  \param interest the Interest; must be created with make_shared if allowInsert
@@ -159,7 +128,7 @@
    *          if not allowInsert, an existing entry with same Name+Selectors and false,
    *          or {nullptr, true} if there's no existing entry
    */
-  std::pair<shared_ptr<pit::Entry>, bool>
+  std::pair<shared_ptr<Entry>, bool>
   findOrInsert(const Interest& interest, bool allowInsert);
 
 private:
@@ -167,93 +136,9 @@
   size_t m_nItems;
 };
 
-inline size_t
-Pit::size() const
-{
-  return m_nItems;
-}
+} // namespace pit
 
-inline shared_ptr<pit::Entry>
-Pit::find(const Interest& interest) const
-{
-  return const_cast<Pit*>(this)->findOrInsert(interest, false).first;
-}
-
-inline std::pair<shared_ptr<pit::Entry>, bool>
-Pit::insert(const Interest& interest)
-{
-  return this->findOrInsert(interest, true);
-}
-
-inline Pit::const_iterator
-Pit::end() const
-{
-  return const_iterator(m_nameTree.end());
-}
-
-inline
-Pit::const_iterator::const_iterator()
-  : m_iPitEntry(0)
-{
-}
-
-inline
-Pit::const_iterator::const_iterator(const NameTree::const_iterator& it)
-  : m_nameTreeIterator(it)
-  , m_iPitEntry(0)
-{
-}
-
-inline
-Pit::const_iterator::~const_iterator()
-{
-}
-
-inline Pit::const_iterator
-Pit::const_iterator::operator++(int)
-{
-  Pit::const_iterator temp(*this);
-  ++(*this);
-  return temp;
-}
-
-inline Pit::const_iterator&
-Pit::const_iterator::operator++()
-{
-  ++m_iPitEntry;
-  if (m_iPitEntry < m_nameTreeIterator->getPitEntries().size()) {
-    return *this;
-  }
-
-  ++m_nameTreeIterator;
-  m_iPitEntry = 0;
-  return *this;
-}
-
-inline const pit::Entry&
-Pit::const_iterator::operator*() const
-{
-  return *(this->operator->());
-}
-
-inline shared_ptr<pit::Entry>
-Pit::const_iterator::operator->() const
-{
-  return m_nameTreeIterator->getPitEntries().at(m_iPitEntry);
-}
-
-inline bool
-Pit::const_iterator::operator==(const Pit::const_iterator& other) const
-{
-  return m_nameTreeIterator == other.m_nameTreeIterator &&
-         m_iPitEntry == other.m_iPitEntry;
-}
-
-inline bool
-Pit::const_iterator::operator!=(const Pit::const_iterator& other) const
-{
-  return !(*this == other);
-}
+using pit::Pit;
 
 } // namespace nfd
 
