Re: C++11 features, move semantics?



Am 2015-08-03 18:33, schrieb Yann LEYDIER:
On 03/08/15 18:27, Markus Kolb wrote:
Am 2015-08-03 14:43, schrieb Yann LEYDIER:
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;

Do you mean the class inheritance problem on object copy to base class?


Errrrrrr I'm not sure I understand your question but in C++11 a
non-copyable class can now be used in vectors and other STL classes as
long as it is moveable.

Ok. I haven't recognized that Label is not copyable.
But it doesn't change that you loose information of derived classes,
if you use the base class in the container, does it?
A std::vector<Gtk::Label*> is possible when you have to put in
derived objects, but a std::vector<Gtk::Label&> or std::vector<Gtk::Label>
is not.


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