For an overview of how to use the phys_quan library, see the file main.cpp. The comments there explain how to use it. Design criteria: - Basic types (length_t, mass_t, speed_t, etc.) must be provided by the library. - Expressions with phys_quans must be as simple and clear as any other expressions, i.e. they must use normal operator overloading. - It must be syntactically impossible to write a legal expression that assigns a value to a physical quantity without specifying the units. E.g. "width = 3 meters" and "width = 3 feet" are ok, but "width = 3" must be caught as an error by the compiler. - Any attempt to assign (or pass as an argument) a phys_quan value to a phys_quan variable of different dimension must be caught as a compile-time error. - Conversions to and from any compatible units (i.e. of the same dimension, such as meters and feet) at any time must be possible and use a clear, simple syntax. - Both SI and Imperial units must be available. There should be no problems created if the units are mixed. - phys_quans should not be limited to m-kg-s, but must also be able to handle A-K-mol-cd. - It should be possible to define physical constants (like the speed of light) clearly and efficiently. - It must be possible for the user to define new types (e.g. density_t), units (e.g. furlong), and constants. These user-defined entities must use the same syntax and be just as efficient as those supplied by the library. - Any calculations that can be done at compile time should be. This implies that the run-time overhead of using the phys_quan library (as compared to just using raw numbers) will normally be zero. The result of expressions should be as follows. (phys_quan1 and phys_quan2 denote physical quantities of different dimensions). "ERROR" means caught at compile-time - phys_quan = number -> ERROR - number = phys_quan -> ERROR - phys_quan = phys_quan -> phys_quan & - phys_quan1 = phys_quan2 -> ERROR - phys_quan + number -> ERROR - number + phys_quan -> ERROR - phys_quan + phys_quan -> phys_quan - phys_quan1 + phys_quan2 -> ERROR - phys_quan - number -> ERROR - number - phys_quan -> ERROR - phys_quan - phys_quan -> phys_quan - phys_quan1 - phys_quan2 -> ERROR - phys_quan * number -> phys_quan - number * phys_quan -> phys_quan - phys_quan1 * phys_quan2 -> phys_quan3 (or number) - phys_quan / number -> phys-quan - number / phys_quan1 -> phys_quan2 - phys_quan / phys_quan -> number - phys_quan1 / phys_quan2 -> phys_quan3 - phys_quan relop number -> ERROR - number relop phys_quan -> ERROR - phys_quan relop phys_quan -> bool - phys_quan1 relop phys_quan2 -> ERROR - ostream << phys_quan -> ostream & The user must *not* have to specify the result type of such expressions; it must be deduced by the compiler automatically.