Files
Seele/src/Engine/Containers/Pair.h
T

33 lines
807 B
C++
Raw Normal View History

2022-11-29 16:34:42 +01:00
#pragma once
namespace Seele
{
template <typename K, typename V>
struct Pair
{
public:
2023-12-22 19:46:07 +01:00
constexpr Pair()
2022-11-29 16:34:42 +01:00
: key(K()), value(V())
{}
2023-12-22 19:46:07 +01:00
constexpr Pair(const K & key, const V & value)
: key(key), value(value)
{}
template<class U1 = K, class U2 = V>
constexpr Pair(U1&& x, U2&& y)
: key(std::forward<U1>(x))
, value(std::forward<U2>(y))
{
}
2022-11-29 16:34:42 +01:00
Pair(const Pair& other) = default;
Pair(Pair&& other) = default;
~Pair(){}
Pair& operator=(const Pair& other) = default;
Pair& operator=(Pair&& other) = default;
constexpr friend bool operator<(const Pair& left, const Pair& right)
{
return left.key < right.key || (!(right.key < left.key) && left.value < right.value);
}
K key;
V value;
};
} // namespace Seele