Re: C++11 features, move semantics?




On 01/08/15 21:39, Murray Cumming wrote:
I'm open to the idea, but I'd like to see some small example of how
this might be used, please.

The most immediate use of move semantics would be to be able to use this:
std::vector<Gtk::Label> labels;

It would also enable the use of Herb Sutter's AAA style (Almost Always Auto):
auto label = Gtk::Label{"foo"}; // instead of: Gtk::Label label{"foo"};


However, such changes are mainly cosmetic. It's similar to moving C functions to a class as static members: it feels nice but it doesn't make use of C++'s power. Migrating to C++11 should probably begin with getting rid of all raw pointers. But seeing how difficult it is to break the ABI, I suppose that breaking the API is impossible, at least until a possible Gtk4 is released, isn't it?

yann


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