Operator overloading is fun.
template <class T, int N> inline bool operator==(const T& lhs, const Indirection<T, N>& rhs) { return (lhs == Indirection<T, N-1>::get(*rhs.value)); }
template <class T, int N> inline bool operator!=(const T& lhs, const Indirection<T, N>& rhs) { return !operator==(lhs == rhs); }
template <class T, int N> inline bool operator< (const T& lhs, const Indirection<T, N>& rhs) { return (lhs < Indirection<T, N-1>::get(*rhs.value)); }
template <class T, int N> inline bool operator> (const T& lhs, const Indirection<T, N>& rhs) { return operator< (rhs, lhs); }
template <class T, int N> inline bool operator<=(const T& lhs, const Indirection<T, N>& rhs) { return !operator> (lhs, rhs); }
template <class T, int N> inline bool operator>=(const T& lhs, const Indirection<T, N>& rhs) { return !operator< (lhs, rhs); }
template <class T, int N> inline bool operator==(const Indirection<T, N>& lhs, const T& rhs) { return (Indirection<T, N-1>::get(*rhs.value) == rhs); }
template <class T, int N> inline bool operator!=(const Indirection<T, N>& lhs, const T& rhs) { return !operator==(lhs == rhs); }
template <class T, int N> inline bool operator< (const Indirection<T, N>& lhs, const T& rhs) { return (Indirection<T, N-1>::get(*lhs.value) < rhs); }
template <class T, int N> inline bool operator> (const Indirection<T, N>& lhs, const T& rhs) { return operator< (rhs, lhs); }
template <class T, int N> inline bool operator<=(const Indirection<T, N>& lhs, const T& rhs) { return !operator> (lhs, rhs); }
template <class T, int N> inline bool operator>=(const Indirection<T, N>& lhs, const T& rhs) { return !operator< (lhs, rhs); }
template <class T, int N> inline bool operator==(const Indirection<T, N>& lhs, const Indirection<T, N>& rhs) { return (Indirection<T, N-1>::get(*rhs.value) == Indirection<T, N-1>::get(*rhs.value)); }
template <class T, int N> inline bool operator!=(const Indirection<T, N>& lhs, const Indirection<T, N>& rhs) { return !operator==(lhs == rhs); }
template <class T, int N> inline bool operator< (const Indirection<T, N>& lhs, const Indirection<T, N>& rhs) { return (Indirection<T, N-1>::get(*lhs.value) < Indirection<T, N-1>::get(*rhs.value)); }
template <class T, int N> inline bool operator> (const Indirection<T, N>& lhs, const Indirection<T, N>& rhs) { return operator< (rhs, lhs); }
template <class T, int N> inline bool operator<=(const Indirection<T, N>& lhs, const Indirection<T, N>& rhs) { return !operator> (lhs, rhs); }
template <class T, int N> inline bool operator>=(const Indirection<T, N>& lhs, const Indirection<T, N>& rhs) { return !operator< (lhs, rhs); }
Need help with C/C++ game dev? PM me or add me on skype: the__comet.
Current active project:
Light Ship