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

Abstract over Vec as the sole container type #42

Open
milibopp opened this issue Jan 11, 2015 · 1 comment
Open

Abstract over Vec as the sole container type #42

milibopp opened this issue Jan 11, 2015 · 1 comment

Comments

@milibopp
Copy link
Owner

Both the Partition trait and the structs Tree and PureTree could benefit from not being specialized to Vec as a container type for subdivision/branching. Some obvious types to use are [T; 2], [T; 4] and [T; 8]. The cube map partition could use a specialized hybrid container type that can hold either six (dividing the top-level sphere) or four elements (the per-side quad trees). This would also enable using lazy structures such as iterators or any kind of lazily initialized container/sequence.

@milibopp
Copy link
Owner Author

It looks like this requires some kind of HKT, which (luckily) can be emulated with associated types. However, there is some issue resolving self-referential trait bounds, which are also required. I started working on this on a branch.

Note, that this can only be thought of as a workaround until Rust gains HKT and will therefore have to be changed at some point. It may be possible to do this backwards-compatibly, while deprecating the hacky bits of it.

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

1 participant