ondrejpetrzilka / rock.collections Goto Github PK
View Code? Open in Web Editor NEWRepository with advanced collections like OrderedHashSet or OrderedDictionary
License: MIT License
Repository with advanced collections like OrderedHashSet or OrderedDictionary
License: MIT License
m_firstOrderIndex is left in uninitialized state (not -1) when a new instance is created, Initialize is only called when capacity > 0 in constructor, or when adding a new item with null buckets.
The .NET dictionary will simply iterate on the size of the enumerator, but in your case, you check m_firstOrderIndex, which since it is 0 in the uninitialized state, results in a crash trying to get the first element in an empty collection.
var dict = new OrderedDictionary<string,string>();
foreach (var entry in dict) { /* boom */ }
Our fix is just to change the ctor line to:
if (capacity >= 0) Initialize(capacity);
A better fix would preserve your desire for lazy use of memory, and enumerate on the size, similar to the stock .NET.
Hello,
Thank you for your project!
I have some questions.
When accessing the last enumerator element using Enumerator.Current
I get an exception, because the implementation can not distinguish between valid enumerator at last element and invalid enumerator advanced past the last index.
I have introduced -2
marker to solve this, and now use named const variables for these markers.
I have implemented a fix in koliyo@1cead3d
Only for OrderedDictionary
at the moment.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.