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 the NodeState #7

Closed
milibopp opened this issue Dec 4, 2014 · 0 comments · Fixed by #15 or #17
Closed

Abstract over the NodeState #7

milibopp opened this issue Dec 4, 2014 · 0 comments · Fixed by #15 or #17

Comments

@milibopp
Copy link
Owner

milibopp commented Dec 4, 2014

Currently NodeState is coupled tightly to its particular kind of memory layout:

pub enum NodeState<O, N> {
    Empty,
    Leaf(O),
    Branch(Vec<N>),
}

As the Node trait requires this exact type, it would not be possible for an implementation to use a different internal representation, e.g. [N, ..8] instead of Vec<N> for a dimension-specific octree.

Another problem is, that the queries are currently not implemented generically, which would be possible, if the state was generic, too. In principle, we could have impls like:

impl<T, P, N, O> ObjectQuery<O> for T
    where T: Node<P, N, O>
{ /* ... */ }

impl<T, P, N, O, D> DataQuery<D> for T
    where T: Node<P, N, O> + AssociatedData<D>
{ /* ... */ }

This would remove part of the code duplication between PureNTree and NTree.

milibopp added a commit that referenced this issue Dec 10, 2014
NodeState is not hard-coded to use a Vec any more. For generic programming we
may want to impose trait bounds on the container in the future.

Fixes #7.
milibopp added a commit that referenced this issue Jun 10, 2023
NodeState is not hard-coded to use a Vec any more. For generic programming we
may want to impose trait bounds on the container in the future.

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

Successfully merging a pull request may close this issue.

1 participant