From 4f54739ab6a65f93851f0568c31cecc10f9b2325 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Thu, 30 Apr 2020 21:09:53 +0200 Subject: [PATCH] Add substr() method. It looks correct to me. Fingers crossed! --- src/wren/string_bt.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wren/string_bt.hpp b/src/wren/string_bt.hpp index 39def96..3fe671c 100644 --- a/src/wren/string_bt.hpp +++ b/src/wren/string_bt.hpp @@ -48,6 +48,7 @@ namespace dhandy { constexpr string operator+ ( const string& parOther ) const; constexpr value_type operator[] ( std::size_t parIndex ) const; constexpr bool operator== (const string& other) const; + template constexpr auto substr() const; template constexpr bool operator== (const string&) const { return false; } template @@ -122,6 +123,12 @@ namespace dhandy { constexpr bool string::operator== (const string& other) const { return implem::eq(*this, other); } + + template + template + constexpr auto string::substr() const { + return string(m_data + std::min(Start, S - 1)) + make_string(""); + } } //namespace bt } //namespace dhandy