Added StringRef constructor that captures string literal size at compile time
This commit is contained in:
parent
f36817ef83
commit
4353614df7
3 changed files with 13 additions and 9 deletions
|
@ -16,6 +16,11 @@
|
|||
#include <ostream>
|
||||
|
||||
namespace Catch {
|
||||
auto StringRef::fromRaw( char const* rawChars ) -> StringRef {
|
||||
return rawChars
|
||||
? StringRef( rawChars,static_cast<StringRef::size_type>(std::strlen(rawChars) ) )
|
||||
: StringRef();
|
||||
}
|
||||
|
||||
StringRef::operator std::string() const {
|
||||
return std::string( m_start, m_size );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue