Index: net/der/input.h |
diff --git a/net/der/input.h b/net/der/input.h |
index 6731b0c0600afd22f623141252b7e2b58d413061..9732ce7e258026a185b9976d519228b43b943f9f 100644 |
--- a/net/der/input.h |
+++ b/net/der/input.h |
@@ -46,12 +46,18 @@ class NET_EXPORT_PRIVATE Input { |
explicit Input(const uint8_t(&data)[N]) |
: data_(data), len_(N) {} |
+ // Creates an Input from a null-terminated constant char array |data|. This is |
+ // provided as a factory method instead of a constructor to avoid confusion |
+ // with the similar constructor above which takes an array of uint8_t which is |
+ // not null terminated. |
+ template <size_t N> |
+ static Input FromCString(const char(&data)[N]) { |
+ return Input(reinterpret_cast<const uint8_t*>(data), N - 1); |
+ } |
Ryan Sleevi
2015/05/26 18:53:30
Strictly on a STYLE basis, this shouldn't be inter
|
+ |
// Creates an Input from the given |data| and |len|. |
Input(const uint8_t* data, size_t len); |
- // Creates an Input from the given string |s|. |
- explicit Input(const std::string& s); |
- |
// Returns the length in bytes of an Input's data. |
size_t Length() const { return len_; } |