table: use boost::iterator_range in NameTree

refs #2155

Change-Id: I14efacf26aa1143177038fff3cf20d9d845f2c68
diff --git a/daemon/table/name-tree.cpp b/daemon/table/name-tree.cpp
index 3dfd2ae..61a5364 100644
--- a/daemon/table/name-tree.cpp
+++ b/daemon/table/name-tree.cpp
@@ -387,7 +387,7 @@
   return false; // if this entry is not empty
 }
 
-NameTree::Range
+boost::iterator_range<NameTree::const_iterator>
 NameTree::fullEnumerate(const name_tree::EntrySelector& entrySelector) const
 {
   NFD_LOG_TRACE("fullEnumerate");
@@ -406,7 +406,7 @@
   return {end(), end()};
 }
 
-NameTree::Range
+boost::iterator_range<NameTree::const_iterator>
 NameTree::partialEnumerate(const Name& prefix,
                            const name_tree::EntrySubTreeSelector& entrySubTreeSelector) const
 {
@@ -435,7 +435,7 @@
   return {it, end()};
 }
 
-NameTree::Range
+boost::iterator_range<NameTree::const_iterator>
 NameTree::findAllMatches(const Name& prefix,
                          const name_tree::EntrySelector& entrySelector) const
 {
@@ -753,10 +753,4 @@
   return *this;
 }
 
-NameTree::Range::Range(const_iterator begin, const_iterator end)
-  : m_begin(begin)
-  , m_end(end)
-{
-}
-
 } // namespace nfd
diff --git a/daemon/table/name-tree.hpp b/daemon/table/name-tree.hpp
index b4e12ed..6e936d0 100644
--- a/daemon/table/name-tree.hpp
+++ b/daemon/table/name-tree.hpp
@@ -80,7 +80,6 @@
 {
 public:
   class const_iterator;
-  class Range;
 
   explicit
   NameTree(size_t nBuckets = 1024);
@@ -186,7 +185,7 @@
    *  }
    *  \endcode
    */
-  Range
+  boost::iterator_range<const_iterator>
   findAllMatches(const Name& prefix,
                  const name_tree::EntrySelector& entrySelector = name_tree::AnyEntry()) const;
 
@@ -203,7 +202,7 @@
    *  }
    *  \endcode
    */
-  Range
+  boost::iterator_range<const_iterator>
   fullEnumerate(const name_tree::EntrySelector& entrySelector = name_tree::AnyEntry()) const;
 
   /** \brief Enumerate all entries under a prefix, optionally filtered by an EntrySubTreeSelector.
@@ -218,7 +217,7 @@
    *  }
    *  \endcode
    */
-  Range
+  boost::iterator_range<const_iterator>
   partialEnumerate(const Name& prefix,
                    const name_tree::EntrySubTreeSelector& entrySubTreeSelector =
                          name_tree::AnyEntrySubTree()) const;
@@ -276,32 +275,6 @@
     bool                                        m_shouldVisitChildren;
   };
 
-  /** \brief contains a pair of begin and end iterators
-   *
-   *  This is to be used with range-based for.
-   */
-  class Range
-  {
-  public:
-    Range(const_iterator begin, const_iterator end);
-
-    const_iterator
-    begin() const
-    {
-      return m_begin;
-    }
-
-    const_iterator
-    end() const
-    {
-      return m_end;
-    }
-
-  private:
-    const_iterator m_begin;
-    const_iterator m_end;
-  };
-
 private:
   /**
    * \brief Resize the hash table size when its load factor reaches a threshold.