3 ms·
> And just a few lines below that: "for (auto item : { 1, 2, 3, 4, 5, 6, 7, 8, 9 })". Why?? It's an almost comical abuse of C++11 for the sake of it. This comm
by nadams 11y ago
> And just a few lines below that: "for (auto item : { 1, 2, 3, 4, 5, 6, 7, 8, 9 })". Why?? It's an almost comical abuse of C++11 for the sake of it.
This comment is very interesting. His syntax reminds me of Python syntax of:
for i in [1,2,3]:
Isn't that what the future C++ is trying to achieve? Simplified syntax?
- detrino 11y agoIt's worse in every way to: for (int i = 1; i != 10; ++i)
- srean 11y ago> Isn't that what the future C++ is trying to achieve? Simplified syntax? I think your question was rhetorical, in any case the answer is yes. In fact the proposed C++ pythy syntax tries go even further http://pfultz2.github.io/Pythy/ http://pfultz2.github.io/Pythy/ . IIRC its Clang only. Its author hangs out on HN sometimes and would be able to provide more information
- andrepd 11y agoEven in that example, wouldn't it be better to simply write for i in range(1,4):