Merge pull request #412 from agnat/add_char_pointer_ctor

Fix #411 by adding a Value(const char *) constructor.
This commit is contained in:
Syoyo Fujita 2023-04-10 19:11:35 +09:00 committed by GitHub
commit a977f7a16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -301,6 +301,9 @@ class Value {
}
explicit Value(std::string &&s)
: type_(STRING_TYPE), string_value_(std::move(s)) {}
explicit Value(const char *s) : type_(STRING_TYPE) {
string_value_ = s;
}
explicit Value(const unsigned char *p, size_t n) : type_(BINARY_TYPE) {
binary_value_.resize(n);
memcpy(binary_value_.data(), p, n);