@@ -123,43 +123,6 @@ struct LinkedListSetValue<A<OldID, OldValue, T>, LookupID, NewValue> {
123
123
124
124
};
125
125
126
- // template<string_literal LookupID, auto NewValue>
127
- // struct LinkedListSetValue<LinkedListEmptyNode, LookupID, NewValue> {
128
- // using newList = LinkedListNode<OldID, OldValue>;
129
-
130
- // };
131
-
132
- /*
133
- Either sets value if it exists or adds new one
134
- Helper function that combines set and add functionality into one
135
-
136
- */
137
-
138
- template <typename T, string_literal LookupID, auto NewValue>
139
- struct LinkedListSetOrAddValue {
140
- using newList = T;
141
- };
142
-
143
-
144
- // end case couldn't find a value
145
- template <string_literal LookupID, auto NewValue>
146
- struct LinkedListSetOrAddValue <LinkedListEmptyNode, LookupID, NewValue> {
147
- using newList = LinkedListNode<LookupID, NewValue>;
148
- };
149
-
150
-
151
- // match case
152
- template <template <string_literal, auto , typename > typename A, string_literal OldID, auto OldValue, typename T, auto NewValue>
153
- struct LinkedListSetOrAddValue <A<OldID, OldValue, T>, OldID, NewValue> {
154
- using newList = LinkedListNode<OldID, NewValue, T>;
155
- };
156
-
157
- template <template <string_literal, auto , typename > typename A, string_literal OldID, auto OldValue, typename T, string_literal LookupID, auto NewValue>
158
- struct LinkedListSetOrAddValue <A<OldID, OldValue, T>, LookupID, NewValue> {
159
- using extract = LinkedListSetOrAddValue<T, LookupID, NewValue>::newList;
160
- using newList = LinkedListNode<OldID, OldValue, extract>;
161
-
162
- };
163
126
164
127
165
128
void runLinkedListTests () {
@@ -211,20 +174,4 @@ void runLinkedListTests() {
211
174
// n cases
212
175
static_assert (std::is_same_v<LinkedListNode<" a" , 3 , LinkedListNode<" b" , 4 , LinkedListNode<" c" , 9 , LinkedListNode<" d" , 12 >>>>, LinkedListAddValue<storageN, " d" , 12 >::newList>);
213
176
214
-
215
- // set or add tests
216
-
217
- // 0 cases
218
- static_assert (std::is_same_v<LinkedListNode<" a" , 40 >, LinkedListSetOrAddValue<storage0, " a" , 40 >::newList>);
219
-
220
- // 1 cases
221
- static_assert (std::is_same_v<LinkedListNode<" a" , 40 >, LinkedListSetOrAddValue<storage1, " a" , 40 >::newList>);
222
- static_assert (std::is_same_v<LinkedListNode<" a" , 3 , LinkedListNode<" b" , 40 >>, LinkedListSetOrAddValue<storage1, " b" , 40 >::newList>); // add case
223
-
224
- // n cases
225
- static_assert (std::is_same_v<LinkedListNode<" a" , 40 , LinkedListNode<" b" , 4 , LinkedListNode<" c" , 9 >>>, LinkedListSetOrAddValue<storageN, " a" , 40 >::newList>);
226
- static_assert (std::is_same_v<LinkedListNode<" a" , 3 , LinkedListNode<" b" , 40 , LinkedListNode<" c" , 9 >>>, LinkedListSetOrAddValue<storageN, " b" , 40 >::newList>);
227
- static_assert (std::is_same_v<LinkedListNode<" a" , 3 , LinkedListNode<" b" , 4 , LinkedListNode<" c" , 40 >>>, LinkedListSetOrAddValue<storageN, " c" , 40 >::newList>);
228
- static_assert (std::is_same_v<LinkedListNode<" a" , 3 , LinkedListNode<" b" , 4 , LinkedListNode<" c" , 9 , LinkedListNode<" d" , 40 >>>>, LinkedListSetOrAddValue<storageN, " d" , 40 >::newList>); // invalid case
229
-
230
177
}
0 commit comments