As said by others, what you're asking about is impossible, but there are many alternative solutions. Using a C-array or an std::array of ints as suggested is the best approach if you can use it.
But supposed the variable names cannot be changes (for example, they are argument of a function, and you don't want to change the signature), but you still want to address them by index, so you can loop through them. One approach is to use an array of pointers
int * sol[2] ={&sol0,&sol1};
*sol[0]=1;
This works, but it's quite ugly in my opinion.
Another solution is to use a tuple:
std::tuple<int&,int&> sol=std::tie(sol0,sol1);
std::get<0>(sol)=1;
Yet another option is to copy your values into an array, process the array, and copy them back.