Compound Literals are a C99 construct. Even though I can do this in C++ :
#include <iostream>
using namespace std;
int main() {
for (auto i : (float[2]) {2.7, 3.1}) cout << i << endl;
}
It seems that for example MSVC supports it as an extension. Yet all compilers I can get my hands on, compile the above mentioned code.
So is this a feature available in C++14 ? Is there a different standard term (It looks to me like just creating a temporary using braced initialization) ?
Side Note : "Compound Literals" (or whatever I should call the above) are a pack expansion context ( just to mention a functionality )
std::array<float, 2>
and you know it's safe, why bother? – Beaufor (auto i : {2.7, 3.1}) cout << i << endl;
works just fine and is standard. – Eadwina