Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-12-28 13:54:22


Hi Cromwell,

> "Cromwell Enage" wrote
> Issues addressed:
>
> * All metafunctions that can be instantiated in user
> code have been registered with Boost.Typeof (see
> typeof.cpp for a test case). 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. 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 havent tried this
compiler myself so I'm only guessing

> * The BOOST_MPL_AUX_TYPEOF_REGISTER_TYPE_C macro,
> defined in
> <boost/mpl/aux_/typeof/register_type_c.hpp>, enables
> one to register metafunctions that have the following
> form:
>
> template <
> typename ValueType
> , ValueType N1
> , ValueType N2
> , ...
> >
> struct metafunction
> {
> ...
> };
>
> This macro is currently used to register rational_c,
> mixed_number_c, and complex_number_c; it is hoped that
> vector_c, list_c, range_c, and integral_c will also be
> registered by it. (The _C suffix indicates that the
> macro is to be used to register types ending in _c.)

That looks useful ;-)

[..]

> * In case no one has noticed--and judging from the
> contents of pqs3_0_0.zip, this seems to be the
> case--there is now a math::inverse metafunction, so
> you don't need to roll your own reciprocal<>.

I wonder who that could be ;-)...Whatever, I would question the name 'inverse'
to replace 'reciprocal', because it needs a function to take the inverse of,
whereas reciprocal is unequivocal:

http://www.mathnstuff.com/math/spoken/here/1words/r/r13.htm

http://www.mathleague.com/help/fractions/fractions.htm#reciprocal

http://mathworld.wolfram.com/InverseFunction.html

---------------------

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::ml::math::is_rational_constant<T> , to go with
boost::mpl::is_integral_constant<T>
boost::mpl:rational_int<>
boost::mpl:rational_long<>

Let me know what you think . If you like them I'll write some tests for them.

----------------------

Finally regarding the boost::math::mpl::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

regards
Andy Little

begin 666 is_positive.hpp
M(VEF;F1E9B!"3T]35%]-4$Q?25-?4$]3251)5D5?2%!07TE.0TQ51$5$#0HC
M9&5F:6YE($)/3U-47TU03%])4U]03U-)5$E615](4%!?24Y#3%5$140-"B-I
M9B H9&5F:6YE9"!?35-#7U9%4BD@)B8@*%]-4T-?5D52(#X](#$R,# I#0HC
M("!P<F%G;6$@;VYC90T*(V5N9&EF#0H-"B\O($-O<'ER:6=H="!!;F1R97<@
M3&ET=&QE(#(P,#4*+R\*+R\@1&ES=')I8G5T960@=6YD97(@=&AE($)O;W-T
M(%-O9G1W87)E($QI8V5N<V4L(%9E<G-I;VX@,2XP+B *+R\@*%-E92!A8V-O
M;7!A;GEI;F<@9FEL92!,24-%3E-%7S%?,"YT>'0@;W(@8V]P>2!A=" *+R\@
M:'1T<#HO+W=W=RYB;V]S="YO<F<O3$E#14Y315\Q7S N='AT*0HO+PHO+R!3
M964@:'1T<#HO+W=W=RYB;V]S="YO<F<O;&EB<R]M<&P_at_9F]R(&1O8W5M96YT
M871I;VXN#0H-"@T*(VEN8VQU9&4@/&)O;W-T+VUP;"]A=7A?+V-O;F9I9R]F
M;W)W87)D:6YG+FAP<#X-"B-I;F-L=61E(#QB;V]S="]M<&PO875X7R]L86UB
M9&%?<W5P<&]R="YH<' ^#0HC:6YC;'5D92 \8F]O<W0O;7!L+VYE9V%T92YH
M<' ^#0HC:6YC;'5D92 \8F]O<W0O;7!L+V=R96%T97)?97%U86PN:'!P/@T*
M#0IN86UE<W!A8V4_at_8F]O<W1[;F%M97-P86-E(&UP;'L@;F%M97-P86-E(&UA
M=&A[#0H-"B @("!T96UP;&%T92 \='EP96YA;64_at_5#X-"B @("!S=')U8W0@
M:7-?<&]S:71I=F4@#0HC:68@(61E9FEN960_at_0D]/4U1?35!,7T-&1U].3U].
M15-4141?1D]25T%21$E.1PT*(" @(#H_at_9W)E871E<E]E<75A;#P-"B @(" @
M(" @(" @(%0L#0H@(" @(" @(" @("!N96=A=&4\5#X@#0H@(" @/GL-"B-E
M;'-E(" -"B @("![#0H@(" @(" @('1Y<&5D968_at_0D]/4U1?1$5$54-%1%]4
M65!%3D%-12 @9W)E871E<E]E<75A;#P-"B @(" @(" @(" @(%0L;F5G871E
M/%0^( T*(" @(" @(" ^.CIT>7!E('1Y<&4[#0HC96YD:68-"B @(" @(" @
M0D]/4U1?35!,7T%56%],04U"1$%?4U504$]25"@-"B @(" @(" @(" @(#$-
M"B @(" @(" @(" @("P@:7-?<&]S:71I=F4-"B @(" @(" @(" @("P@*%0I
M#0H@(" @(" @("D-"B @("!].PT*#0I]?7TO+R!B;V]S=#HZ;7!L.CIM871H
.#0H-"@T*(V5N9&EF#0H`
`
end

begin 666 rational_int.hpp
M(VEF;F1E9B!"3T]35%]-4$Q?34%42%]2051)3TY!3%])3E1?2%!07TE.0TQ5
M1$5$,0T*(V1E9FEN92!"3T]35%]-4$Q?34%42%]2051)3TY!3%])3E1?2%!0
M7TE.0TQ51$5$,0T*(VEF("AD969I;F5D(%]-4T-?5D52*2 F)B H7TU30U]6
M15(@/CT@,3(P,"D-"B,@('!R86=M82!O;F-E#0HC96YD:68-"@T*+R\@0V]P
M>7)I9VAT($%N9')E=R!,:71T;&4@,C P-0HO+PHO+R!$:7-T<FEB=71E9"!U
M;F1E<B!T:&4_at_0F]O<W0_at_4V]F='=A<F4_at_3&EC96YS92P_at_5F5R<VEO;B Q+C N
M( HO+R H4V5E(&%C8V]M<&%N>6EN9R!F:6QE($Q)0T5.4T5?,5\P+G1X="!O
M<B!C;W!Y(&%T( HO+R!H='1P.B\O=W=W+F)O;W-T+F]R9R],24-%3E-%7S%?
M,"YT>'0I"B\O"B\O(%-E92!H='1P.B\O=W=W+F)O;W-T+F]R9R]L:6)S+VUP
M;"!F;W(@9&]C=6UE;G1A=&EO;BX-"@T*(VEN8VQU9&4@/&)O;W-T+VUP;"]M
M871H+W)A=&EO;F%L+FAP<#X-"FYA;65S<&%C92!B;V]S='MN86UE<W!A8V4@
M;7!L>VYA;65S<&%C92!M871H>PT*#0H@(" @=&5M<&QA=&4\:6YT($XL(&EN
M="!$(#TQ/@T*(" @('-T<G5C="!R871I;VYA;%]I;G0_at_.B!R871I;VYA;%]C
G/&EN="P_at_3BP@1#Y[?3L-"B @( T*?7U]#0H-"B-E;F1I9_at_T*#0H@
`
end

begin 666 rational_long.hpp
M(VEF;F1E9B!"3T]35%]-4$Q?34%42%]2051)3TY!3%],3TY'7TA04%])3D-,
M541%1 T*(V1E9FEN92!"3T]35%]-4$Q?34%42%]2051)3TY!3%],3TY'7TA0
M4%])3D-,541%1 T*(VEF("AD969I;F5D(%]-4T-?5D52*2 F)B H7TU30U]6
M15(@/CT@,3(P,"D-"B,@('!R86=M82!O;F-E#0HC96YD:68-"@T*+R\@0V]P
M>7)I9VAT($%N9')E=R!,:71T;&4@,C P-0HO+PHO+R!$:7-T<FEB=71E9"!U
M;F1E<B!T:&4_at_0F]O<W0_at_4V]F='=A<F4_at_3&EC96YS92P_at_5F5R<VEO;B Q+C N
M( HO+R H4V5E(&%C8V]M<&%N>6EN9R!F:6QE($Q)0T5.4T5?,5\P+G1X="!O
M<B!C;W!Y(&%T( HO+R!H='1P.B\O=W=W+F)O;W-T+F]R9R],24-%3E-%7S%?
M,"YT>'0I"B\O"B\O(%-E92!H='1P.B\O=W=W+F)O;W-T+F]R9R]L:6)S+VUP
M;"!F;W(@9&]C=6UE;G1A=&EO;BX-"@T*(VEN8VQU9&4@/&)O;W-T+VUP;"]M
M871H+W)A=&EO;F%L+FAP<#X-"@T*;F%M97-P86-E(&)O;W-T>VYA;65S<&%C
M92!M<&Q[;F%M97-P86-E(&UA=&A[#0H-"B @("!T96UP;&%T93P@;&]N9R!.
M+"!L;VYG($0@/3$^#0H@(" @<W1R=6-T(')A=&EO;F%L7VQO;F<@.B!R871I
M;VYA;%]C/&QO;F<L($XL($0^>WT[#0H@(" -"GU]?0T*#0HC96YD:68-"@T*
!( ``
`
end

begin 666 is_rational_constant.hpp
M+R\@0V]P>7)I9VAT("A#*2 R,# U+3(P,#8_at_0W)O;7=E;&P_at_1"X_at_16YA9V4-
M"B\O($1I<W1R:6)U=&5D('5N9&5R('1H92!";V]S="!3;V9T=V%R92!,:6-E
M;G-E+"!697)S:6]N(#$N,"X-"B\O("A3964_at_86-C;VUP86YY:6YG(&9I;&4@
M3$E#14Y315\Q7S N='AT(&]R(&-O<'D_at_870-"B\O(&AT=' Z+R]W=W<N8F]O
M<W0N;W)G+TQ)0T5.4T5?,5\P+G1X="D-"@T*(VEF;F1E9B!"3T]35%]-4$Q?
M34%42%])4U]2051)3TY!3%]#3TY35$%.5%](4%!?24Y#3%5$140-"B-D969I
M;F4_at_0D]/4U1?35!,7TU!5$A?25-?4D%424].04Q?0T].4U1!3E1?2%!07TE.
M0TQ51$5$#0H-"B-I;F-L=61E(#QB;V]S="]M<&PO875X7R]C;VYF:6<O9F]R
M=V%R9&EN9RYH<' ^#0HC:6YC;'5D92 \8F]O<W0O;7!L+V%U>%\O;&%M8F1A
M7W-U<'!O<G0N:'!P/@T*(VEN8VQU9&4@/&)O;W-T+VUP;"]A<'!L>2YH<' ^
M#0HC:6YC;'5D92 \8F]O<W0O;7!L+W1A9RYH<' ^#0HC:6YC;'5D92 \8F]O
M<W0O;7!L+VUA=&@O<F%T:6]N86Q?=&%G+FAP<#X-"B-I;F-L=61E(#QB;V]S
M="]T>7!E7W1R86ET<R]I<U]S86UE+FAP<#X-"@T*;F%M97-P86-E(&)O;W-T
M('L@;F%M97-P86-E(&UP;"![;F%M97-P86-E(&UA=&A[#0H-"B @("!T96UP
M;&%T92 \='EP96YA;64_at_5&%G/@T*(" @('-T<G5C="!I<U]R871I;VYA;%]C
M;VYS=&%N=%]I;7!L#0H@(" @>PT*(" @(" @("!T96UP;&%T92 \='EP96YA
M;64_at_5#X-"B @(" @(" @<W1R=6-T(&%P<&QY#0HC:68@(61E9FEN960_at_0D]/
M4U1?35!,7T-&1U].3U].15-4141?1D]25T%21$E.1PT*(" @(" @(" @(#H@
M:7-?<V%M93Q486<L<F%T:6]N86Q?=&%G/@T*(" @(" @("![#0HC96QS90T*
M(" @(" @("![#0H@(" @(" @(" @(" O*@T*(" @(" @(" @(" @("H_at_365T
M869U;F-T:6]N(&-L87-S(')E='5R;B!T>7!E+@T*(" @(" @(" @(" @("HO
M#0H@(" @(" @(" @("!T>7!E9&5F('1Y<&5N86UE(&ES7W-A;64\#0H@(" @
M(" @(" @(" @(" @5&%G+ T*(" @(" @(" @(" @(" @(')A=&EO;F%L7W1A
M9PT*(" @(" @(" @(" @/CHZ='EP92!T>7!E.PT*(V5N9&EF(" O+R!"3T]3
M5%]-4$Q?0T9'7TY/7TY%4U1%1%]&3U)705)$24Y'#0H@(" @(" @('T[#0H@
M(" @?3L-"@T*(" @('1E;7!L871E(#QT>7!E;F%M92!4/@T*(" @('-T<G5C
M="!I<U]R871I;VYA;%]C;VYS=&%N= T*(" @(#H_at_87!P;'DQ/ T*(" @(" @
M(" @(" @:7-?<F%T:6]N86Q?8V]N<W1A;G1?:6UP;#P-"B @(" @(" @(" @
M(" @("!T>7!E;F%M92!T86<\5#XZ.G1Y<&4-"B @(" @(" @(" @(#XL#0H@
M(" @(" @(" @("!4#0H@(" @/CHZ='EP90T*(" @('L-"B @(" @(" @0D]/
M4U1?35!,7T%56%],04U"1$%?4U504$]25"@Q+"!I<U]R871I;VYA;%]C;VYS
M=&%N="P@*%0I*0T*(" @('T[#0I]?7T@("\O(&YA;65S<&%C92!B;V]S=#HZ
M;7!L.CIM871H#0H-"B-I;F-L=61E(#QB;V]S="]T>7!E;V8O='EP96]F+FAP
M<#X-"B-I;F-L=61E($)/3U-47U194$5/1E])3D-214U%3E1?4D5'25-44D%4
M24].7T=23U50*"D-"D)/3U-47U194$5/1E]214=)4U1%4E]414U03$%412AB
M;V]S=#HZ;7!L.CIM871H.CII<U]R871I;VYA;%]C;VYS=&%N="P@,2D-"@T*
M(V5N9&EF(" O+R!"3T]35%]-4$Q?34%42%])4U]2051)3TY!3%]#3TY35$%.
05%](4%!?24Y#3%5$140-"@``
`
end


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