Added an overload taking string literals to BasicStringRef

This commit is contained in:
Márton Danóczy 2014-10-29 12:18:16 +01:00 committed by Márton Danóczy
parent d5a6316d5c
commit ab7ef47a37

View File

@ -172,7 +172,14 @@ class BasicStringRef {
If *size* is zero, which is the default, the size is computed If *size* is zero, which is the default, the size is computed
automatically. automatically.
*/ */
BasicStringRef(const Char *s, std::size_t size = 0) : data_(s), size_(size) {} BasicStringRef(const Char* const& s, std::size_t size = 0) : data_(s), size_(size) {}
/**
Constructs a string reference object from a C string literal,
if its size is determinable at compile time.
*/
template <std::size_t N>
BasicStringRef(const Char (&s) [N]) : data_(s), size_(N) {}
/** /**
Constructs a string reference from an `std::string` object. Constructs a string reference from an `std::string` object.