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"
37 template <
typename KEY_TYPE,
typename VALUE_TYPE>
40 using KeyType = KEY_TYPE;
43 using ValueType = VALUE_TYPE;
53 requires (constructible_from<KEY_TYPE> and constructible_from<VALUE_TYPE>)
56 requires (copy_constructible<KEY_TYPE> and copy_constructible<VALUE_TYPE>)
59 requires (is_move_constructible_v<KEY_TYPE> and is_move_constructible_v<VALUE_TYPE>)
61 constexpr KeyValuePair (
const KeyType& key,
const ValueType& value)
62 requires (copy_constructible<KEY_TYPE> and copy_constructible<VALUE_TYPE>);
63 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
64 constexpr KeyValuePair (
const pair<KEY_TYPE2, VALUE_TYPE2>& src)
65 requires (constructible_from<KEY_TYPE, const KEY_TYPE2&> and constructible_from<VALUE_TYPE, const VALUE_TYPE2&>);
66 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
68 requires (constructible_from<KEY_TYPE, const KEY_TYPE2&> and constructible_from<VALUE_TYPE, const VALUE_TYPE2&>);
75 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
76 nonvirtual
KeyValuePair& operator= (
const pair<KEY_TYPE2, VALUE_TYPE2>& rhs);
77 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
79 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
80 nonvirtual
KeyValuePair& operator= (pair<KEY_TYPE2, VALUE_TYPE2>&& rhs);
81 template <
typename KEY_TYPE2,
typename VALUE_TYPE2>
94 requires (equality_comparable<KEY_TYPE> and equality_comparable<VALUE_TYPE>);
102 requires (three_way_comparable<KEY_TYPE> and three_way_comparable<VALUE_TYPE>);
105 template <
typename KEY_TYPE>
106 struct KeyValuePair<KEY_TYPE, void> {
108 using KeyType = KEY_TYPE;
111 using ValueType = void;
121 requires (constructible_from<KEY_TYPE>)
124 requires (copy_constructible<KEY_TYPE>)
127 requires (is_move_constructible_v<KEY_TYPE>)
130 requires (copy_constructible<KEY_TYPE>);
131 template <
typename KEY_TYPE2>
132 constexpr KeyValuePair (
const pair<KEY_TYPE2, void>& src)
133 requires (constructible_from<KEY_TYPE, const KEY_TYPE2&>);
134 template <
typename KEY_TYPE2>
135 constexpr KeyValuePair (
const KeyValuePair<KEY_TYPE2, void>& src)
136 requires (constructible_from<KEY_TYPE, const KEY_TYPE2&>);
143 template <
typename KEY_TYPE2>
144 nonvirtual
KeyValuePair& operator= (
const pair<KEY_TYPE2, void>& rhs);
145 template <
typename KEY_TYPE2>
146 nonvirtual
KeyValuePair& operator= (
const KeyValuePair<KEY_TYPE2, void>& rhs);
147 template <
typename KEY_TYPE2>
148 nonvirtual
KeyValuePair& operator= (pair<KEY_TYPE2, void>&& rhs);
149 template <
typename KEY_TYPE2>
150 nonvirtual
KeyValuePair& operator= (KeyValuePair<KEY_TYPE2, void>&& rhs);
161 requires (equality_comparable<KEY_TYPE>);
169 requires (three_way_comparable<KEY_TYPE>);
173#if qCompilerAndStdLib_template_concept_matcher_requires_Buggy
174 template <
typename T1,
typename T2 =
void>
175 struct is_KVP_ : std::false_type {};
176 template <
typename T1,
typename T2>
177 struct is_KVP_<KeyValuePair<T1, T2>> : std::true_type {};
183 template <
typename T>
184 concept IKeyValuePair =
185#if qCompilerAndStdLib_template_concept_matcher_requires_Buggy
186 Private_::is_KVP_<T>::value
190 []<
typename T1,
typename T2> (KeyValuePair<T1, T2>) {}(t)
195 static_assert (not IKeyValuePair<optional<int>>);
196 static_assert (IKeyValuePair<KeyValuePair<int, int>>);
197 static_assert (IKeyValuePair<KeyValuePair<int, void>>);
206#include "KeyValuePair.inl"
constexpr auto operator<=>(const KeyValuePair &) const
constexpr KeyValuePair()=default
constexpr bool operator==(const KeyValuePair &) const