table: PIT iterator dereferences to const shared_ptr<pit::Entry>&

refs #3164

Change-Id: Id857e214a727917009f865c2cfac782077844799
diff --git a/daemon/table/pit-iterator.hpp b/daemon/table/pit-iterator.hpp
index 061e077..434dfd0 100644
--- a/daemon/table/pit-iterator.hpp
+++ b/daemon/table/pit-iterator.hpp
@@ -37,13 +37,12 @@
 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
+   *  \param iPitEntry make this iterator to dereference to the i-th PIT entry in name tree entry
    */
   explicit
-  Iterator(const NameTree::const_iterator& ntIt);
+  Iterator(const NameTree::const_iterator& ntIt = NameTree::const_iterator(), size_t iPitEntry = 0);
 
   const Entry&
   operator*() const
@@ -51,10 +50,12 @@
     return *this->operator->();
   }
 
-  shared_ptr<Entry>
+  const shared_ptr<Entry>&
   operator->() const
   {
-    return m_ntIt->getPitEntries().at(m_iPitEntry);
+    BOOST_ASSERT(m_ntIt != NameTree::const_iterator());
+    BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
+    return m_ntIt->getPitEntries()[m_iPitEntry];
   }
 
   Iterator&