Skip to content

Commit d7d7c85

Browse files
author
Rik
committed
maint: Backed out changeset 8f3d778579f3 from stable branch.
1 parent 1947b3f commit d7d7c85

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

scripts/+containers/Map.m

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,6 @@
202202
## Check type of keys and values, and define numeric_keys
203203
check_types (this);
204204

205-
## Flatten char keys
206-
if (! this.numeric_keys)
207-
keys = cellfun (@(x) x(:).', keys, 'UniformOutput', false);
208-
endif
209-
210205
## Sort keys (faster than call to sort_keys once encoded)
211206
if (this.numeric_keys)
212207
[~, I] = sort (cell2mat (keys));
@@ -266,10 +261,6 @@
266261
if (! iscell (keySet))
267262
error ("containers.Map: input argument 'keySet' must be a cell");
268263
endif
269-
if (! this.numeric_keys)
270-
## Flatten char keys
271-
keySet = cellfun (@(x) x(:).', keySet, 'UniformOutput', false);
272-
endif
273264
enckeySet = encode_keys (this, keySet);
274265
valueSet = cell (size (keySet));
275266
for i = 1:numel (valueSet)
@@ -307,8 +298,6 @@
307298
in = cellfun ("isnumeric", keySet) | cellfun ("islogical", keySet);
308299
if (! this.numeric_keys)
309300
in = ! in;
310-
## Flatten char keys
311-
keySet = cellfun (@(x) x(:).', keySet, 'UniformOutput', false);
312301
endif
313302
keySet = encode_keys (this, keySet(in));
314303
tf(in) = isfield (this.map, keySet);
@@ -337,8 +326,6 @@
337326
in = cellfun ("isnumeric", keySet) | cellfun ("islogical", keySet);
338327
if (! this.numeric_keys)
339328
in = ! in;
340-
## Flatten char keys
341-
keySet = cellfun (@(x) x(:).', keySet, 'UniformOutput', false);
342329
endif
343330
keySet = encode_keys (this, keySet(in));
344331
in = isfield (this.map, keySet);
@@ -447,9 +434,6 @@
447434
|| ! isscalar (key))))
448435
error ("containers.Map: specified key type does not match the type of this container");
449436
endif
450-
if (ischar (key))
451-
key = key(:).';
452-
endif
453437
enckey = encode_keys (this, key);
454438
if (! isfield (this.map, enckey))
455439
error ("containers.Map: specified key <%s> does not exist",
@@ -489,9 +473,6 @@
489473
endif
490474
val = feval (this.ValueType, val);
491475
endif
492-
if (ischar (key))
493-
key = key(:).';
494-
endif
495476
key = encode_keys (this, key);
496477
if (isfield (this.map, key))
497478
this.map.(key) = val;
@@ -671,19 +652,6 @@ function check_types (this)
671652
%! m = containers.Map ('', 3);
672653
%! assert (m(''), 3);
673654
674-
## Test multi-row char array keys
675-
%!test <*67283>
676-
%! k1 = char ("key", "one");
677-
%! k2 = char ("key", "two");
678-
%! k3 = char ("key", "three");
679-
%! m = containers.Map ({k1, k2}, {1, 2});
680-
%! m(k3) = 3;
681-
%! assert (m(k1), 1);
682-
%! assert (m.values ({k1, k3}), {1, 3});
683-
%! m.remove ({k1, k3});
684-
%! assert (m(k2), 2);
685-
%! assert (m.isKey ({k1, k2, k3}), [false, true, false]);
686-
687655
## Test numeric keys
688656
%!test
689657
%! key = [1, 2, 3, 4];

0 commit comments

Comments
 (0)