4#ifndef _Stroika_Foundation_Common_KeyValuePair_h_
5#define _Stroika_Foundation_Common_KeyValuePair_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
14#include "Stroika/Foundation/Common/Common.h"
34 template <
typename KEY_TYPE,
typename VALUE_TYPE>
37 using KeyType = KEY_TYPE;
40 using ValueType = VALUE_TYPE;
50 requires (constructible_from<KEY_TYPE> and constructible_from<VALUE_TYPE>)
53 requires (copy_constructible<KEY_TYPE> and copy_constructible<VALUE_TYPE>)
56 requires (is_move_constructible_v<KEY_TYPE> and is_move_constructible_v<VALUE_TYPE>)
58 constexpr KeyValuePair (
const KeyType& key,
const ValueType& value)
59 requires (copy_constructible<KEY_TYPE> and copy_constructible<VALUE_TYPE>);
60 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
61 constexpr KeyValuePair (
const pair<KEY_TYPE2, VALUE_TYPE2>& src)
62 requires (constructible_from<KEY_TYPE, const KEY_TYPE2&> and constructible_from<VALUE_TYPE, const VALUE_TYPE2&>);
63 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
65 requires (constructible_from<KEY_TYPE, const KEY_TYPE2&> and constructible_from<VALUE_TYPE, const VALUE_TYPE2&>);
72 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
73 nonvirtual
KeyValuePair& operator= (
const pair<KEY_TYPE2, VALUE_TYPE2>& rhs);
74 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
76 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
77 nonvirtual
KeyValuePair& operator= (pair<KEY_TYPE2, VALUE_TYPE2>&& rhs);
78 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
91 requires (equality_comparable<KEY_TYPE> and equality_comparable<VALUE_TYPE>);
99 requires (three_way_comparable<KEY_TYPE> and three_way_comparable<VALUE_TYPE>);
102 template <
typename KEY_TYPE>
103 struct KeyValuePair<KEY_TYPE, void> {
105 using KeyType = KEY_TYPE;
108 using ValueType = void;
118 requires (constructible_from<KEY_TYPE>)
121 requires (copy_constructible<KEY_TYPE>)
124 requires (is_move_constructible_v<KEY_TYPE>)
127 requires (copy_constructible<KEY_TYPE>);
128 template <
typename KEY_TYPE2>
129 constexpr KeyValuePair (
const pair<KEY_TYPE2, void>& src)
130 requires (constructible_from<KEY_TYPE, const KEY_TYPE2&>);
131 template <
typename KEY_TYPE2>
132 constexpr KeyValuePair (
const KeyValuePair<KEY_TYPE2, void>& src)
133 requires (constructible_from<KEY_TYPE, const KEY_TYPE2&>);
140 template <
typename KEY_TYPE2>
141 nonvirtual
KeyValuePair& operator= (
const pair<KEY_TYPE2, void>& rhs);
142 template <
typename KEY_TYPE2>
143 nonvirtual
KeyValuePair& operator= (
const KeyValuePair<KEY_TYPE2, void>& rhs);
144 template <
typename KEY_TYPE2>
145 nonvirtual
KeyValuePair& operator= (pair<KEY_TYPE2, void>&& rhs);
146 template <
typename KEY_TYPE2>
147 nonvirtual
KeyValuePair& operator= (KeyValuePair<KEY_TYPE2, void>&& rhs);
158 requires (equality_comparable<KEY_TYPE>);
166 requires (three_way_comparable<KEY_TYPE>);
170#if qCompilerAndStdLib_template_concept_matcher_requires_Buggy
171 template <
typename T1,
typename T2 =
void>
172 struct is_KVP_ : std::false_type {};
173 template <
typename T1,
typename T2>
174 struct is_KVP_<KeyValuePair<T1, T2>> : std::true_type {};
180 template <
typename T>
181 concept IKeyValuePair =
182#if qCompilerAndStdLib_template_concept_matcher_requires_Buggy
183 Private_::is_KVP_<T>::value
187 []<
typename T1,
typename T2> (KeyValuePair<T1, T2>) {}(t)
192 static_assert (not IKeyValuePair<optional<int>>);
193 static_assert (IKeyValuePair<KeyValuePair<int, int>>);
194 static_assert (IKeyValuePair<KeyValuePair<int, void>>);
203#include "KeyValuePair.inl"
constexpr auto operator<=>(const KeyValuePair &) const
constexpr KeyValuePair()=default
constexpr bool operator==(const KeyValuePair &) const