If we consider the function
int sum(int* nums, size_t len)
{
int sum = 0;
for(int i = 0; i < len; i++) sum += nums[i];
return sum;
}
We could call it using an lvalue as such
int[] nums = {1,2,3};
sum(nums, 3);
But when trying to use an rvalue it doesn't work.
sum({1,2,3}, 3);
Is there a way to get this to work?