npl: npls more conveniently instantiable
NPLs can now be instantiated using brace-init lists, as well as by passing
any iterator-capable container.
refs: #4345
Change-Id: Ib43373d5899d0ac14861027c34431fa928eec191
diff --git a/src/name-prefix-list.hpp b/src/name-prefix-list.hpp
index 8351b3b..0912fb3 100644
--- a/src/name-prefix-list.hpp
+++ b/src/name-prefix-list.hpp
@@ -40,6 +40,18 @@
NamePrefixList();
+ NamePrefixList(const std::initializer_list<ndn::Name>& names);
+
+ NamePrefixList(const std::initializer_list<NamePrefixList::NamePair>& namesAndSources);
+
+ template<class ContainerType>
+ NamePrefixList(const ContainerType& names)
+ {
+ for (const auto& elem : names) {
+ m_names.push_back(NamePair{elem, {""}});
+ }
+ }
+
~NamePrefixList();
/*! \brief inserts name into NamePrefixList