c – 生成容器的成员类型
发布时间:2020-12-16 06:55:49  所属栏目:百科  来源:网络整理 
            导读:当我定义自己的容器时,我必须提供十几种成员类型,例如: typedef T reference; typedef const T const_reference; typedef T* iterator; typedef const T* const_iterator; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef
                
                
                
            | 
                         
 当我定义自己的容器时,我必须提供十几种成员类型,例如: 
  
  
  
typedef T& reference;
    typedef const T& const_reference;
    typedef T* iterator;
    typedef const T* const_iterator;
    typedef std::size_t size_type;
    typedef std::ptrdiff_t difference_type;
    typedef T value_type;
    typedef T* pointer;
    typedef const T* const_pointer;
    typedef std::reverse_iterator<iterator> reverse_iterator;
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 
 是否有可以继承的基类模板,类似于std :: iterator< T>对于我自己的迭代器? 解决方法
 有针对此特定需求的boost :: iterator. 
  
  
        我希望本教程能让事情变得清晰http://www.boost.org/doc/libs/1_46_0/libs/iterator/doc/iterator_facade.html#tutorial-example (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!  | 
                  
