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 )
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…