table: simplify StrategyChoice with C++11 features
refs #2100
Change-Id: If0082c8561d706df86e92c14cb87762962ff200b
diff --git a/daemon/table/strategy-choice-entry.hpp b/daemon/table/strategy-choice-entry.hpp
index d937b1c..857a313 100644
--- a/daemon/table/strategy-choice-entry.hpp
+++ b/daemon/table/strategy-choice-entry.hpp
@@ -57,11 +57,11 @@
getStrategy() const;
void
- setStrategy(shared_ptr<fw::Strategy> strategy);
+ setStrategy(fw::Strategy& strategy);
private:
Name m_prefix;
- shared_ptr<fw::Strategy> m_strategy;
+ fw::Strategy* m_strategy;
shared_ptr<name_tree::Entry> m_nameTreeEntry;
friend class nfd::NameTree;
@@ -78,10 +78,16 @@
inline fw::Strategy&
Entry::getStrategy() const
{
- BOOST_ASSERT(static_cast<bool>(m_strategy));
+ BOOST_ASSERT(m_strategy != nullptr);
return *m_strategy;
}
+inline void
+Entry::setStrategy(fw::Strategy& strategy)
+{
+ m_strategy = &strategy;
+}
+
} // namespace strategy_choice
} // namespace nfd