// // ptr_compare.hpp // pointers // // Created by Sam Jaffe on 1/5/17. // #pragma once namespace pointers { namespace detail { template struct pointer_compare { friend bool operator==(Self const & lhs, Self const & rhs) { return lhs.get() == rhs.get(); } friend bool operator<(Self const & lhs, Self const & rhs) { return lhs.get() < rhs.get(); } friend bool operator!=(Self const & lhs, Self const & rhs) { return !(lhs == rhs); } friend bool operator>(Self const & lhs, Self const & rhs) { return rhs < lhs; } friend bool operator<=(Self const & lhs, Self const & rhs) { return !(rhs < lhs); } friend bool operator>=(Self const & lhs, Self const & rhs) { return !(lhs < rhs); } friend bool operator==(Self const & lhs, std::nullptr_t) { return !lhs; } friend bool operator<(Self const & lhs, std::nullptr_t) { return lhs.get() < nullptr; } friend bool operator!=(Self const & lhs, std::nullptr_t) { return !!lhs; } friend bool operator>(Self const & lhs, std::nullptr_t) { return nullptr < lhs; } friend bool operator<=(Self const & lhs, std::nullptr_t) { return !(nullptr < lhs); } friend bool operator>=(Self const & lhs, std::nullptr_t) { return !(lhs < nullptr); } friend bool operator==(std::nullptr_t, Self const & rhs) { return !rhs; } friend bool operator<(std::nullptr_t, Self const & rhs) { return nullptr < rhs.get(); } friend bool operator!=(std::nullptr_t, Self const & rhs) { return !!rhs; } friend bool operator>(std::nullptr_t, Self const & rhs) { return rhs < nullptr; } friend bool operator<=(std::nullptr_t, Self const & rhs) { return !(rhs < nullptr); } friend bool operator>=(std::nullptr_t, Self const & rhs) { return !(nullptr < rhs); } }; }}