#include <string>
#include <utility>
-#include <folly/Hash.h>
-#include <folly/Malloc.h>
#include <folly/Traits.h>
+#include <folly/hash/Hash.h>
+#include <folly/memory/Malloc.h>
#include <folly/portability/BitsFunctexcept.h>
// When used in folly, assertions are not disabled.
#ifdef _LIBSTDCXX_FBSTRING
template <typename E, class T, class A, class Storage>
#else
-template <typename E,
- class T = std::char_traits<E>,
- class A = std::allocator<E>,
- class Storage = fbstring_core<E> >
+template <
+ typename E,
+ class T = std::char_traits<E>,
+ class A = std::allocator<E>,
+ class Storage = fbstring_core<E>>
#endif
class basic_fbstring {
static void enforce(
}
basic_fbstring& assign(const basic_fbstring& str) {
- if (&str == this) return *this;
+ if (&str == this) {
+ return *this;
+ }
return assign(str.data(), str.size());
}
}
const_iterator i(begin() + pos), finish(end());
for (; i != finish; ++i) {
- if (traits_type::find(s, n, *i) != 0) {
+ if (traits_type::find(s, n, *i) != nullptr) {
return i - begin();
}
}
pos = std::min(pos, length() - 1);
const_iterator i(begin() + pos);
for (;; --i) {
- if (traits_type::find(s, n, *i) != 0) {
+ if (traits_type::find(s, n, *i) != nullptr) {
return i - begin();
}
if (i == begin()) {
if (pos < length()) {
const_iterator i(begin() + pos), finish(end());
for (; i != finish; ++i) {
- if (traits_type::find(s, n, *i) == 0) {
+ if (traits_type::find(s, n, *i) == nullptr) {
return i - begin();
}
}
pos = std::min(pos, size() - 1);
const_iterator i(begin() + pos);
for (;; --i) {
- if (traits_type::find(s, n, *i) == 0) {
+ if (traits_type::find(s, n, *i) == nullptr) {
return i - begin();
}
if (i == begin()) {
FOLLY_FBSTRING_HASH
-} // namespace std
+} // namespace std
#undef FOLLY_FBSTRING_HASH
#undef FOLLY_FBSTRING_HASH1
#undef FBSTRING_LIKELY
#undef FBSTRING_UNLIKELY
#undef FBSTRING_ASSERT
+
+#ifndef _LIBSTDCXX_FBSTRING
+namespace folly {
+template <class T>
+struct IsSomeString;
+
+template <>
+struct IsSomeString<fbstring> : std::true_type {};
+} // namespace folly
+#endif