interest: add Interest::modifyForwardingHint

refs #4055

Change-Id: I3e245bcb5091659e0e9d89b18de604e42c906694
diff --git a/src/interest.hpp b/src/interest.hpp
index f772def..a00bbc0 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -205,6 +205,25 @@
   Interest&
   setForwardingHint(const DelegationList& value);
 
+  /** @brief modify ForwardingHint in-place
+   *  @tparam Modifier a unary function that accepts DelegationList&
+   *
+   *  This is equivalent to, but more efficient (avoids copying) than:
+   *  @code
+   *  auto fh = interest.getForwardingHint();
+   *  modifier(fh);
+   *  interest.setForwardingHint(fh);
+   *  @endcode
+   */
+  template<typename Modifier>
+  Interest&
+  modifyForwardingHint(const Modifier& modifier)
+  {
+    modifier(m_forwardingHint);
+    m_wire.reset();
+    return *this;
+  }
+
 public: // Selectors
   /**
    * @return true if Interest has any selector present