From 25360bb42cc22cf09f6e0dbe66dc386de62d49c6 Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Tue, 31 May 2016 15:46:29 +0300 Subject: [search] Removed the "search_" prefix where it was redundant. --- search/common.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 search/common.hpp (limited to 'search/common.hpp') diff --git a/search/common.hpp b/search/common.hpp new file mode 100644 index 0000000000..2bdc9300a6 --- /dev/null +++ b/search/common.hpp @@ -0,0 +1,20 @@ +#pragma once + +namespace search +{ +/// Upper bound for max count of tokens for indexing and scoring. +int constexpr MAX_TOKENS = 32; +int constexpr MAX_SUGGESTS_COUNT = 5; + +template +bool StartsWith(IterT1 beg, IterT1 end, IterT2 begPrefix, IterT2 endPrefix) +{ + while (beg != end && begPrefix != endPrefix && *beg == *begPrefix) + { + ++beg; + ++begPrefix; + } + return begPrefix == endPrefix; +} + +} // namespace search -- cgit v1.2.3