Dynamic dimensions

Paul Harris paulharris at computer.org
Sat Mar 28 07:54:05 UTC 2009


2009/3/28 martin f krafft <madduck at debian.org>

> also sprach Willi Richert <w.richert at gmx.net> [2009.03.28.0004 +0100]:
> > It is needed so that bindings with dynamic typing (Python) don't
> > have to instantiate each possible dim x type combination. The
> > dimension is only specified once at the constructor.
>
> That change sacrifices all the type-safety of C++ though. Now all of
> a sudden, a 3D-tree is of the same type as a 4D-tree. I don't like
> it. There must be a better way for swig to handle this, isn't there?
>
> Anyway, I am not developing anymore, so feel free to ignore what
> I have to say...
>

I agree with Martin, and I was also wondering if there was a way to avoid
breaking all the user's code that has a number in the template.

So, Willi, would it be possible to adjust your patch so that IF the N
template parameter is zero, only THEN does it morph kdtree into a
dynamic-dimensions tree ? ie Ignore the constructor parameter unless N=0

I don't really like that solution either, as it relies on reusing N for a
different purpose.  What if someone wants to detect errors where their
program is trying to create a zero-dimension tree (possible when users
create additional templated layers around kdtree).

Maybe we should add a new template... bool dynamic_N or something like that.

cheers
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20090328/94512c78/attachment.htm 


More information about the libkdtree-devel mailing list