summaryrefslogtreecommitdiff
path: root/src/mongo/db/fts/unicode/string.cpp
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2017-09-17 20:44:47 +0200
committerAndrew Morrow <acm@mongodb.com>2017-09-20 11:10:18 -0400
commit8a5656c58c18e7c23d5bec6f9b2d41013ee80a47 (patch)
tree4344d5905c292091013ef96d50f14e7b29964b1a /src/mongo/db/fts/unicode/string.cpp
parentb5f2acfe24d1a6363dbcfb558b5baf00684f70e8 (diff)
downloadmongo-8a5656c58c18e7c23d5bec6f9b2d41013ee80a47.tar.gz
SERVER-31119 Make string.cpp compatible with boost 1.62
Add a conditional for boost > 1.62 compatibility, boyer_moore_search now returns an std::pair. Signed-off-by: Andrew Morrow <acm@mongodb.com>
Diffstat (limited to 'src/mongo/db/fts/unicode/string.cpp')
-rw-r--r--src/mongo/db/fts/unicode/string.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/fts/unicode/string.cpp b/src/mongo/db/fts/unicode/string.cpp
index 10737acc3ed..8c1890f3669 100644
--- a/src/mongo/db/fts/unicode/string.cpp
+++ b/src/mongo/db/fts/unicode/string.cpp
@@ -30,6 +30,7 @@
#include <algorithm>
#include <boost/algorithm/searching/boyer_moore.hpp>
+#include <boost/version.hpp>
#include "mongo/db/fts/unicode/byte_vector.h"
#include "mongo/platform/bits.h"
@@ -272,9 +273,15 @@ bool String::substrMatch(const std::string& str,
auto haystack = caseFoldAndStripDiacritics(&haystackBuf, str, options, cfMode);
auto needle = caseFoldAndStripDiacritics(&needleBuf, find, options, cfMode);
- // Case sensitive and diacritic sensitive.
+// Case sensitive and diacritic sensitive.
+#if BOOST_VERSION < 106200
return boost::algorithm::boyer_moore_search(
haystack.begin(), haystack.end(), needle.begin(), needle.end()) != haystack.end();
+#else
+ return boost::algorithm::boyer_moore_search(
+ haystack.begin(), haystack.end(), needle.begin(), needle.end()) !=
+ std::make_pair(haystack.end(), haystack.end());
+#endif
}
} // namespace unicode