diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-02-10 13:33:49 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-02-10 13:33:49 +0000 |
| commit | 8701a53252cbcd54e33ffe9f9257aadcde95c8aa (patch) | |
| tree | 906e6eef40322c1c58865c44c36a763771f54f02 /src/completion.hh | |
| parent | 8d37a716fbf83cd58a026d70a293cb30f972ecaa (diff) | |
Fix use of dead temporary strings in completions
Diffstat (limited to 'src/completion.hh')
| -rw-r--r-- | src/completion.hh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/completion.hh b/src/completion.hh index 47b08c73..1cc219c0 100644 --- a/src/completion.hh +++ b/src/completion.hh @@ -59,6 +59,10 @@ template<typename Container> CandidateList complete(StringView prefix, ByteCount cursor_pos, const Container& container) { + using std::begin; + static_assert(not std::is_same<decltype(*begin(container)), String>::value, + "complete require long lived strings"); + prefix = prefix.substr(0, cursor_pos); Vector<RankedMatch> matches; for (const auto& str : container) |
