正在加载图片...
From pointers to iterators(cont,) J Request 2 u Let the previous findo function support any data types that having test equivalence operator(==) defined template <typename Elem Type> ElemType* find( const vector<ElemType> &vec, const ElemType &value) for (int iX= 0; iX vec size; iX++) if (vec[iX]== Value) return &vec[]; return oFrom pointers to iterators (cont.) ◼ Request 2: ◼ Let the previous find() function support any data types that having test equivalence operator (==) defined template <typename ElemType> ElemType* find(const vector<ElemType> &vec, const ElemType &Value) { for (int iX = 0; iX < vec.size(); iX++) { if (vec[iX] == Value) { return &vec[iX]; } } return 0; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有