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:
Jørgen Kvalsvik
2016-04-12 16:00:37 +02:00
parent bfa3f799b9
commit 6b64796d49
8 changed files with 64 additions and 94 deletions

View File

@@ -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;
}