// Tipo para las pruebas: cuenta copias y no tiene constructor por defecto.
#ifndef TRACKED_H
#define TRACKED_H

#include <utility>

class Tracked {
public:
    static long& copies() {
        static long count = 0;
        return count;
    }

    explicit Tracked(int value) : value_(value) {}
    Tracked(const Tracked& other) : value_(other.value_) { copies()++; }
    Tracked(Tracked&& other) noexcept : value_(std::exchange(other.value_, -1)) {}
    Tracked& operator=(const Tracked& other) {
        value_ = other.value_;
        copies()++;
        return *this;
    }
    Tracked& operator=(Tracked&& other) noexcept {
        value_ = std::exchange(other.value_, -1);
        return *this;
    }

    int value() const { return value_; }

private:
    int value_;
};

#endif
