Re: C++11 features, move semantics?



On Wed, 2015-01-21 at 11:36 +0100, François Legendre wrote:
Hi,

For range based loop, why not use the name of the element (and not the indice) ?

-    for(unsigned i = 0; i < names.size(); i++)
-      std::cout << names[i] << "." << std::endl;
+    for(const auto& i : names)
+      std::cout << i << "." << std::endl;

+    for(const auto& name : names)
+      std::cout << name << "." << std::endl;

Yes, of course. I might have done that via a regex or put my own brain
on automatic. Patches are welcome.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]