Name: Added constructor for string.
diff --git a/ndn-cpp/name.hpp b/ndn-cpp/name.hpp
index f39d568..32e001f 100644
--- a/ndn-cpp/name.hpp
+++ b/ndn-cpp/name.hpp
@@ -142,12 +142,21 @@
* Parse the uri according to the NDN URI Scheme and create the name with the components.
* @param uri The URI string.
*/
- Name(const char *uri)
+ Name(const char* uri)
{
set(uri);
}
/**
+ * Parse the uri according to the NDN URI Scheme and create the name with the components.
+ * @param uri The URI string.
+ */
+ Name(const std::string& uri)
+ {
+ set(uri.c_str());
+ }
+
+ /**
* Set the nameStruct to point to the components in this name, without copying any memory.
* WARNING: The resulting pointers in nameStruct are invalid after a further use of this object which could reallocate memory.
* @param nameStruct A C ndn_Name struct where the components array is already allocated.