Commit b6b647e6 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

small_vector<T>::get_allocator()

Summary:
[Folly] `small_vector<T>::get_allocator()` for compatibility with other container types.

While `small_vector` is not actually parameterizable over the allocator types, compatibility with generic interfaces such as the presorted-ctor interfaces of `sorted_vector_set` and `sorted_vector_map` require `get_allocator`.

Reviewed By: vitaut

Differential Revision: D15194509

fbshipit-source-id: 3a7842d5640f8e95a09c4cd8e2a9ab6ffc4fe9ac
parent 5e74cab3
......@@ -459,6 +459,7 @@ class small_vector : public detail::small_vector_base<
public:
typedef std::size_t size_type;
typedef Value value_type;
typedef std::allocator<Value> allocator_type;
typedef value_type& reference;
typedef value_type const& const_reference;
typedef value_type* iterator;
......@@ -562,6 +563,10 @@ class small_vector : public detail::small_vector_base<
: BaseType::policyMaxSize();
}
allocator_type get_allocator() {
return {};
}
size_type size() const {
return this->doSize();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment