A question for you all: size_t or unsigned int

martin f krafft madduck at debian.org
Thu Nov 13 13:17:13 UTC 2008


also sprach Paul Harris <paulharris at computer.org> [2008.11.13.1411 +0100]:
> 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...

I don't see the benefit of asking the user to include only that
file. I am also not sure about the typedef. That's nicer and
cleaner than a define, but I think that

#ifndef KDTREE_SIZE_T
#define KDTREE_SIZE_T unsigned int
#endif

in a header file included by all other header files, is a better way
forward. If the user now needed to override (which we assume is the
exception), s/he'd just

#define KDTREE_SIZE_T unsigned long long
#include <kdtree++/kdtree.hpp>

If s/he doesn't #define, then the default is used.

-- 
 .''`.   martin f. krafft <madduck at debian.org>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
never trust an operating system
for which you do not have the source.
                                                   -- source unknown
-------------- 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/20081113/69287eab/attachment-0001.pgp 


More information about the libkdtree-devel mailing list