I'm trying to generate an an array in descending order, as in actually fill it from scratch. I am not trying to sort given numbers. I wanted to know if there is a way to do it without a for loop. I was able to generate an array in ascending order of number using std::iota, but I haven't been able to (nor do I think I can) use that for generating a descending array. Is there a one liner out there for generating a array of size in descending order?
EDIT: I was able to create an array in ascending order using:
void generateAscendingArray(int values[], size_t size){
std::iota(values, values+size, 1);
}
So it fills the array with numbers corresponding to the size of the array. I am simply looking for an easy way to generate a descending array without a loop, or with minimal lines and work, similar to ascending. I want it to fill the array in accordance to the size of the array just in descending order.