table: Ensure Fib::const_iterator is default and copy constructible
This functionality is necessary for ndnSIM python bindings and is
technically required by ForwardIterator C++ concept
(http://en.cppreference.com/w/cpp/concept/ForwardIterator)
Change-Id: Ibe0812c3a2cf05840cd3e83b941cc52affe2ac65
Refs: #2338
diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp
index 3a19949..34a2009 100644
--- a/daemon/table/fib.hpp
+++ b/daemon/table/fib.hpp
@@ -95,15 +95,26 @@
public: // enumeration
class const_iterator;
+ /** \brief returns an iterator pointing to the first FIB entry
+ * \note Iteration order is implementation-specific and is undefined
+ * \note The returned iterator may get invalidated if FIB or another NameTree-based
+ * table is modified
+ */
const_iterator
begin() const;
+ /** \brief returns an iterator referring to the past-the-end FIB entry
+ * \note The returned iterator may get invalidated if FIB or another NameTree-based
+ * table is modified
+ */
const_iterator
end() const;
- class const_iterator : public std::iterator<std::forward_iterator_tag, fib::Entry>
+ class const_iterator : public std::iterator<std::forward_iterator_tag, const fib::Entry>
{
public:
+ const_iterator() = default;
+
explicit
const_iterator(const NameTree::const_iterator& it);
@@ -193,7 +204,7 @@
inline const fib::Entry&
Fib::const_iterator::operator*() const
{
- return *(m_nameTreeIterator->getFibEntry());
+ return *this->operator->();
}
inline shared_ptr<fib::Entry>