[MPL.Math] Updated version now available

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. * 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.) * I also suspect that the recent problem with double_::aux::get_value() is one of endianness. Unfortunately I don't know which combination of macros will detect Solaris. Therefore, BOOST_MPL_CFG_IS_LITTLE_ENDIAN, defined in <boost/mpl/aux_/config/endian.hpp>, is currently set to zero. (Double-check me if I named it correctly.) * 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<>. Cromwell D. Enage __________________________________________ Yahoo! DSL Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com

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@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@8F]O<W1[;F%M97-P86-E(&UP;'L@;F%M97-P86-E(&UA M=&A[#0H-"B @("!T96UP;&%T92 \='EP96YA;64@5#X-"B @("!S=')U8W0@ M:7-?<&]S:71I=F4@#0HC:68@(61E9FEN960@0D]/4U1?35!,7T-&1U].3U]. M15-4141?1D]25T%21$E.1PT*(" @(#H@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@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@0F]O<W0@4V]F='=A<F4@3&EC96YS92P@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@.B!R871I;VYA;%]C G/&EN="P@3BP@1#Y[?3L-"B @( T*?7U]#0H-"B-E;F1I9@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@0F]O<W0@4V]F='=A<F4@3&EC96YS92P@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@0W)O;7=E;&P@1"X@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@86-C;VUP86YY:6YG(&9I;&4@ M3$E#14Y315\Q7S N='AT(&]R(&-O<'D@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@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@5&%G/@T*(" @('-T<G5C="!I<U]R871I;VYA;%]C M;VYS=&%N=%]I;7!L#0H@(" @>PT*(" @(" @("!T96UP;&%T92 \='EP96YA M;64@5#X-"B @(" @(" @<W1R=6-T(&%P<&QY#0HC:68@(61E9FEN960@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@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@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

--- 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.
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,
The macro route is probably better. 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:
FWIW I have attached some other related functions
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. :) 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<>
Finally regarding the boost::mpl::math::power function, I was told once upon a time that the traditional way to do
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). 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/

"Cromwell Enage" wrote
--- Andy Little wrote:
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).
Unfortunately I have now come upon an intractable problem. In debug mode on small examples I am getting " fatal error C1067: compiler limit : debug information module size exceeded". (compiles ok in release mode) In other examples I am getting a 'fatal' compiler out of keys error message. These, I presume, result from the large number of types being created by mpl behind the scenes. Whatever.. It renders the library useless for any practical use. Nevertheless I uploaded it to the vault as pqs_3_0_1 in Physical Quantities Units directory. To see what I mean ... In libs/examples directory try compiling "box_example.cpp" in debug mode and see if you get the same result. OTOH If the result is different let me know too! I can compare this with my previous non-boost pqs version ( where I never came upon this problem). When compile succeeds, the boost version for the same functionality takes about 5 times as long (25 seconds to 5 for example). IOW the boost version is completely impractical and far inferior to the non-boost version. I have to say that unfortunately I think that boost::mpl::math::rational is contributing to this problem. It is certainly much more heavyweight than the previous rational I used. I guess its designed for use with the other heavyweight mpl::math types, but unfortunately because the dimension of a physical_quantity needs to use 7 per quantity it really drags down the compile times. (mpl::transform is probably another large factor, maybe Typeof and all the mpl::math registrations dont help either) I dont actually see much of a way around this if I use mpl, [I think I can reduce it somewhat by only using rationals and not converting maybe ( I will try this next)], but I think currently that this style is not well suited for my physical quantities library, unfortunately, both because of the long compile times and because the junk in the library seems to clog up the compiler ,leaving no room for program material! yours depressedly Andy Little

"Andy Little" wrote
Unfortunately I have now come upon an intractable problem. In debug mode on small examples I am getting
" fatal error C1067: compiler limit : debug information module size exceeded". (compiles ok in release mode)
Hi Cromwell, I am concerned that "rational.hpp" depends on mpl::big_integral and mpl::double as well as some of their operations, which are huge anounts of header material It is simple to solve this by removing the numeric_casts for big_integral and double, from rational.hpp. I am sure they can be put in the numeric stuff for these types. then deleting <boost/mpl/math/double_/aux_/to_simplified_rational.hpp> <boost/mpl/math/double_tag.hpp> <boost/mpl/math/unsigned_big_integral_tag.hpp> <boost/mpl/math/big_integral_tag.hpp> <boost/mpl/math/double_tag.hpp> #includes that removes a large number of IMO unnecessary dependencies. --------------- As far as my other problems are concerned it appears that the gcd header is the culprit in producing a template too long for VC7.1 to hold in its debug database. I seem to remember that using a recursive algorithm that the maximum number of recursions for a 32 bit int is around 45. However your version of gcd actually uses more typedefs than this AFAICS, so I am pretty sure that it is Less efficient even in worst case which is rare anyway, while in usual case it is definitely less efficient for 32 bit integes anyway. (I think even 64 bit ints will converge reasonably fast). It might be worth trying a comparison .... Anyway changing the gcd algorithm to a recursive one wrapping boost::math::static_gcd (attached) in "boost/math/commn_factor.hpp" cures the above problem of compiler running out of keys and similar issues for me. --------------- As previously mentioned I also reckon that it would be best to make typeof registration separate. regards Andy Little begin 666 gcd.hpp M+R\@0V]P>7)I9VAT("A#*2 R,# U+3(P,#8@0W)O;7=E;&P@1"X@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@86-C;VUP86YY:6YG(&9I;&4@ M3$E#14Y315\Q7S N='AT(&]R(&-O<'D@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%]'0T1?2%!07TE.0TQ51$5$#0HC9&5F:6YE($)/3U-47TU03%]-051( M7T=#1%](4%!?24Y#3%5$140-"B-I;F-L=61E(#QB;V]S="]M871H+V-O;6UO M;E]F86-T;W)?8W0N:'!P/@T*(VEN8VQU9&4@/&)O;W-T+VUP;"]I;G1E9W)A M;%]C+FAP<#X-"B-I;F-L=61E(#QB;V]S="]M<&PO:6YT96=R86Q?8U]T86<N M:'!P/@T*#0IN86UE<W!A8V4@8F]O<W0@>R!N86UE<W!A8V4@;7!L('L@;F%M M97-P86-E(&UA=&@@>PT*#0H@(" @=&5M<&QA=&4@/'1Y<&5N86UE($YU;65R M:6-486<Q+"!T>7!E;F%M92!.=6UE<FEC5&%G,CX-"B @("!S=')U8W0@9V-D M7VEM<&P[#0H-"B @("!T96UP;&%T92 \/@T*(" @('-T<G5C="!G8V1?:6UP M;#P@#0H@(" @(" @(&)O;W-T.CIM<&PZ.FEN=&5G<F%L7V-?=&%G+" -"B @ M(" @(" @8F]O<W0Z.FUP;#HZ:6YT96=R86Q?8U]T86<-"B @(" ^>PT*(" @ M(" @("!T96UP;&%T92 \#0H@(" @(" @(" @("!T>7!E;F%M92!.,2P@#0H@ M(" @(" @(" @("!T>7!E;F%M92!.,@T*(" @(" @(" ^#0H@(" @(" @('-T M<G5C="!A<'!L>2 Z(&)O;W-T.CIM<&PZ.FEN=&5G<F%L7V,\#0H@(" @(" @ M(" @("!U;G-I9VYE9"!L;VYG+ T*(" @(" @(" @(" @8F]O<W0Z.FUA=&@Z M.G-T871I8U]G8V0\#0H@(" @(" @(" @(" @(" @3C$Z.G9A;'5E+"!.,CHZ M=F%L=64-"B @(" @(" @(" @(#XZ.G9A;'5E#0H@(" @(" @(#Y[?3L-"B @ M("!].PT*(" @( T*(" @#0H-"B @("!T96UP;&%T92 \='EP96YA;64@3C$L M('1Y<&5N86UE($XR/@T*(" @('-T<G5C="!G8V0@.B!G8V1?:6UP;#P-"B @ M(" @(" @(" @('1Y<&5N86UE($XQ.CIT86<-"B @(" @(" @(" L('1Y<&5N M86UE($XR.CIT86<-"B @(" @(" @/CHZ=&5M<&QA=&4@87!P;'D\3C$L3C(^ M.CIT>7!E>WT[#0H-"GU]?2 @+R\@;F%M97-P86-E(&)O;W-T.CIM<&PZ.FUA M=&@-"@T*(V5N9&EF(" O+R!"3T]35%]-4$Q?34%42%]'0T1?2%!07TE.0TQ5 %1$5$#0H` ` end

--- Andy Little wrote:
Hi Cromwell,
I am concerned that "rational.hpp" depends on mpl::big_integral and mpl::double as well as some of
Happy new year, Andy. their
operations, which are huge anounts of header material.
It is simple to solve this by removing the numeric_casts for big_integral and double, from rational.hpp. I am sure they can be put in the numeric stuff for these types.
As far as my other problems are concerned it appears
I've added <boost/mpl/math/rational_/rational.hpp>, which contains the minimal amount you need to use only boost::mpl::integral_c et. al. and boost::mpl::math::rational. The <boost/mpl/math/rational.hpp> header is reserved for those who need the kitchen sink. that the
gcd header is the culprit in producing a template too long for VC7.1 to hold in its debug database.
Anyway changing the gcd algorithm to a recursive one wrapping boost::math::static_gcd (attached) in "boost/math/commn_factor.hpp" cures the above
*sigh* I *hate* it when compile-time complexity differs from run-time complexity. problem of
compiler running out of keys and similar issues for me.
I've reimplemented the integral_c_tag specialization of boost::mpl::math::gcd so that it's wrapped around an MPL-ized version of boost::math::static_gcd. Performance should be close to what you're looking for.
As previously mentioned I also reckon that it would be best to make typeof registration separate.
I thought you said "optional". Anyway, typeof registration is now disabled by default; you must now define the macro BOOST_MPL_CFG_REGISTER_WITH_TYPEOF to enable it. Cromwell D. Enage __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

"Cromwell Enage" wrote
I've added <boost/mpl/math/rational_/rational.hpp>, which contains the minimal amount you need to use only boost::mpl::integral_c et. al. and boost::mpl::math::rational. The <boost/mpl/math/rational.hpp> header is reserved for those who need the kitchen sink.
That seems like an odd way to do things. I would expect the main header for rational to just contain the interface for rational itself. Isnt it normally beneficial to try to limit per header dependencies? What is the rationale behind adding double and big_integral in there too? [...]
Anyway changing the gcd algorithm to a recursive one wrapping boost::math::static_gcd (attached) in "boost/math/commn_factor.hpp" cures the above problem of compiler running out of keys and similar issues for me.
I've reimplemented the integral_c_tag specialization of boost::mpl::math::gcd so that it's wrapped around an MPL-ized version of boost::math::static_gcd. Performance should be close to what you're looking for.
That looks a lot better. (Once I've waded through the macros). I'm not sure if you use rational with mpl integral constants in your double implementation, but if you do that mod should help compile times a there too.
As previously mentioned I also reckon that it would be best to make typeof registration separate.
I thought you said "optional". Anyway, typeof registration is now disabled by default; you must now define the macro BOOST_MPL_CFG_REGISTER_WITH_TYPEOF to enable it.
For each type, typeof registration is quite a heavyweight process, so I want to only register those types that I Really need to. Currently this is not the case so I get for example mpl::math::zero, mpl::math::denominator, etc etc, etc, etc and the kitchen sink registered for me though I dont need registration for the vast majority of these types, also bearing in mind that space in the Typeof vector is limited, so I dont think registering everything is a practical way to do it. It must be possible for me the user to be able to register each type separately (only if it becomes necessary.) Of coures the problem comes then because mpl works in terms of concepts rather than type-names, so I might get a int_, a integral_c, or a long_. , a rational or a simplified_rational. I dont really know a clean solution to the problem of what to register if I use mpl, (maybe 'per concept registration would be OK) but I dont think registering everything at one go is a good solution. Throwing the baby out with the bathwater. Having come up against compile times/debris problems in mpl as applied specifically to the pqs library ( mostly due to mpl::vector), In pqs_3_0_1, as an alternative style to the mpl way, I am currently thinking in terms of how to use the minimum variety of types, parameters and functions etc. This line of thinking means for instance that I would have a (custom for the pqs library) rational<1,2> , note not rational_c<int,1,2> or rational<int_<1>,long_<2> >. and also no conversion via the tag system between rational and int_ for instance. I can use boost::is_same rather than mpl::equal_to for comparison, which represents another reduction in complexity as well as a reduction in potential number of types created automatically. Similarly result of an operation on two rationals will be a rational, so that I can use boost::is_same for comparison of types comprised of rationals, have a definite 'type' interface and a known documentable type as result of operations and reduce the number of types requiring Typeof registration. IOW I have decided to abandon use of mpl entirely in the next version of pqs library and see if that helps specifically with the compiler out of keys issue (which I am still getting currently when using headers with a lot of physical_quantity types) and the compile time issue. These are greater problems in pqs than some other uses of mpl because the idea is to be able to use these types to 'seamlessly' replace bult-in types such as double and int. That means absolutely minimal effect on compilation time and of course minimal use of compiler resources too. regards Andy Little

"Cromwell Enage" wrote
I've added <boost/mpl/math/rational_/rational.hpp>, which contains the minimal amount you need to use only boost::mpl::integral_c et. al. and boost::mpl::math::rational. The <boost/mpl/math/rational.hpp> header is reserved for those who need the kitchen sink.
That seems like an odd way to do things. I would expect the main header for rational to just contain the interface for rational itself. Isn't it normally beneficial to
--- Andy Little wrote: try to limit
per header dependencies? What is the rationale behind adding double and big_integral in there too?
It's an unfortunate artefact of the implementation. If I could write numeric_cast<double_c_tag,rational_tag> without using numerator<double_c_tag>, or write numerator<double_c_tag> without returning simplified_rational<big_integral...>, I would. In the meantime, the main problem we've run into here is one of granularity. With integral_c and friends, you can just #include <boost/mpl/integral_c.hpp> #include <boost/mpl/plus.hpp> ... typedef plus<integral_c<long,1>,integral_c<short,2>
three; Not so with these other numeric constants. You can't #include <boost/mpl/math/rational.hpp> #include <boost/mpl/plus.hpp> without #include <boost/mpl/math/rational_/plus.hpp> One of the two files must include this one. It's not going to be plus, so it has to be rational. Furthermore, for the moment, I can't be sure which operations will or will not be used...so I have to #include them all. To achieve the finer level of granularity you seek, then, I need a safe way to #include certain files if and only if other files are #included, e.g. #include <boost/mpl/math/rational.hpp> #include <boost/mpl/plus.hpp> implies #include <boost/mpl/math/rational_/plus.hpp> I'll look into it when I get the chance.
I'm not sure if you use rational with mpl integral constants in your double implementation, but if you do that mod should help compile times a there too.
It's not *my* double implementation, it's Peder Holt's, and the metadata are already stored int BOOST_STATIC_CONSTANTs.
Anyway, typeof registration is now disabled by default; you must now define the macro BOOST_MPL_CFG_REGISTER_WITH_TYPEOF to enable it.
For each type, typeof registration is quite a heavyweight process, so I want to only register those types that I Really need to. Currently this is not the case so I get for example mpl::math::zero, mpl::math::denominator, etc etc, etc, etc and the kitchen sink registered for me though I don't need registration for the vast majority of these types, also bearing in mind that space in the Typeof vector is limited, so I don't think registering everything is a practical way to do it.
Okay.
It must be possible for me the user to be able to register each type separately (only if it becomes necessary). Of course the problem comes then because mpl works in terms of concepts rather than type-names, so I might get an int_, an integral_c, or a long_; a rational or a simplified_rational. I don't really know a clean solution to the problem of what to register if I use mpl, (maybe 'per concept registration' would be OK) but I don't think registering everything at one go is a good solution.
If you can ensure that the *only* syntax you use for any operation (numeric or otherwise) is typedef typename some_op<...>::type some_constant; and not typedef some_op<...> some_constant; then maybe #defining a macro BOOST_MPL_CFG_TYPEOF_NO_REGISTER_FUNCTIONS will suffice.
[snip future plans w/o MPL]
Try to eliminate the use of mpl::vector first, since it's the biggest slowdown for you. See if you can replace it with Boost.Preprocessor constructs. This method worked well for me when I gave big_integral an overhaul. Cromwell D. Enage __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

"Cromwell Enage" wrote
In the meantime, the main problem we've run into here is one of granularity. With integral_c and friends, you can just
#include <boost/mpl/integral_c.hpp> #include <boost/mpl/plus.hpp> ... typedef plus<integral_c<long,1>,integral_c<short,2>
three;
Not so with these other numeric constants. You can't
#include <boost/mpl/math/rational.hpp> #include <boost/mpl/plus.hpp>
without
#include <boost/mpl/math/rational_/plus.hpp>
The convention of headers used with integral_constants is already invalid because of the use of the mpl::math namespace, therefore I dont see using a different design as a problem.
One of the two files must include this one. It's not going to be plus, so it has to be rational. Furthermore, for the moment, I can't be sure which operations will or will not be used...so I have to #include them all.
Once the convention of each boost::math's types files having its own directory is set I would be quite happy with: #include <boost/mpl/math/rational.hpp> #include <boost/mpl/math/rational_/plus.hpp> BTW What is the purpose of '_' suffix. on the directory name?
To achieve the finer level of granularity you seek, then, I need a safe way to #include certain files if and only if other files are #included, e.g.
#include <boost/mpl/math/rational.hpp> #include <boost/mpl/plus.hpp>
implies
#include <boost/mpl/math/rational_/plus.hpp>
I'll look into it when I get the chance.
As stated above, just tell the user to get used to the convention of #include <boost/mpl/math/rational_/plus.hpp>
I'm not sure if you use rational with mpl integral constants in your double implementation, but if you do that mod should help compile times a there too.
It's not *my* double implementation, it's Peder Holt's, and the metadata are already stored int BOOST_STATIC_CONSTANTs.
Ok... Apologies to Peder Holt for misattribuing it. [..]
If you can ensure that the *only* syntax you use for any operation (numeric or otherwise) is
typedef typename some_op<...>::type some_constant;
and not
typedef some_op<...> some_constant;
then maybe #defining a macro BOOST_MPL_CFG_TYPEOF_NO_REGISTER_FUNCTIONS will suffice.
In pqs the typeof interface is comprised of a limited number of types and certainly not mpl operations . I would expect to have the granularity primarily at the level of each type in the librarys interface. That means a separate register_X_with_typeof.hpp header for each type. The messy problem of exactly what type to register in mpl I now think needs to be left to the user, because the mpl library author cant know how the user will use the library. BTW while on the issue of result type of operations The member ::type of rational being a simplified_rational sticks out as being really odd. and with no precedent in the integral_constants. As an example of how odd it strikes me ... If this logic was applied to intgral_constants then the result type of mpl::plus<int_<X>,int_<Y> > would be added_int<Z>. OTOH I would expect the format to be either something like: template <typename N, typename D> struct rational{ typedef N numerator; // available for reflection, but no operations on these here typedef D denominator; //... typedef rational type; // rational is a unary_metafunction }; // then use (tediously) template <typename Rational> struct simplify_rational{ typedef typename apply_simplification_impl<Rational>::type type; // type is a rational<X,Y> where eg '5' /'10' --> '1'./ '2 'etc }; IOW simplification should be an interface operation to simplify a rational rather than a distinct user type resulting from the operation. Or alternatively and more practical IMO because simplification is be required before and after any operation anyway (to prevent overflow) it would relieve the tedium to just do the simplification in place. template <typename N, typename D> struct rational{ impl: typedef detail::simplify_rational_impl<N,D> > impl; public: typedef typename impl::numerator numerator ; typedef typename impl::denominator denominator ; typedef rational<numerator, denominator> type ; // simplification in place }; IOW I dont see any advantage to making the member ::type of a rational other than a rational.
[snip future plans w/o MPL]
Try to eliminate the use of mpl::vector first, since it's the biggest slowdown for you. See if you can replace it with Boost.Preprocessor constructs. This method worked well for me when I gave big_integral an overhaul.
OK thanks for the tip. regards Andy Little

"Cromwell Enage" wrote
Try to eliminate the use of mpl::vector first, since it's the biggest slowdown for you. See if you can replace it with Boost.Preprocessor constructs. This method worked well for me when I gave big_integral an overhaul.
Unfortunately if I use mpl::rational then I need to use mpl::equal_to for comparison. The 'dimension' of a physical_quantity is made of rationals so I now have to use mpl::equal_to for comparison of those. Alternatively by defining my own rational I can use boost_is_same to compare dimensions. What this means is that for any particular type I only have one possible pattern of parameters matching a particular type. This both saves compiler resources and speeds up compilation. For this reason I have opted to remove use of mpl::rational as well as mpl::vector from the next version of pqs. I do question why plus<int_<X>, int_<Y> > ::type is not guaranteed to be an int_<Z> however. This is the source of the problems with my use of mpl I think. This type of functionality is mentioned as surprising in http://www.boost.org/libs/mpl/doc/tutorial/implementing.html in relation to vector_c , but the principle issue is the same. If mpl were to be standardised I would question whether this behaviour is the best one. regards Andy Little

"Andy Little" <andy@servocomm.freeserve.co.uk> wrote
For each type, typeof registration is quite a heavyweight process,
so I want to only register those types that I Really need to. Currently this is not
so I get for example mpl::math::zero, mpl::math::denominator, etc etc, etc, etc and the kitchen sink registered for me though I dont need registration for
Why is it heavyweight? Registering a type is just creating a couple of template specializations -- that's it. the case the
vast majority of these types, also bearing in mind that space in the Typeof vector is limited,
What do you mean by the "space in the typeof vector"? How is it related to the number of registered types?
so I dont think registering everything is a practical way to do it.
What do you mean by everything? I would recommend registering types and templates that can be present in the types used by your users.
It must be possible for me the user to be able to register each type separately (only if it becomes necessary.) Of coures the problem comes then because mpl works in terms of concepts rather than type-names, so I might get a int_, a integral_c, or a long_. , a rational or a simplified_rational. I dont really know a clean solution to the problem of what to register if I use mpl, (maybe 'per concept registration would be OK) but I dont think registering everything at one go is a good solution.
I would register your own types/templates leaving mpl types/templates to either mpl authors or users. Then again, you could wear an mpl hat and register its types, but I don't think this should become a part of your library. Regards, Arkadiy

"Arkadiy Vertleyb" wrote in message
Why is it heavyweight? Registering a type is just creating a couple of template specializations -- that's it.
[..]
What do you mean by the "space in the typeof vector"? How is it related to the number of registered types?
Sorry I got confused about the using the typeof vector . Looking in to it again registering a new type is just a specialistion on an int operation. I guess that isnt how I remembered it.
What do you mean by everything? I would recommend registering types and templates that can be present in the types used by your users.
If the time for a large amount of registrations isnt significant then I apologise fo being misleading about it. I always understood typeof useage to be quite heavyweight, so I was quite worried about the large number of types automatically registered in last version of boost::mpl::math library. However maybe I'm blaming the long compile times I'm getting on typeof, when in fact its just mpl::vector thats to blame. Currently I am in process of removing mpl::vector from my code to test this out. [...]
I would register your own types/templates leaving mpl types/templates to either mpl authors or users. Then again, you could wear an mpl hat and register its types, but I don't think this should become a part of your library.
Bearing in mind that I have been getting a compiler out of keys error message recently in even small tests, which as you will understand basically renders my library a useless resource hog, I am now trying to be extremely careful to add as little unnecessary clutter in headers as possible. That includes not wishing to register unneccesary types with Typeof if at all possible. regards Andy Little

"Andy Little" <andy@servocomm.freeserve.co.uk> wrote
I always understood typeof useage to be quite heavyweight, so I was quite worried about the large number of types automatically registered in last version of boost::mpl::math library.
Well, when the types are registered, the specializations are created by preprocessor, and so, theoretically, it may consume some noticable time. However, I don't believe it should be a problem... When a type is actually being deduced, there are two parts that consume compile time: 1) The type needs to be encoded and decoded. The time necessary for this operation is linearly proportional to the complexity of the type (the size of encoding vector). The factor is about 10 template instantiations per node (or something like this -- I estimated this in the past, and things changed since then). 2) The expression needs to be passed to the template function so that the compiler deduce the type. This is done BOOST_TYPEOF_LIMIT_SIZE times per BOOST_TYPEOF invocation. Of these two, the first one is most significant. On my 1.5 GHz PC, with BOOST_TYPEOF_LIMIT_SIZE=50, vc71 can compile 10 BOOST_TYPEOF's of fundamental types in under one second. However, it may take about 2 sec to compile BOOST_TYPEOF of one more complicated, e.g., Spirit expression of about 45 nodes. The inclusion of typeof.hpp takes 2 to 3 seconds. The time is spent registering fundamental types, pointers, functions, etc.
Bearing in mind that I have been getting a compiler out of keys error message recently in even small tests, which as you will understand basically renders my library a useless resource hog, I am now trying to be extremely careful to add as little unnecessary clutter in headers as possible. That includes not wishing to register unneccesary types with Typeof if at all possible.
You may want to consider the strategy we used with the STL types -- for each STL header we defined a corresponding typeof header which included the STL header and registered the types. Then, depending on whether the typeof functionality is needed, the user can do either: #include <vector> or #include <boost/typeof/std/vector.hpp> Regards, Arkadiy

At 20:37 2006-01-14, Arkadiy Vertleyb wrote:
"Andy Little" <andy@servocomm.freeserve.co.uk> wrote
I always understood typeof useage to be quite heavyweight, so I was quite worried about the large number of types automatically registered in last version of boost::mpl::math library.
Well, when the types are registered, the specializations are created by preprocessor, and so, theoretically, it may consume some noticable time. However, I don't believe it should be a problem...
When a type is actually being deduced, there are two parts that consume compile time:
1) The type needs to be encoded and decoded. The time necessary for this operation is linearly proportional to the complexity of the type (the size of encoding vector). The factor is about 10 template instantiations per node (or something like this -- I estimated this in the past, and things changed since then).
2) The expression needs to be passed to the template function so that the compiler deduce the type. This is done BOOST_TYPEOF_LIMIT_SIZE times per BOOST_TYPEOF invocation.
Of these two, the first one is most significant. On my 1.5 GHz PC, with BOOST_TYPEOF_LIMIT_SIZE=50, vc71 can compile 10 BOOST_TYPEOF's of fundamental types in under one second. However, it may take about 2 sec to compile BOOST_TYPEOF of one more complicated, e.g., Spirit expression of about 45 nodes.
The inclusion of typeof.hpp takes 2 to 3 seconds. The time is spent registering fundamental types, pointers, functions, etc.
Bearing in mind that I have been getting a compiler out of keys error message recently in even small tests, which as you will understand basically renders my library a useless resource hog, I am now trying to be extremely careful to add as little unnecessary clutter in headers as possible. That includes not wishing to register unneccesary types with Typeof if at all possible.
You may want to consider the strategy we used with the STL types -- for each STL header we defined a corresponding typeof header which included the STL header and registered the types.
Then, depending on whether the typeof functionality is needed, the user can do either:
#include <vector>
or
#include <boost/typeof/std/vector.hpp>
if its name were vector instead of vector.hpp I could switch between them simply by telling my compiler to look in boost/typeof/std before the standard locatons for includes. btw, shouldn't that be #include "boost/typeof/std/vector.hpp" instead?
Regards, Arkadiy
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law"

"Victor A. Wagner Jr." <vawjr@rudbek.com> wrote
Arkadiy Vertleyb wrote:
You may want to consider the strategy we used with the STL types -- for each STL header we defined a corresponding typeof header which included the STL header and registered the types.
Then, depending on whether the typeof functionality is needed, the user can do either:
#include <vector>
or
#include <boost/typeof/std/vector.hpp>
if its name were vector instead of vector.hpp I could switch between them simply by telling my compiler to look in boost/typeof/std before the standard locatons for includes.
I am afraid, since the std header is #included by the typeof header, this would not achieve the desired effect, since the line: #include <vector> in the typeof header would reffer, again, to the typeof header.
btw, shouldn't that be #include "boost/typeof/std/vector.hpp" instead?
Should it? Isn't this equivalent in this particular context? Regards, Arkadiy

In other examples I am getting a 'fatal' compiler out of keys error message.
These, I presume, result from the large number of types being created by mpl behind the scenes. Whatever.. It renders the library useless for any practical use. Nevertheless I uploaded it to the vault as pqs_3_0_1 in Physical Quantities Units directory. To see what I mean ... In libs/examples
--- Andy Little wrote: directory
try compiling "box_example.cpp" in debug mode and see if you get the same result.
After fixing some GCC errors wrt 1e##exponent and excess typenames, some attempts run 30 minutes before encountering more errors. But that was before I updated mpl_math. If compile times don't improve significantly enough, I may have to reimplement rational_c the way I did big_integral. Cromwell D. Enage __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

"Cromwell Enage" <sponage@yahoo.com> wrote
* The BOOST_MPL_AUX_TYPEOF_REGISTER_TYPE_C macro, defined in <boost/mpl/aux_/typeof/register_type_c.hpp>
Hmmm, I am kind of surprised it is working... I can see two problems here: 1) BOOST_TYPEOF_REGISTER_[...] macros depend on the __LINE__, and so can't be used directly with BOOST_PP_ENUM, etc., and 2) These macros internally use BOOST_PP_ENUM, which I don't think is re-entrant... Regards, Arkadiy

"Arkadiy Vertleyb" <vertleyb@hotmail.com> wrote in message news:dov01a$hjb$1@sea.gmane.org...
"Cromwell Enage" <sponage@yahoo.com> wrote
* The BOOST_MPL_AUX_TYPEOF_REGISTER_TYPE_C macro, defined in <boost/mpl/aux_/typeof/register_type_c.hpp>
Hmmm, I am kind of surprised it is working...
Now I understand why it works (at least on MSVC), and this is a typeof bug, unfortunately, since it gives you a false sence of security while working with this compiler, but the same code (I am pretty sure) will not compile with other compilers. The reason is that I decided to use MS-specific __COUNTER__ macro for MSVC, and this macro works differently from BOOST_PP_COUNTER which is used for other compilers, so much different, it turned, that it hid the problem. I will have to start using BOOST_PP_COUNTER for MSVC. Once I change this, the code that repeats BOOST_TYPEOF_REGISTER_[...] via BOOST_PP_SEQ_ENUM, BOOST_PP_REPEAT, etc., will stop compiling on MSVC (as it is not compiling on other compilers now) since it will use the same IDs for all elements of the sequence. A way to deal with this would be to explicitly supply IDs (see http://article.gmane.org/gmane.comp.lib.boost.devel/136147/match=typeof for an example), but for this I will have to add one macro to typeof. As far as BOOST_PP_ENUM reentrancy is concerned, we only use this macro with template template parameters, so if you don't care about them your code should be fine. I'll see what can be done to make the typeof registration usable with all the Boost PP looping constructs. Regards, Arkadiy

--- Arkadiy Vertleyb wrote:
"Cromwell Enage" wrote
* The BOOST_MPL_AUX_TYPEOF_REGISTER_TYPE_C macro, defined in <boost/mpl/aux_/typeof/register_type_c.hpp>
Hmmm, I am kind of surprised it is working...
In retrospect, I should be defining BOOST_TYPEOF_COMPLIANT during testing. I'm now getting errors too; GCC reports BOOST_PP_SEQ_ENUM_III lacking an input. *sigh* Back to the drawing board... Cromwell D. Enage __________________________________________ Yahoo! DSL Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com

"Cromwell Enage" <sponage@yahoo.com> wrote
*sigh* Back to the drawing board...
I think you may want to use (BOOST_PP_)REPEAT in conjunction with SEQ_ELEM and SEQ_SIZE instead of SEQ_FOR_EACH. Since REPEAT is automatically re-entrant, it may be less trouble to use it, and you don't depend on what typeof has inside (OTOH, I am thinking of adopting the same strategy, so that people don't have re-entrancy problems when using typeof). Also note another issue that I mentioned -- providing explicit ID (I gave the example in my previous post). I will add the needed macro soon, but if you want to proceed before this, just copy it from the example somewhere in your code, and then you'll just remove it once it's in typeof. Regards, Arkadiy

I think you may want to use (BOOST_PP_)REPEAT in conjunction with SEQ_ELEM and SEQ_SIZE instead of SEQ_FOR_EACH. Since REPEAT is automatically re-entrant, it may be less
use it, and you don't depend on what typeof has inside (OTOH, I am thinking of adopting the same strategy, so that
--- Arkadiy Vertleyb wrote: trouble to people don't
have re-entrancy problems when using typeof).
Also note another issue that I mentioned --
ID (I gave the example in my previous post). I will add the needed macro soon, but if you want to proceed before
copy it from the example somewhere in your code, and
Understood. providing explicit this, just then you'll
just remove it once it's in typeof.
I'll wait for the macro. Cromwell D. Enage __________________________________ Yahoo! for Good - Make a difference this year. http://brand.yahoo.com/cybergivingweek2005/

"Arkadiy Vertleyb" <vertleyb@hotmail.com> wrote
"Cromwell Enage" <sponage@yahoo.com> wrote
*sigh* Back to the drawing board...
I think you may want to use (BOOST_PP_)REPEAT in conjunction with SEQ_ELEM and SEQ_SIZE instead of SEQ_FOR_EACH. Since REPEAT is automatically re-entrant, it may be less trouble to use it, and you don't depend on what typeof has inside (OTOH, I am thinking of adopting the same strategy, so that people don't have re-entrancy problems when using typeof).
Also note another issue that I mentioned -- providing explicit ID (I gave the example in my previous post). I will add the needed macro soon, but if you want to proceed before this, just copy it from the example somewhere in your code, and then you'll just remove it once it's in typeof.
Added in CVS: BOOST_TYPEOF_REGISTER_TYPE_EXPLICIT_ID(Name, Id) BOOST_TYPEOF_REGISTER_TEMPLATE_EXPLICIT_ID(Name, Params, Id) Regards, Arkadiy

I think you may want to use (BOOST_PP_)REPEAT in conjunction with SEQ_ELEM and SEQ_SIZE instead of SEQ_FOR_EACH. Since REPEAT is automatically re-entrant, it may be less
--- Arkadiy Vertleyb wrote: trouble to
use it, and you don't depend on what typeof has inside.
I'm also studying file iteration so I can see if that helps me out.
(OTOH, I am thinking of adopting the same strategy, so that people don't have re-entrancy problems when using typeof.)
Please do adopt this strategy. Currently this kind of code doesn't work: BOOST_TYPEOF_REGISTER_TYPE( boost::mpl::math::string_c_to_double , BOOST_MPL_PP_ARG_SEQ(unsigned char, 40) ) BOOST_MPL_PP_ARG_SEQ uses BOOST_PP_REPEAT to create a sequence of N elements containing the specified primitive integral type.
Added in CVS:
BOOST_TYPEOF_REGISTER_TYPE_EXPLICIT_ID(Name, Id) BOOST_TYPEOF_REGISTER_TEMPLATE_EXPLICIT_ID(Name, Params, Id)
I'll make use of them when I get the chance. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
participants (4)
-
Andy Little
-
Arkadiy Vertleyb
-
Cromwell Enage
-
Victor A. Wagner Jr.