Add char* constructor to string_view
Mostly relevant for testing, this enables string_view to work as expected with string literals.
This commit is contained in:
@@ -54,6 +54,7 @@ namespace Opm {
|
||||
inline string_view( const_iterator, size_t );
|
||||
inline string_view( const std::string& );
|
||||
inline string_view( const std::string&, size_t );
|
||||
inline string_view( const char* );
|
||||
|
||||
inline const_iterator begin() const;
|
||||
inline const_iterator end() const;
|
||||
@@ -166,6 +167,10 @@ namespace Opm {
|
||||
string_view( str.data(), count )
|
||||
{}
|
||||
|
||||
inline string_view::string_view( const char* str ) :
|
||||
string_view( str, str + std::strlen( str ) + 1 )
|
||||
{}
|
||||
|
||||
inline string_view::const_iterator string_view::begin() const {
|
||||
return this->fst;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user