Home | Libraries | People | FAQ | More |
boost::container::small_vector_base
// In header: <boost/container/small_vector.hpp> template<typename T, typename SecondaryAllocator> class small_vector_base : public boost::container::vector< T, small_vector_allocator< T, allocator_traits< real_allocator< T, SecondaryAllocator >::type >::template portable_rebind_alloc< void >::type > > { public: // types typedef real_allocator< T, SecondaryAllocator >::type secondary_allocator_t; typedef allocator_traits< secondary_allocator_t >::template portable_rebind_alloc< void >::type void_allocator_t; typedef vector< T, small_vector_allocator< T, void_allocator_t > > base_type; typedef allocator_traits< secondary_allocator_t >::pointer pointer; typedef allocator_traits< secondary_allocator_t >::const_pointer const_pointer; typedef allocator_traits< secondary_allocator_t >::void_pointer void_pointer; typedef allocator_traits< secondary_allocator_t >::const_void_pointer const_void_pointer; typedef small_vector_allocator< T, void_allocator_t > allocator_type; typedef dtl::aligned_storage< sizeof(T), dtl::alignment_of< T >::value >::type storage_type; // construct/copy/destruct explicit small_vector_base(initial_capacity_t, std::size_t); template<typename AllocFwd> explicit small_vector_base(initial_capacity_t, std::size_t, AllocFwd &&); small_vector_base & operator=(const small_vector_base &); small_vector_base & operator=(small_vector_base &&); // private member functions const_pointer internal_storage() const noexcept; pointer internal_storage() noexcept; base_type & as_base(); const base_type & as_base() const; // public member functions void swap(small_vector_base &); };
This class consists of common code from all small_vector<T, N> types that don't depend on the "N" template parameter. This class is non-copyable and non-destructible, so this class typically used as reference argument to functions that read or write small vectors. Since small_vector<T, N>
derives from small_vector_base<T>
, the conversion to small_vector_base
is implicit
//Clients can pass any small_vector<Foo, N>. void read_any_small_vector_of_foo(const small_vector_base<Foo> &in_parameter); void modify_any_small_vector_of_foo(small_vector_base<Foo> &in_out_parameter); void some_function() { small_vector<Foo, 8> myvector; read_any_small_vector_of_foo(myvector); // Reads myvector modify_any_small_vector_of_foo(myvector); // Modifies myvector }
All boost::container:vector
member functions are inherited. See vector
documentation for details.
small_vector_base
public
construct/copy/destructexplicit small_vector_base(initial_capacity_t, std::size_t initial_capacity);
template<typename AllocFwd> explicit small_vector_base(initial_capacity_t, std::size_t capacity, AllocFwd && a);
small_vector_base & operator=(const small_vector_base & other);
small_vector_base & operator=(small_vector_base && other);