Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class template small_vector_base

boost::container::small_vector_base

Synopsis

// In header: <boost/container/small_vector.hpp>

template<typename T, typename SecAlloc, typename Options> 
class small_vector_base {
public:

  // private member functions
  void prot_swap(small_vector_base &, size_type);

  // public member functions
  small_vector_base & operator=(const small_vector_base &);
  small_vector_base & operator=(small_vector_base &&);
  void swap(small_vector_base &);
};

Description

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 private member functions

  1. void prot_swap(small_vector_base & other, size_type internal_capacity_value);

small_vector_base public member functions

  1. small_vector_base & operator=(const small_vector_base & other);
  2. small_vector_base & operator=(small_vector_base && other);
  3. void swap(small_vector_base & other);

PrevUpHomeNext