@@ -236,7 +236,7 @@ ContextFreeCodeCompletionResult::getCodeCompletionOperatorKind(
236236 using CCOK = CodeCompletionOperatorKind;
237237 using OpPair = std::pair<StringRef, CCOK>;
238238
239- // This list must be kept in alphabetical order.
239+ // This list must be kept in lexicographic order.
240240 static OpPair ops[] = {
241241 std::make_pair (" !" , CCOK::Bang),
242242 std::make_pair (" !=" , CCOK::NotEq),
@@ -280,13 +280,12 @@ ContextFreeCodeCompletionResult::getCodeCompletionOperatorKind(
280280 std::make_pair (" ||" , CCOK::PipePipe),
281281 std::make_pair (" ~=" , CCOK::TildeEq),
282282 };
283- static auto opsSize = sizeof (ops) / sizeof (ops[0 ]);
284283
285284 auto I = std::lower_bound (
286- ops, & ops[opsSize] , std::make_pair (name, CCOK::None),
285+ std::begin ( ops), std::end ( ops) , std::make_pair (name, CCOK::None),
287286 [](const OpPair &a, const OpPair &b) { return a.first < b.first ; });
288287
289- if (I == & ops[opsSize] || I->first != name)
288+ if (I == std::end ( ops) || I->first != name)
290289 return CCOK::Unknown;
291290 return I->second ;
292291}
0 commit comments