util/StringView: add struct BasicStringView

This commit is contained in:
Max Kellermann
2017-09-12 17:03:40 +02:00
parent 96b557c1f0
commit 5dbdd36263
2 changed files with 48 additions and 25 deletions

View File

@@ -30,16 +30,20 @@
#include "StringView.hxx"
#include "CharUtil.hxx"
template<typename T>
void
StringView::StripLeft() noexcept
BasicStringView<T>::StripLeft() noexcept
{
while (!IsEmpty() && IsWhitespaceOrNull(front()))
pop_front();
}
template<typename T>
void
StringView::StripRight() noexcept
BasicStringView<T>::StripRight() noexcept
{
while (!IsEmpty() && IsWhitespaceOrNull(back()))
pop_back();
}
template struct BasicStringView<char>;