Skip to content

Commit ee87036

Browse files
authored
impl(bigtable): add string literal constructor to Bytes (#15750)
1 parent 21fddfb commit ee87036

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

google/cloud/bigtable/bytes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class Bytes {
4444
/// An empty sequence.
4545
Bytes() = default;
4646

47+
/// Stops copying at the null-terminator character from input bytes.
48+
explicit Bytes(char const* bytes) : bytes_(bytes) {}
49+
4750
/// @name Construction from a sequence of octets.
4851
///@{
4952
template <typename InputIt>

google/cloud/bigtable/bytes_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ TEST(Bytes, OutputStream) {
105105
{Bytes(std::string("a\377B")), R"(B"a\377B")"},
106106
{Bytes(std::string("!@#$%^&*()-.")), R"(B"!@#$%^&*()-.")"},
107107
{Bytes(std::string(3, '\0')), R"(B"\000\000\000")"},
108-
{Bytes(""), R"(B"\000")"},
109-
{Bytes("foo"), R"(B"foo\000")"},
108+
{Bytes(""), R"(B"")"},
109+
{Bytes("foo"), R"(B"foo")"},
110110
};
111111

112112
for (auto const& tc : test_cases) {

0 commit comments

Comments
 (0)