I was wondering if there was a simple way to be notified of when STL containers themselves are copied or moved (without having to deal with the complexity of modifying or attempting to overload STL methods - as I imagine that to be cumbersome).
I use simple std::cout
outputs to notify of moves and copies when I'm debugging single threaded applications (making sure my own reference types do what I intended).
I've been thinking about it for a while and I've only produced really, really, idiotic ideas (like overloading std::move to produce actual code so that it notifies of all attempts to create candidates for moving - lol). Or could you perhaps overload the real STL move and copy constructors and then make them invoke the real ones?
I'm thinking this could be useful for knowing where exactly copy elision is taking place, where things are actually being moved (and not decaying to a copy operation if the type is const).
Any insight would be interesting and appreciated.
Aucun commentaire:
Enregistrer un commentaire