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

Branching factor constructor parameter #57

Open
sharwell opened this issue Jan 1, 2018 · 0 comments
Open

Branching factor constructor parameter #57

sharwell opened this issue Jan 1, 2018 · 0 comments

Comments

@sharwell
Copy link
Member

sharwell commented Jan 1, 2018

Currently the branchingFactor parameter specified in several constructors in this library poses a potential problem for users attempting to drop-in replace existing collections with the ones defined here. For example, consider the following:

var list = new List<int>(capacity);
list.AddRange(source);

If this code is converted to TreeList<T> using a find and replace operation, you get this:

var list = new TreeList<int>(capacity);
list.AddRange(source);

This code compiles and executes correctly when capacity is greater than 2, but the internal APIs (and performance) are potentially negatively impacted and maintainability is hurt since capacity is not what the argument is used for.

A solution should be provided which helps people migrate from standard .NET collections to these collections without hitting these problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant