[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49559] Implementation of containers.Map
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #49559] Implementation of containers.Map |
Date: |
Wed, 5 Apr 2017 19:10:08 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
Follow-up Comment #17, bug #49559 (project octave):
@jwe: Your code does correctly handle intmax, however Map is now back to
failing to sort numeric keys with negative values correctly.
m = containers.Map('KeyType','double','ValueType','char');
m(-2)='a';
m(-1)='b';
m(0)='c';
m(1)='d';
m(2)='e';
keys (m)
ans =
{
[1,1] = 0
[2,1] = 1
[3,1] = 2
[4,1] = -1
[5,1] = -2
}
You could save the signbit separately at the front of the string that is
produced. Or you could decode numeric keys back from strings to numbers, sort
them, and pass the sorted list to orderfields rather than relying on the
default. There's probably some other strategies that work.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49559>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #49559] Implementation of containers.Map, Rik, 2017/04/05
- [Octave-bug-tracker] [bug #49559] Implementation of containers.Map, John W. Eaton, 2017/04/05
- [Octave-bug-tracker] [bug #49559] Implementation of containers.Map,
Rik <=
- [Octave-bug-tracker] [bug #49559] Implementation of containers.Map, Guillaume, 2017/04/06
- [Octave-bug-tracker] [bug #49559] Implementation of containers.Map, John W. Eaton, 2017/04/06
- [Octave-bug-tracker] [bug #49559] Implementation of containers.Map, Rik, 2017/04/07
- [Octave-bug-tracker] [bug #49559] Implementation of containers.Map, A.R. Burgers, 2017/04/07
- [Octave-bug-tracker] [bug #49559] Implementation of containers.Map, Rik, 2017/04/07