add ostd::starts_with to string library

master
Daniel Kolesa 2015-12-31 16:36:41 +01:00
parent 31d3182a4a
commit 02e7ae76a2
1 changed files with 6 additions and 0 deletions

View File

@ -194,6 +194,12 @@ inline bool operator>=(ConstCharRange lhs, ConstCharRange rhs) {
return lhs.compare(rhs) >= 0;
}
inline bool starts_with(ConstCharRange a, ConstCharRange b) {
if (a.size() < b.size())
return false;
return a.slice(0, b.size()) == b;
}
template<typename T, typename A>
class StringBase {
using StrPair = detail::CompressedPair<AllocatorPointer<A>, A>;