Re: C++11 features, move semantics?



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;

----
François

2015-01-21 8:39 GMT+01:00 Murray Cumming <murrayc murrayc com>:
On Sun, 2014-12-28 at 15:42 +0100, Christof Meerwald wrote:
Hi,

just wondering if anyone has given any thought on C++11 features for
gtkmm.

One thing that seems very unfortunate is that all objects are
non-movable (due to them being explicitly made non-copyable which then
also deletes the move constructor).
[snip]

I believe it's possible to make classes movable but not copyable. That
feels strange to me, but maybe that's just because I'm not using C++11
day to day. I hope that this wouldn't lead to code that looked too much
like the widgets were being copied. I can imagine a lot of confusion
from less experienced coders.

A patch (in bugzilla) would probably be the best way to show us how this
would be useful.

I've just updated (rebased) my c++11 branch for glibmm and put it in the
c++11v2 branch. So far it's mostly changes to examples to show how
gtkmm-based code might look nicer:
https://git.gnome.org/browse/glibmm/log/?h=c%2b%2b11v2


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


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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