#pragma once
#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iterator>
#include <memory>
#include <stdexcept>
#include <type_traits>
#include <utility>
#include <boost/operators.hpp>
#include <folly/ConstexprMath.h>
#include <folly/FormatTraits.h>
#include <folly/Likely.h>
#include <folly/Portability.h>
#include <folly/ScopeGuard.h>
#include <folly/Traits.h>
#include <folly/functional/Invoke.h>
#include <folly/hash/Hash.h>
#include <folly/lang/Align.h>
#include <folly/lang/Assume.h>
#include <folly/lang/CheckedMath.h>
#include <folly/lang/Exception.h>
#include <folly/memory/Malloc.h>
#include <folly/memory/SanitizeLeak.h>
#include <folly/portability/Malloc.h>
#if (FOLLY_X64 || FOLLY_PPC64 || FOLLY_AARCH64 || FOLLY_RISCV64)
#define FOLLY_SV_PACK_ATTR …
#define FOLLY_SV_PACK_PUSH …
#define FOLLY_SV_PACK_POP …
#else
#define FOLLY_SV_PACK_ATTR
#define FOLLY_SV_PACK_PUSH
#define FOLLY_SV_PACK_POP
#endif
FOLLY_PUSH_WARNING
FOLLY_GNU_DISABLE_WARNING(…)
namespace folly {
namespace small_vector_policy {
namespace detail {
struct item_size_type { … };
struct item_in_situ_only { … };
template <template <typename> class F, typename... T>
constexpr size_t last_matching_() { … }
template <size_t M, typename I, typename... P>
struct merge_
: I::template set<typename I::template get<
type_pack_element_t<sizeof...(P) - M, P...>>> {};
merge_<0, I, P...>;
merge;
}
template <typename... Policy>
struct merge
: detail::merge<detail::item_size_type, Policy...>,
detail::merge<detail::item_in_situ_only, Policy...> { … };
template <typename SizeType>
struct policy_size_type { … };
template <bool Value>
struct policy_in_situ_only { … };
}
template <class T, std::size_t M, class P>
class small_vector;
namespace detail {
template <class T, class Create>
typename std::enable_if<!std::is_trivially_copyable_v<T>>::type
moveObjectsRightAndCreate(
T* const first,
T* const lastConstructed,
T* const realLast,
Create&& create) { … }
template <class T, class Create>
typename std::enable_if<std::is_trivially_copyable_v<T>>::type
moveObjectsRightAndCreate(
T* const first,
T* const lastConstructed,
T* const realLast,
Create&& create) { … }
template <class T, class Function>
void populateMemForward(T* mem, std::size_t n, Function const& op) { … }
template <class Iterator1, class Iterator2>
void partiallyUninitializedCopy(
Iterator1 from, size_t fromSize, Iterator2 to, size_t toSize) { … }
template <class SizeType, bool ShouldUseHeap, bool AlwaysUseHeap>
struct IntegralSizePolicyBase { … };
template <class SizeType, bool ShouldUseHeap, bool AlwaysUseHeap>
struct IntegralSizePolicy;
IntegralSizePolicy<SizeType, true, AlwaysUseHeap>;
IntegralSizePolicy<SizeType, false, AlwaysUseHeap>;
template <class Value, std::size_t RequestedMaxInline, class InPolicy>
struct small_vector_base { … };
inline void* unshiftPointer(void* p, size_t sizeBytes) { … }
inline void* shiftPointer(void* p, size_t sizeBytes) { … }
}
template <class Value, std::size_t RequestedMaxInline = 1, class Policy = void>
class small_vector
: public detail::small_vector_base<Value, RequestedMaxInline, Policy>::
type { … };
template <class T, std::size_t MaxInline, class P>
void swap(small_vector<T, MaxInline, P>& a, small_vector<T, MaxInline, P>& b) { … }
template <class T, std::size_t MaxInline, class P, class U>
void erase(small_vector<T, MaxInline, P>& v, U value) { … }
template <class T, std::size_t MaxInline, class P, class Predicate>
void erase_if(small_vector<T, MaxInline, P>& v, Predicate predicate) { … }
namespace detail {
IndexableTraits<small_vector<T, M, P>>;
}
}
FOLLY_POP_WARNING
#undef FOLLY_SV_PACK_ATTR
#undef FOLLY_SV_PACK_PUSH
#undef FOLLY_SV_PACK_POP
namespace std {
hash<folly::small_vector<T, M, P>>;
}