Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-11-05 08:50:33

Hi again,

Thanks to everyone who has returned comments on the pqs library.
My current instinct is not to put it forward as a boost proposal at this
time. Having worked on the library for some time I have found it an
interesting project., however the recurrent theme from the feedback is that
the documentation needs to be much clearer. I also think I need to
demonstrate application areas. IOW are physical quantities a practical
proposition? Compile time dimensional analysis is a great example for
showing of C++ at its best. However I do often ask myself the question as to
whether this is 'showing off ' for academic interest rather than
practicality. IOW once one starts to use a physical-quantity type, one soon
finds that it becomes impossible to 'mesh' the type with other libraries.
Examples here are std::complex and matrices. In both cases it requires a
reimplementation to account for the different return types. Another issue is
that the physical quantity type is restricted to compile-time. A runtime
type is certainly possible though it would be considerably larger as it
would need to carry the dimension and unit information along with it at run

IOW a collection of types representing physical-quantities does not seem to
be complete without being based in a much larger framework, with a lot more
Perhaps this is an example of taking strong type checking too far, and may
be the reason that a physical quantities library will not become a practical
Whatever.. the library is certainly a facinating curiosity at least, and my
curiosity as to where it will lead is not diminished. Here for example are a
couple of types representing homogeneous vectors and transformation matrices
for 2D transforms. Note that operations such as concatenation, determinant,
cofactor and inverse all work satisfactorily within the strong type

 PQ == the physical-quantity parameter type ( eg length::m)
 K/PQ == the 'reciprocal' of the type ( eg reciprocal_length::div_m }
 N == numeric type ( eg double)

 rc_matrix<PQ>( // 2D transformation matrix laid out in row/column format
//using a tuple of tuples
  N, N, K/PQ,
  N, N, K/PQ,
  PQ, PQ, N

   row_vector<PQ>( // 2D vertex in homogeneous coordinates implicit
//conversion to/from x,y vertex<PQ>.
  N, N, K/PQ

Andy Little

Boost list run by bdawes at, gregod at, cpdaniel at, john at