#pragma once template class Counted { T elem; unsigned count; public: T& GetElem(); unsigned GetCount(); Counted& operator++(); Counted operator++(int); Counted& operator--(); Counted operator--(int); Counted& operator+=(int countChange); Counted& operator-=(int countChange); }; template T& Counted::GetElem() { return elem; } template unsigned Counted::GetCount() { return count; } template Counted& Counted::operator++() { ++count; return *this; } template Counted Counted::operator++(int) { count++; return *this; } template Counted& Counted::operator--() { --count; return *this; } template Counted Counted::operator--(int) { count--; return *this; } template Counted& Counted::operator+=(int countChange) { count += countChange; return *this; } template Counted& Counted::operator-=(int countChange) { count -= countChange; return *this; }