草庐IT

m_currentOuter

全部标签

c++ - 迭代封装的嵌套 STL 容器

这是一个相当正常的STL容器封装,它允许Cfoo的用户在不允许更改内部结构的情况下迭代容器。#includeclassCfoo{public:classCbar{/*contentsofCbar*/};typedefstd::vectorTbarVector;typedefTbarVector::const_iteratorconst_iterator;public:const_iteratorbegin()const{return(barVector_.begin());}const_iteratorend()const{return(barVector_.end());}priva