...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::interprocess::basic_vectorbuf
// In header: <boost/interprocess/interprocess_fwd.hpp> template<typename CharVector, typename CharTraits = std::char_traits<typename CharVector::value_type> > class basic_vectorbuf : public std::basic_streambuf< CharVector::value_type, CharTraits > { public: // construct/copy/destruct explicit basic_vectorbuf(std::ios_base::openmode = std::ios_base::in|std::ios_base::out); template<typename VectorParameter> explicit basic_vectorbuf(const VectorParameter &, std::ios_base::openmode = std::ios_base::in|std::ios_base::out); // public member functions void swap_vector(vector_type &); const vector_type & vector() const; void reserve(typename vector_type::size_type); void clear(); };
A streambuf class that controls the transmission of elements to and from a basic_ivectorstream, basic_ovectorstream or basic_vectorstream. It holds a character vector specified by CharVector template parameter as its formatting buffer. The vector must have contiguous storage, like std::vector, boost::interprocess::vector or boost::interprocess::basic_string
basic_vectorbuf
public
construct/copy/destructexplicit basic_vectorbuf(std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);
Constructor. Throws if vector_type default constructor throws.
template<typename VectorParameter> explicit basic_vectorbuf(const VectorParameter & param, std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);
Constructor. Throws if vector_type(const VectorParameter ¶m) throws.
basic_vectorbuf
public member functionsvoid swap_vector(vector_type & vect);
Swaps the underlying vector with the passed vector. This function resets the read/write position in the stream. Does not throw.
const vector_type & vector() const;
Returns a const reference to the internal vector. Does not throw.
void reserve(typename vector_type::size_type size);
Preallocates memory from the internal vector. Resets the stream to the first position. Throws if the internals vector's memory allocation throws.
void clear();
Calls clear() method of the internal vector. Resets the stream to the first position.