|
dot-xx
A personal collection of small C++ modules
|
A simple class for tracking object moves/copies during their lives in containers. More...
Public Member Functions | |
| constexpr | LifetimeTester () |
| Create a new object, set both counters to zero and init with a unique origin ID. | |
| constexpr | LifetimeTester (const LifetimeTester &other) |
Create a new instance with the same origin ID and move count as other, and a copy count that is one more than that of other. | |
| constexpr | LifetimeTester (LifetimeTester &&other) |
Create a new instance with the same origin ID and copy count as other, and a move count that is one more than that of other. | |
| constexpr LifetimeTester & | operator= (const LifetimeTester &other) |
| Same effect as creating a new object with a copy constructor. | |
| constexpr LifetimeTester & | operator= (LifetimeTester &&other) |
| Same effect as creating a new object with a move constructor. | |
| constexpr std::size_t | get_origin_id () const |
| constexpr std::size_t | get_times_copied () const |
| constexpr std::size_t | get_times_moved () const |
A simple class for tracking object moves/copies during their lives in containers.
Every instance keeps the number of times it has been copied/moved, and from which original instance it was created. Copying/moving instances only affectes the counter in the copy/move target, the original instance is unaffected