rendered paste body#ifndef VECTOR_HPP#define VECTOR_HPPtemplate<class T, int n>class Vector { T v[n]; ///< tároló int siz; ///< aktuálsi méretpublic: template <class T> class _iterator { friend class Vector; int index; Vector * parent; public: _iterator():index(0),parent(NULL){}; _iterator operator++(int n) // A++ (post) { _iterator<T> ret = *this; index++; return ret; } ; _iterator & operator++() // ++A (pre) { index++; return *this; }; bool operator == ( const _iterator<T> & ref) { return ( parent == ref.parent && index == ref.index); }; bool operator != ( const _iterator<T> & ref) { return !( parent == ref.parent && index ==ref.index); }; T & operator * () { return parent->v[index]; }; }; friend class _iterator<T>; typedef _iterator<T> iterator; Vector() { siz = 0; } void push_back(T e) { if (siz >= n) throw "A vektor megtelt"; v[siz++] = e; } T& operator[](int i) { if (i < 0 || i >= siz) throw "Index hiba"; return v[i]; } _iterator<T> begin() { _iterator<T> ret; ret.index = 0; ret.parent = this; return ret; }; _iterator<T> end() { _iterator<T> ret; ret.index = siz; ret.parent = this; return ret; }; };#endif--------------------------------------------------------#include <iostream>#include "vector.h"using namespace std;int main() { Vector<int, 20> v1; // max húsz elemű int vektor for (int i = 0; i < 10; i++) // feltöltjük v1.push_back(i); Vector<int, 20>::iterator i1; // létrehozunk egy iterátort for (i1 = v1.begin(); i1 != v1.end(); i1++) // kiirjuk az elemeket. cout << *i1 << endl; return 0;}