namespace folly {
-/**
- * Predicates that can be used with qfind and startsWith
- */
-const AsciiCaseSensitive asciiCaseSensitive = AsciiCaseSensitive();
-const AsciiCaseInsensitive asciiCaseInsensitive = AsciiCaseInsensitive();
-
namespace {
// It's okay if pages are bigger than this (as powers of two), but they should
PAGE_FOR(haystack.end() - 1) != PAGE_FOR(haystack.data() + 16)) {
// We can't safely SSE-load haystack. Use a different approach.
if (haystack.size() <= 2) {
- return qfind_first_of(haystack, needles, asciiCaseSensitive);
+ return qfind_first_of(haystack, needles, AsciiCaseSensitive());
}
return qfind_first_byte_of_byteset(haystack, needles);
}
needles.size() >= 32) {
return qfind_first_byte_of_byteset(haystack, needles);
}
- return qfind_first_of(haystack, needles, asciiCaseSensitive);
+ return qfind_first_of(haystack, needles, AsciiCaseSensitive());
}
} // namespace detail
}
};
-extern const AsciiCaseSensitive asciiCaseSensitive;
-extern const AsciiCaseInsensitive asciiCaseInsensitive;
-
template <class T>
size_t qfind(const Range<T>& haystack,
const typename Range<T>::value_type& needle) {
template <class T>
size_t qfind_first_of(const Range<T>& haystack,
const Range<T>& needles) {
- return qfind_first_of(haystack, needles, asciiCaseSensitive);
+ return qfind_first_of(haystack, needles, AsciiCaseSensitive());
}
// specialization for StringPiece
// it's useful to compare our custom implementations vs. the standard library
inline size_t qfind_first_byte_of_std(const StringPiece haystack,
const StringPiece needles) {
- return qfind_first_of(haystack, needles, asciiCaseSensitive);
+ return qfind_first_of(haystack, needles, AsciiCaseSensitive());
}
template <class Func>