table: make FIB and StrategyChoice iterators default-constructible
They were previously not default-constructible when compiled with gcc 4.8.4.
refs #3882
Change-Id: I2431c869fb61b7adbe83d5551705981bf8618280
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index ed082bf..aaee894 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -25,12 +25,15 @@
#include "face-table.hpp"
#include "forwarder.hpp"
+#include "core/asserts.hpp"
#include "core/global-io.hpp"
#include "core/logger.hpp"
#include "face/channel.hpp"
namespace nfd {
+NFD_ASSERT_FORWARD_ITERATOR(FaceTable::const_iterator);
+
NFD_LOG_INIT("FaceTable");
FaceTable::FaceTable()
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index dd72214..89c54e9 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -24,25 +24,17 @@
*/
#include "cs.hpp"
-#include "core/logger.hpp"
#include "core/algorithm.hpp"
+#include "core/asserts.hpp"
+#include "core/logger.hpp"
#include <ndn-cxx/lp/tags.hpp>
-NFD_LOG_INIT("ContentStore");
-
namespace nfd {
namespace cs {
-// http://en.cppreference.com/w/cpp/concept/ForwardIterator
-BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Cs::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<Cs::const_iterator>::value,
- "Cs::const_iterator must be default-constructible");
-#else
-BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<Cs::const_iterator>));
-#endif // HAVE_IS_DEFAULT_CONSTRUCTIBLE
+NFD_ASSERT_FORWARD_ITERATOR(Cs::const_iterator);
+
+NFD_LOG_INIT("ContentStore");
unique_ptr<Policy>
makeDefaultPolicy()
diff --git a/daemon/table/fib.cpp b/daemon/table/fib.cpp
index 8ba6ffe..c34fd12 100644
--- a/daemon/table/fib.cpp
+++ b/daemon/table/fib.cpp
@@ -26,26 +26,14 @@
#include "fib.hpp"
#include "pit-entry.hpp"
#include "measurements-entry.hpp"
-
-#include <boost/concept/assert.hpp>
-#include <boost/concept_check.hpp>
-#include <type_traits>
+#include "core/asserts.hpp"
namespace nfd {
namespace fib {
-const unique_ptr<Entry> Fib::s_emptyEntry = make_unique<Entry>(Name());
+NFD_ASSERT_FORWARD_ITERATOR(Fib::const_iterator);
-// http://en.cppreference.com/w/cpp/concept/ForwardIterator
-BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Fib::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<Fib::const_iterator>::value,
- "Fib::const_iterator must be default-constructible");
-#else
-BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<Fib::const_iterator>));
-#endif // HAVE_IS_DEFAULT_CONSTRUCTIBLE
+const unique_ptr<Entry> Fib::s_emptyEntry = make_unique<Entry>(Name());
static inline bool
nteHasFibEntry(const name_tree::Entry& nte)
diff --git a/daemon/table/name-tree-entry.hpp b/daemon/table/name-tree-entry.hpp
index ab385da..2fa0806 100644
--- a/daemon/table/name-tree-entry.hpp
+++ b/daemon/table/name-tree-entry.hpp
@@ -189,8 +189,11 @@
*/
using Getter = ENTRY* (Entry::*)() const;
+ /** \note The default argument is needed to ensure FIB and StrategyChoice iterators
+ * are default-constructible.
+ */
explicit
- GetTableEntry(Getter getter)
+ GetTableEntry(Getter getter = nullptr)
: m_getter(getter)
{
}
diff --git a/daemon/table/name-tree-iterator.cpp b/daemon/table/name-tree-iterator.cpp
index d7c7362..32f282d 100644
--- a/daemon/table/name-tree-iterator.cpp
+++ b/daemon/table/name-tree-iterator.cpp
@@ -25,20 +25,14 @@
#include "name-tree-iterator.hpp"
#include "name-tree.hpp"
+#include "core/asserts.hpp"
#include "core/logger.hpp"
-
-#include <boost/concept/assert.hpp>
-#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
-#include <type_traits>
namespace nfd {
namespace name_tree {
-BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Iterator>));
-static_assert(std::is_default_constructible<Iterator>::value,
- "Iterator must be default-constructible");
-
+NFD_ASSERT_FORWARD_ITERATOR(Iterator);
BOOST_CONCEPT_ASSERT((boost::ForwardRangeConcept<Range>));
NFD_LOG_INIT("NameTreeIterator");
diff --git a/daemon/table/pit-iterator.cpp b/daemon/table/pit-iterator.cpp
index b3b9afa..973342e 100644
--- a/daemon/table/pit-iterator.cpp
+++ b/daemon/table/pit-iterator.cpp
@@ -24,17 +24,12 @@
*/
#include "pit-iterator.hpp"
-
-#include <boost/concept/assert.hpp>
-#include <boost/concept_check.hpp>
-#include <type_traits>
+#include "core/asserts.hpp"
namespace nfd {
namespace pit {
-BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Iterator>));
-static_assert(std::is_default_constructible<Iterator>::value,
- "Iterator must be default-constructible");
+NFD_ASSERT_FORWARD_ITERATOR(Iterator);
Iterator::Iterator(const NameTree::const_iterator& ntIt, size_t iPitEntry)
: m_ntIt(ntIt)
diff --git a/daemon/table/strategy-choice.cpp b/daemon/table/strategy-choice.cpp
index d801870..06acaae 100644
--- a/daemon/table/strategy-choice.cpp
+++ b/daemon/table/strategy-choice.cpp
@@ -26,6 +26,7 @@
#include "strategy-choice.hpp"
#include "measurements-entry.hpp"
#include "pit-entry.hpp"
+#include "core/asserts.hpp"
#include "core/logger.hpp"
#include "fw/strategy.hpp"
@@ -34,6 +35,8 @@
using fw::Strategy;
+NFD_ASSERT_FORWARD_ITERATOR(StrategyChoice::const_iterator);
+
NFD_LOG_INIT("StrategyChoice");
static inline bool