1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-26 04:52:53 +03:00

use StringView in word_db.cc

This commit is contained in:
Maxime Coste 2014-05-11 12:51:37 +01:00
parent f4d338e605
commit daac1698d6

View File

@ -6,12 +6,12 @@
namespace Kakoune namespace Kakoune
{ {
static std::vector<String> get_words(const String& content) static std::vector<String> get_words(StringView content)
{ {
std::vector<String> res; std::vector<String> res;
using Iterator = utf8::utf8_iterator<String::const_iterator, using Iterator = utf8::utf8_iterator<const char*,
utf8::InvalidBytePolicy::Pass>; utf8::InvalidBytePolicy::Pass>;
auto word_start = content.begin(); const char* word_start = content.begin();
bool in_word = false; bool in_word = false;
for (Iterator it{word_start}, end{content.end()}; it != end; ++it) for (Iterator it{word_start}, end{content.end()}; it != end; ++it)
{ {