CUJ:标准库:Allocator能做什么?[9]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 taodm 的 blog

     

      typedef typename allocator::reference reference;

      typedef typename allocator::const_reference

              const_reference;

      typedef typename allocator::size_type size_type;

      typedef typename allocator::difference_type

              difference_type;

      typedef typename allocator::pointer       iterator;

      typedef typename allocator::const_pointer const_iterator;

      typedef allocator allocator_type;

      allocator_type get_allocator() const {

        return static_cast<const allocator&>(*this);

      }

      iterator begin()             { return first; }

      iterator end()               { return last; }

      const_iterator begin() const { return first; }

      const_iterator end() const   { return last; }

本文关键:CUJ、allocator、STL、Matt Austern
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top