3 ms·
What point are you trying to make that you need the "most cutting edge" compilers? C++11 just came out: of course you need a cutting edge compiler. That won't
by agwa 14y ago
What point are you trying to make that you need the "most cutting edge" compilers? C++11 just came out: of course you need a cutting edge compiler. That won't be true for that much longer though.
The template machinery isn't that horrible. Certainly not so significant as to seriously impact programmer productivity. A brace-enclosed initializer list of ints (e.g. { 1, 2, 3, 4 }) is considered a std::initializer_list<int> and this is what a constructor taking such an initializer list looks like:
T (std::initializer_list<int> l)
{
for (int i : l) {
// Do something with i (e.g. copy it into the data structure)
}
}
In fact, the C++ designers have created a basic data structure that's defined in the language itself: std::initializer_list. It's just so minimal that it's only used to initialize more complex, user-defined types. That way programmers have the benefit of the "syntactic sugar" even for data types that the C++ designers never could have envisioned.
- apaprocki 14y ago>That won't be true for that much longer though. Oracle Studio (now version 12) has not even started work on C++11 support. It will be a long time before their compiler comes anywhere close to gcc/Clang in support.
- agwa 14y agoAt some point, you have to stop saying "only in cutting edge compilers" and start saying "only in compilers that aren't archaic." Intel's compiler has pretty complete support and Microsoft is working diligently on Visual Studio's C++11 support.
- cageface 14y agoGet back to me when all the standard IDEs can also properly inspect these things in the debugger and give me an error message less than half a page long when I make a tiny syntactic mistake in my code.