Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderedTable.== throws error on empty table: unhandled exception: index out of bounds... #15750

Closed
gcao opened this issue Oct 27, 2020 · 1 comment

Comments

@gcao
Copy link

gcao commented Oct 27, 2020

OrderedTable.== throws error on empty table: unhandled exception: index out of bounds, the container is empty [IndexDefect]

Example

import tables

var t1 = OrderedTable[int, string]()
var t2 = OrderedTable[int, string]()

echo t1 == t2

Current Output

Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]

Expected Output

true

$ nim -v
Nim Compiler Version 1.4.0 [MacOSX: amd64]
Compiled at 2020-10-27
Copyright (c) 2006-2020 by Andreas Rumpf
active boot switches: -d:release

ringabout added a commit to ringabout/Nim that referenced this issue Oct 28, 2020
@ringabout
Copy link
Member

You should use initOrderTable to initialize OrderTable.

import tables

var t1 = initOrderedTable[int, string]()
var t2 = initOrderedTable[int, string]()

doAssert t1 == t2

narimiran added a commit to narimiran/Nim that referenced this issue Oct 28, 2020
@Araq Araq closed this as completed in b13fb9d Oct 28, 2020
narimiran added a commit that referenced this issue Nov 5, 2020
(cherry picked from commit b13fb9d)
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
irdassis pushed a commit to irdassis/Nim that referenced this issue Mar 16, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants