
--- Andy Little wrote:
Hi Cromwell,
Hey, Andy.
Registration of each metafunction occurs at the end of the header file in which the metafunction is declared, as per the "don't pay for what you don't use" policy.
Thats great and suits me, but I was wondering whether it might be better to really make this optional, either by looking for a macro BOOST_TYPEOF_PLEASE_REGISTER_MY_INCLUDED_TYPES (or whatever name) or by putting the typeof stuff in a separate include file.
The macro route is probably better.
Point is that on some compilers where there is no inbuilt typeof, then Boost.Typeof causes a big slow down in compile-performance. AFAIK this happens in VC8, though I haven't tried this compiler myself so I'm only guessing.
You can #define BOOST_TYPEOF_COMPLIANT to force emulation mode, so you don't have to guess.
[..] I would question the name 'inverse' to replace 'reciprocal', because it needs a function to take the inverse of, whereas reciprocal is unequivocal:
Okay. It's probably better than 'multiplicative_inverse' as well. OTOH, we'd also break a long-standing tradition of using ambiguous names for certain mathematical functions. :)
FWIW I have attached some other related functions that might be useful.
boost::mpl::math::is_positive<T>, to go with boost::mpl::math::is_negative<T> boost::mpl::math::is_rational_constant<T>, to go with boost::mpl::is_integral_constant<T> boost::mpl:rational_int<> boost::mpl:rational_long<>
is_positive<> is okay, as long as is_strictly_positive<> (which zero<> is not) goes with it. I'd like to know how your Physical Quantities library uses the other metafunctions, so I can see if there are more generic ways to facilitate such usage (e.g. for seamless interaction with double_c).
Finally regarding the boost::mpl::math::power function, I was told once upon a time that the traditional way to do this in mpl would be to call it just 'pow' after the runtime version. FWIW
No one told me. I just thought using full names was more readable (and educational, too; I didn't know "asin" stood for "arcus sine" until Peder Holt used that name). Cromwell D. Enage __________________________________ Yahoo! for Good - Make a difference this year. http://brand.yahoo.com/cybergivingweek2005/