I am learning C++ STL using this resource : <http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=standardTemplateLibrary>

The following function to reverse elemens of an array is given there :

```
template<typename T> void reversearr(T *begin, T *end) { 
      // We should at first decrement 'end' 
      // But only for non-empty range 
      if(begin != end) 
      { 
           end--; 
           if(begin != end) { 
                while(true) { 
                     swap(*begin, *end); 
                     begin++; 
                     if(begin == end) { 
                          break; 
                     } 
                     end--; 
                     if(begin == end) { 
                          break; 
                     } 
                } 
           } 
      } 
 } 

```

It works on system-defined types arrays such as:

```
int arr[]={1,2,3,4,5}
reversearr(arr,arr+5);

```

But it gives the following compiler error:

"Iterator02\_ReverseIterators.cpp:39:32: error: no matching function for call to 'reversearr(std::vector::iterator, std::vector::iterator)'"

if I use this code:

```
vector<int> v;
//Code to insert data in vector
reversearr(v.begin(),v.end());

```

How to write the similar functions so that they can work on iterators too?