I am trying to pass what I think is a prvalue into a range adapter closure object. It won't compile unless I bind a name to the initializer list and make it an lvalue. What is happening here?
#include <bits/stdc++.h>
using namespace std;
int main(){
//why does this compile?
auto init_list = {1,2,4};
auto v = init_list | views::drop(1);
//but not this?
// auto v2 = initializer_list<int>{1,2,4} | views::drop(1);
//or this?
//auto v3 = views::all(initializer_list<int>{1,2,4}) | views::drop(1);
}