what if i have a vector size that above 1000
Apart from the coding nightmare (although you could write a program to generate the code that could then be included in the main program), have you considered the complexity of this. Even if this was re-done using recursion somehow, the run-time complexity ...

What are you trying to achieve?