|
Boost : |
From: Matthias Schabel (boost_at_[hidden])
Date: 2007-02-14 16:33:49
> The tags can be sortable without enumeration. The problem is that
> the ordering will be different in every translation unit....
So, as I understand it, the compiler has to generate a unique
typename for
every class, and that has to be consistent over all translation
units. It also
seems to me that somewhere this must get hashed into an integral value
or something so the compiler doesn't have to deal with strings as
internal
identifiers. Since we don't really care what enumerable value gets
assigned
to what system or to what tag, if we could somehow access the full
typename
or (even better) an integral hash of it, that would give us our
sortable value
automatically. For example, on g++ gives :
FN5boost5units10length_tagEvE
FN5boost5units2SI6systemEvE
for
typeid(length_tag()).name()
typeid(SI::system()).name()
If these could be hashed into a long int, that would be all we
needed. Probably
would involve very non-portable code, but it might be supportable on
a few
of the major compilers... I thought C++ name mangling was supposed to be
standardized...
> I would probably sort by dimension first to make checking the
> dimensions easier.
The way I'm envisioning it, any dimension typelist
<S1,T11,P11>...<S1,T1N,P1N><S2,T21,P21>...<S2,T2M,P2M><S3,T31,P31>...<S3
,T3L,P3L>
would split into three typelists that are equivalent to the
dimension<>::type typelist
we construct now. These could then be treated separately, and
appended afterwards.
Since no inter-system conversion happens in the operators, I think
that's all that would
happen. This will definitely not happen before the review, but I
think it could be done
and would be interesting...
Matthias
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk