From 1fd7e80f044dde220d5332842ab25caf3374dddf Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 2 Mar 2016 13:32:35 +0000 Subject: [PATCH] Rename prefix to query in complete helper function and tweak static_assert --- src/completion.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/completion.hh b/src/completion.hh index 1cc219c0..e2ca294f 100644 --- a/src/completion.hh +++ b/src/completion.hh @@ -56,18 +56,18 @@ inline Completions offset_pos(Completions completion, ByteCount offset) } template -CandidateList complete(StringView prefix, ByteCount cursor_pos, +CandidateList complete(StringView query, ByteCount cursor_pos, const Container& container) { using std::begin; static_assert(not std::is_same::value, - "complete require long lived strings"); + "complete require long lived strings, not temporaries"); - prefix = prefix.substr(0, cursor_pos); + query = query.substr(0, cursor_pos); Vector matches; for (const auto& str : container) { - if (RankedMatch match{str, prefix}) + if (RankedMatch match{str, query}) matches.push_back(match); } std::sort(matches.begin(), matches.end());