| Output Iterator | Used to implement the Output Iterator requirement *i = t. [2] |
sequence_buffer& operator*() | Output Iterator | Used to implement the Output Iterator requirement *i = t. [2] |
sequence_buffer& operator++() | Output Iterator | Preincrement |
sequence_buffer& operator++(int) | Output Iterator | Postincrement |
void flush() | sequence_buffer | Flush the buffer. |
void push_back(value_type) | sequence_buffer | i.push_back(x) is equivalent to *i = x. |
void append(value_type* s, size_t len) | sequence_buffer | Append multiple values. |
New members These members are not defined in the Output Iterator requirements, but are specific to sequence_buffer.
| Function | Description |
value_type | The underlying container's value type. That is, typename Container::value_type. |
sequence_buffer(Container& C) | Create a sequence_buffer whose underlying container is C. Elements appended to the sequence_buffer will be appended to C whenever the sequence_buffer is flushed. |
void flush() | Append all elements in the buffer to the underlying container, and empty the buffer. That is, make the underlying container consistent with the sequence_buffer. Note that flush is called automatically whenever the buffer is full, and also by sequence_buffer's destructor. Sometimes, however, it is useful to be sure that the buffer is flushed at a particular time. |
void push_back(value_type x) | Append x to the sequence_buffer. Note that this member function is strictly unnecessary: i.push_back(x) is just alternate syntax for *i = x. |
void append(value_type* s, size_t len) | Append the range [s, s + len) to the sequence_buffer. Note that i.append(s, n) is just the same as copy(s, s + n, i). The append member function, however, is faster. |
Notes [1] Despite the name 'sequence_buffer', this adaptor cannot actually be used with arbitrary sequences: it requires that the template argument Container have an append member function that can insert multiple elements at the end of the container. This member function is not part of the Sequence requirements. This means that sequence_buffer can be used with rope, but not with any of the other predefined container classes.
[2] Note how assignment through a sequence_buffer is implemented. In general, unary operator* must be defined so that it returns a proxy object, where the proxy object defines operator= to perform the output operation. In this case, for the sake of simplicity, the proxy object is the sequence_buffer itself. That is, *i simply returns i, and *i = t is equivalent to i = t. You should not, however, rely on this behavior. It is an implementation detail, and it is not guaranteed to remain the same in future versions.
See also Output Iterator, rope, front_insert_iterator, back_insert_iterator, insert_iterator