cpp_library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub toyama1710/cpp_library

:heavy_check_mark: util/reverse_cmp.hpp

Verified with

Code

#ifndef REVERSE_CMP_HPP
#define REVERSE_CMP_HPP

template <class T>
struct RevCmp {
    T val;

    RevCmp(T val) : val(val){};

    bool operator<(const RevCmp &rhs) const {
        return rhs.val < val;
    };
    bool operator>(const RevCmp &rhs) const {
        return val < rhs.val;
    };
    bool operator==(const RevCmp &rhs) const {
        return !(val < rhs.val || rhs.val < val);
    };
    bool operator!=(const RevCmp &rhs) const {
        return val < rhs.val || rhs.val < val;
    };
    bool operator<=(const RevCmp &rhs) const {
        return *this < rhs || *this == rhs;
    };
    bool operator>=(const RevCmp &rhs) const {
        return *this > rhs || *this == rhs;
    };

    RevCmp &operator=(const RevCmp &rhs) {
        val = rhs.val;
        return *this;
    };

    T value() const {
        return val;
    };
};

#endif
#line 1 "util/reverse_cmp.hpp"



template <class T>
struct RevCmp {
    T val;

    RevCmp(T val) : val(val){};

    bool operator<(const RevCmp &rhs) const {
        return rhs.val < val;
    };
    bool operator>(const RevCmp &rhs) const {
        return val < rhs.val;
    };
    bool operator==(const RevCmp &rhs) const {
        return !(val < rhs.val || rhs.val < val);
    };
    bool operator!=(const RevCmp &rhs) const {
        return val < rhs.val || rhs.val < val;
    };
    bool operator<=(const RevCmp &rhs) const {
        return *this < rhs || *this == rhs;
    };
    bool operator>=(const RevCmp &rhs) const {
        return *this > rhs || *this == rhs;
    };

    RevCmp &operator=(const RevCmp &rhs) {
        val = rhs.val;
        return *this;
    };

    T value() const {
        return val;
    };
};
Back to top page