示例#1
0
	bool operator==(Register rhs) const {
		if(this->state != rhs.state) return false;

		switch(this->state) {
			case State::Int:
				if(this->getInteger() == rhs.getInteger()) {
					return true;
				}
				break;
			case State::String:
				if(this->getString() == rhs.getString()) {
					return true;
				}
				break;
			default: return false;
		}
		return false;
	};
示例#2
0
	bool operator<(Register rhs) {
		if(this->state != rhs.state) {
			throw std::exception();
		}
		switch(this->state) {
			case State::Int:
				if(this->getInteger() < rhs.getInteger()) {
					return true;
				}
				break;
			case State::String:
				if(this->getString() < rhs.getString()) {
					return true;
				}
				break;
			default: return false;
		}
		return false;
	};