Standard C++ Library User Guide and Tutorial
 typedef Allocator::types<T>::pointer iterator;
 typedef Allocator::types<T>const_pointer iterator;
protected:
 Allocator the_allocator; // copy of the allocator
private:
 size_type buffer_size;
 iterator buffer_start;
 iterator current_end;
 iterator end_of_buffer;
public:
 // A constructor that initializes the set using a range
 // from some other container or array
 template <class Iterator>
 set(Iterator start, Iterator finish,
 Allocator alloc = Allocator());
 iterator begin() { return buffer_start; }
 iterator end() { return current_end; } 
};
Given this class interface, here's a definition of a possible constructor that uses the allocator. The
numbered comments following this code briefly describe the allocator's role. For a fuller
treatment of allocators take a look at the Tutorial and Class Reference sections for allocators.
template <class T, class Allocator>
template <class Iterator>
set<T,Allocator>::set(Iterator start, Iterator finish,
 Allocator alloc) 
 : buffer_size(finish-start + DEFAULT_CUSHION), 
 buffer_start(0), 
 current_end(0), end_of_buffer(0)
{
 // copy the argument to our internal object
 the_allocator = alloc; // 1
 // Create an initial buffer
 buffer_start = the_allocator.allocate(buffer_size); // 2
 end_of_buffer = buffer_start + buffer_size;
 // construct new values from iterator range on the buffer
 for (current_end = buffer_start; 
 start != finish;
 current_end++, start++)










