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.cpp b/src/name-prefix-list.cpp
index 7df0eef..486e350 100644
--- a/src/name-prefix-list.cpp
+++ b/src/name-prefix-list.cpp
@@ -34,6 +34,21 @@
 {
 }
 
+NamePrefixList::NamePrefixList(const std::initializer_list<ndn::Name>& names)
+{
+  std::vector<NamePrefixList::NamePair> namePairs;
+  std::transform(names.begin(), names.end(), std::back_inserter(namePairs),
+    [] (const ndn::Name& name) {
+      return NamePrefixList::NamePair{name, {""}};
+    });
+  m_names = std::move(namePairs);
+}
+
+NamePrefixList::NamePrefixList(const std::initializer_list<NamePrefixList::NamePair>& namesAndSources)
+  : m_names(namesAndSources)
+{
+}
+
 NamePrefixList::~NamePrefixList()
 {
 }