mercredi 28 janvier 2015

Is it safe to reuse a std container after std::move?

If I have a std::list, for example, and I use std::move() to move its information into a std::map, is it safe to reuse the list by populating it with more data so that I can add more entries to the map? I vaguely remember being told by another programmer that std::move() puts things in an unknown state so you shouldn't reuse them after, but I would just like to confirm since I can't seem to find any information on this just by searching around.


If it's not safe, then would calling clear() on the list after moving it make it OK to reuse?


Aucun commentaire:

Enregistrer un commentaire