Skip to content

Commit fccf28e

Browse files
slipherillwieckz
authored andcommitted
Add StringRef pointer + length constructor
1 parent 5c02408 commit fccf28e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/common/String.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ namespace Str {
5252
: ptr(other.c_str()), len(other.size()) {}
5353
BasicStringRef(const T* other)
5454
: ptr(other), len(std::char_traits<T>::length(other)) {}
55+
BasicStringRef(const T* start, size_t len)
56+
: ptr(start), len(len)
57+
{
58+
DAEMON_ASSERT_EQ(start[len], '\0');
59+
}
5560

5661
const T& operator[](size_t pos) const
5762
{

0 commit comments

Comments
 (0)