Skip to content

Inserted values are ignored if inserted with the same key #5

Closed
@ForNeVeR

Description

@ForNeVeR

KdTree seems to always be ignoring the new values if there's an old value stored with the same key. Here's an example:

using System;
using KdTree;
using KdTree.Math;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var tree = new KdTree<float, int>(2, new FloatMath());
            var coords = new[] { 0.0f, 0.0f };
            tree.Add(coords, 100);
            tree.Add(coords, 200);

            var z = tree.FindValueAt(coords);
            Console.Write(z); // => 100, but I'd expect 200
        }
    }
}

It would be better to either replace the existing value or throw an exception. I think that the library should never silently ignore the user value.

Maybe the problem will be solved as part of #4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions