Boost logo

Boost :

From: jbandela_at_[hidden]
Date: 2001-06-06 13:47:31


> Not likely, since this "solution" requires registering the types
> explicitly much as the "solution" poted in the files section does.

I think my "solution" has an advantage in that it scale's better. In
the example code of the article mentioned, changing short to short*
caused compiler errors. My solution handles most (if not all)
combinations of those types for example. The following three
registrations

JRB_TYPE0(int)
JRB_TYPE1(allocator)
JRB_TYPE2(vector)

could handle
int*, int**, const int*, int * const, volatile const int,
vector<int>, vector<const int*>, vector<vector<int*>&>, and so on

  
> This is not a library replacement for a language typeof().

No it is not, but it can be useful. In C++ programming, though there
are often a lot of types used, they are composed of much
fewer "basic" types. For example, Typelists.

Typelist<int,Typelist<const
int,<Typelist<int*,Typelist<int**,NullType> > > > > (I may not have
got all the angles braces)

Has 9 types (at least). However it is compolsed of only 3 entities
1. a built in type - int
2. a non-template class NullType
3. A template named Typelist that takes 2 type parameters

Those three entities can describe any combination Typelist, NullType,
int, and any pointers, pointers to pointers, const, volatile, etc


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk