#pragma once
#include <folly/Portability.h>
#include <folly/hash/SpookyHashV2.h>
#include <folly/lang/CString.h>
#include <folly/lang/Exception.h>
#include <folly/portability/Constexpr.h>
#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cstddef>
#include <cstring>
#include <iosfwd>
#include <iterator>
#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
#if __has_include(<fmt/format.h>)
#include <fmt/format.h>
#endif
#include <folly/CpuId.h>
#include <folly/Likely.h>
#include <folly/Traits.h>
#include <folly/detail/RangeCommon.h>
#include <folly/detail/RangeSse42.h>
FOLLY_PUSH_WARNING
FOLLY_GNU_DISABLE_WARNING(…)
namespace folly {
template <class T>
struct IsSomeString : std::false_type { … };
IsSomeString<std::basic_string<char, std::char_traits<char>, Alloc>>;
template <class Iter>
class Range;
template <
class Iter,
class Comp = std::equal_to<typename Range<Iter>::value_type>>
inline size_t qfind(
const Range<Iter>& haystack, const Range<Iter>& needle, Comp eq = Comp());
template <class Iter>
size_t qfind(
const Range<Iter>& haystack,
const typename Range<Iter>::value_type& needle);
template <class Iter>
size_t rfind(
const Range<Iter>& haystack,
const typename Range<Iter>::value_type& needle);
template <class Iter>
inline size_t qfind_first_of(
const Range<Iter>& haystack, const Range<Iter>& needle);
namespace detail {
template <class T>
struct IsCharPointer { … };
template <>
struct IsCharPointer<char*> { … };
template <>
struct IsCharPointer<const char*> { … };
template <class T>
struct IsUnsignedCharPointer { … };
template <>
struct IsUnsignedCharPointer<unsigned char*> { … };
template <>
struct IsUnsignedCharPointer<const unsigned char*> { … };
void range_is_char_type_f_(char const*);
void range_is_char_type_f_(wchar_t const*);
#if (defined(__cpp_char8_t) && __cpp_char8_t >= 201811L) || \
FOLLY_CPLUSPLUS >= 202002
void range_is_char_type_f_(char8_t const*);
#endif
void range_is_char_type_f_(char16_t const*);
void range_is_char_type_f_(char32_t const*);
range_is_char_type_d_;
range_is_char_type_v_;
void range_is_byte_type_f_(unsigned char const*);
void range_is_byte_type_f_(signed char const*);
void range_is_byte_type_f_(std::byte const*);
range_is_byte_type_d_;
range_is_byte_type_v_;
struct range_traits_char_ { … };
struct range_traits_byte_ { … };
struct range_traits_fbck_ { … };
range_traits_c_;
range_traits_t_;
}
template <class Iter>
class Range { … };
template <class Iter>
const typename Range<Iter>::size_type Range<Iter>::npos = …;
template <class Iter>
void swap(Range<Iter>& lhs, Range<Iter>& rhs) { … }
template <class Iter>
constexpr Range<Iter> range(Iter first, Iter last) { … }
template <class Collection>
constexpr auto range(Collection& v) -> Range<decltype(v.data())> { … }
template <class Collection>
constexpr auto range(Collection const& v) -> Range<decltype(v.data())> { … }
template <class Collection>
constexpr auto crange(Collection const& v) -> Range<decltype(v.data())> { … }
template <class T, size_t n>
constexpr Range<T*> range(T (&array)[n]) { … }
template <class T, size_t n>
constexpr Range<T const*> range(T const (&array)[n]) { … }
template <class T, size_t n>
constexpr Range<T const*> crange(T const (&array)[n]) { … }
template <class T, size_t n>
constexpr Range<T*> range(std::array<T, n>& array) { … }
template <class T, size_t n>
constexpr Range<T const*> range(std::array<T, n> const& array) { … }
template <class T, size_t n>
constexpr Range<T const*> crange(std::array<T, n> const& array) { … }
template <class T>
constexpr Range<T const*> range(std::initializer_list<T> ilist) { … }
template <class T>
constexpr Range<T const*> crange(std::initializer_list<T> ilist) { … }
StringPiece;
MutableStringPiece;
ByteRange;
MutableByteRange;
template <class C>
std::basic_ostream<C>& operator<<(
std::basic_ostream<C>& os, Range<C const*> piece) { … }
template <class C>
std::basic_ostream<C>& operator<<(std::basic_ostream<C>& os, Range<C*> piece) { … }
template <class Iter>
inline bool operator==(const Range<Iter>& lhs, const Range<Iter>& rhs) { … }
template <class Iter>
inline bool operator!=(const Range<Iter>& lhs, const Range<Iter>& rhs) { … }
template <class Iter>
inline bool operator<(const Range<Iter>& lhs, const Range<Iter>& rhs) { … }
template <class Iter>
inline bool operator<=(const Range<Iter>& lhs, const Range<Iter>& rhs) { … }
template <class Iter>
inline bool operator>(const Range<Iter>& lhs, const Range<Iter>& rhs) { … }
template <class Iter>
inline bool operator>=(const Range<Iter>& lhs, const Range<Iter>& rhs) { … }
namespace detail {
template <class A, class B>
struct ComparableAsStringPiece { … };
}
template <class T, class U>
std::enable_if_t<detail::ComparableAsStringPiece<T, U>::value, bool> operator==(
const T& lhs, const U& rhs) { … }
template <class T, class U>
std::enable_if_t<detail::ComparableAsStringPiece<T, U>::value, bool> operator!=(
const T& lhs, const U& rhs) { … }
template <class T, class U>
std::enable_if_t<detail::ComparableAsStringPiece<T, U>::value, bool> operator<(
const T& lhs, const U& rhs) { … }
template <class T, class U>
std::enable_if_t<detail::ComparableAsStringPiece<T, U>::value, bool> operator>(
const T& lhs, const U& rhs) { … }
template <class T, class U>
std::enable_if_t<detail::ComparableAsStringPiece<T, U>::value, bool> operator<=(
const T& lhs, const U& rhs) { … }
template <class T, class U>
std::enable_if_t<detail::ComparableAsStringPiece<T, U>::value, bool> operator>=(
const T& lhs, const U& rhs) { … }
template <class Iter, class Comp>
size_t qfind(const Range<Iter>& haystack, const Range<Iter>& needle, Comp eq) { … }
namespace detail {
inline size_t qfind_first_byte_of(
const StringPiece haystack, const StringPiece needles) { … }
}
template <class Iter, class Comp>
size_t qfind_first_of(
const Range<Iter>& haystack, const Range<Iter>& needles, Comp eq) { … }
struct AsciiCaseSensitive { … };
struct AsciiCaseInsensitive { … };
template <class Iter>
size_t qfind(
const Range<Iter>& haystack,
const typename Range<Iter>::value_type& needle) { … }
template <class Iter>
size_t rfind(
const Range<Iter>& haystack,
const typename Range<Iter>::value_type& needle) { … }
template <>
inline size_t qfind(const Range<const char*>& haystack, const char& needle) { … }
template <>
inline size_t rfind(const Range<const char*>& haystack, const char& needle) { … }
template <>
inline size_t qfind(
const Range<const unsigned char*>& haystack, const unsigned char& needle) { … }
template <>
inline size_t rfind(
const Range<const unsigned char*>& haystack, const unsigned char& needle) { … }
template <class Iter>
size_t qfind_first_of(const Range<Iter>& haystack, const Range<Iter>& needles) { … }
template <>
inline size_t qfind_first_of(
const Range<const char*>& haystack, const Range<const char*>& needles) { … }
template <>
inline size_t qfind_first_of(
const Range<const unsigned char*>& haystack,
const Range<const unsigned char*>& needles) { … }
template <class Key, class Enable>
struct hasher;
hasher<folly::Range<T *>, std::enable_if_t<std::is_integral<T>::value, void>>;
inline namespace literals {
inline namespace string_piece_literals {
constexpr Range<char const*> operator""_sp(
char const* str, size_t len) noexcept { … }
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
constexpr Range<char8_t const*> operator""_sp(
char8_t const* str, size_t len) noexcept {
return Range<char8_t const*>(str, len);
}
#endif
constexpr Range<char16_t const*> operator""_sp(
char16_t const* str, size_t len) noexcept { … }
constexpr Range<char32_t const*> operator""_sp(
char32_t const* str, size_t len) noexcept { … }
constexpr Range<wchar_t const*> operator""_sp(
wchar_t const* str, size_t len) noexcept { … }
}
}
}
#if FMT_VERSION >= 70000
namespace fmt {
template <>
struct formatter<folly::StringPiece> : private formatter<string_view> { … };
}
#endif
FOLLY_POP_WARNING
FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(…)
#if __has_include(<range/v3/range/concepts.hpp>) && defined(_MSC_VER)
#include <range/v3/range/concepts.hpp>
#else
namespace ranges {
enable_view;
}
#endif
namespace ranges {
enable_view;
}