#ifndef __KEY_VALUE_PAIR_HPP #define __KEY_VALUE_PAIR_HPP #include template struct KeyValuePair { K key; V value; KeyValuePair(K const& _key = K(), V const& _value = V()) : key(_key), value(_value) {} bool operator==(KeyValuePair const& kvp) const { return key == kvp.key; } bool operator!=(KeyValuePair const& kvp) const { return !(*this == kvp); } bool operator<(KeyValuePair const& kvp) const { return key < kvp.key; } bool operator>=(KeyValuePair const& kvp) const { return !(*this < kvp); } bool operator<=(KeyValuePair const& kvp) const { return !(kvp < *this); } bool operator>(KeyValuePair const& kvp) const { return !(*this <= kvp); } }; template std::ostream& operator<<(std::ostream& os, KeyValuePair const& kvp) { return os << '(' << kvp.key << ", " << kvp.value << ')'; } #endif