Dynamic dimensions

martin f krafft madduck at debian.org
Sun Mar 29 13:24:34 UTC 2009


also sprach Paul Harris <paulharris at computer.org> [2009.03.28.1301 +0100]:
> This can be done, but the problem is that you end up with an
> entirely different class for the specialisation.

In my world, a tree with dynamic dimensions *is* a completely
different type.

> So you would have to either move all of the methods etc into a base
> class kdtree_base and inherit them into the higher templated classes,
> or you would have to do some #include magic.
> Just means extra duplicated code.  Constructors often have to be
> duplicated too.  PITA

Yes, but — don't hold this against me or take it personal — the
proposed alternative is a hack which would cause everyone who
understood the benefits of strong typing to turn their back on you.

> If someone defines KDTree<3> tree, but does not use the dynamic
> constructor, then no problem. The constructor is not generated and
> the check_n_is_zero<N> is never generated.

Maybe we could use -1 instead of 0. But in any case, I don't really
like it. And template specification also means code duplication btw.

-- 
 .''`.   martin f. krafft <madduck at d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
 
gentoo: the performance placebo.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
Url : http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20090329/542729fb/attachment.pgp 


More information about the libkdtree-devel mailing list