A question for you all: size_t or unsigned int

Paul Harris paulharris at computer.org
Thu Nov 13 13:11:08 UTC 2008


2008/11/13 Paul Harris <paulharris at computer.org>

>
>
> 2008/11/13 martin f krafft <madduck at debian.org>
>
>> also sprach Paul Harris <paulharris at computer.org> [2008.11.13.1302
>> +0100]:
>> > that way, the same code will "scale up" from an 8 bit microcpu up
>> > to the 64 bit gorillas
>>
>> Yes, so the question is whether we want/need this. Once you start to
>> serialise/archive/save kdtrees, you are making it unnecessarily
>> difficult. unsigned int should be enough for everybody, no? :)
>>
>
<snip my jibber-jabber>


>
>> (or maybe this should be a #define-able option?)
>>
>>
i looked around and think this is a good suggestion ...
the stl classes all declare a size_type typedef in the container, so that's
what we can do and put a #define option in one spot.

however, our code is scattered across a few files with accessors, iterators,
that all need to use the same typedef...

so what i'll do is create a new header file... kdtree_fwd.hpp and do a
typedef size_t size_type in the KDTree namespace there.

the header file can also include a slim declaration of the kdtree template
class, so if users want to do something like this :

joes_class.hpp (note header file)
#include <kdtree++/kdtree_fwd.hpp>

class Joe
{
   KDTree::kdtree<a,b,c> * the_tree;
};

note that because its a pointer, he won't need to #include anything except
the very small kdtree_fwd.hpp file.

i'll go ahead unless there are objections...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20081113/2255f956/attachment.htm 


More information about the libkdtree-devel mailing list