Boost logo

Boost Users :

Subject: [Boost-users] units
From: Robert Ramey (ramey_at_[hidden])
Date: 2013-09-21 18:02:57


I have a program in which there is the notion of consumption rate such as
m^3/sec, gallons/hour, etc.

I have consumption_rate unit defined in terms of si units. I read in a
quanity in gallons/hour and so far so good.
If I display the quantity it is displayed as m^3/sec. This displays the
"compound units" as expected - very cool.
All this is OK as far as it goes. When I try to display the quantity as
gallons/hour again I have a whole host of
problems. The attached test fill illustrates the issues. The only way I've
been able to do is is by making
a complete end run around the units system itself - sort of self defeating.

I would appreciate insight anyone might be able to offer into this issue.

Robert Ramey

begin 666 test_units.cpp
M#0HC:6YC;'5D92 \:6]S=')E86T^#0H-"B-I;F-L=61E(#QB;V]S="]U;FET
M<R]I;RYH<' ^#0HC:6YC;'5D92 \8F]O<W0O=6YI=',O<&]W+FAP<#X-"B\O
M(VEN8VQU9&4@/&)O;W-T+W5N:71S+V1E=&%I;"]U=&EL:71Y+FAP<#X-"B-I
M;F-L=61E(#QB;V]S="]U;FET<R]S>7-T96US+V-G<RYH<' ^#0HC:6YC;'5D
M92 \8F]O<W0O=6YI=',O<WES=&5M<R]S:2YH<' ^#0HC:6YC;'5D92 \8F]O
M<W0O=6YI=',O<WES=&5M<R]S:2]I;RYH<' ^#0H-"B-I;F-L=61E(#QB;V]S
M="]U;FET<R]B87-E7W5N:71S+VUE=')I8R]H;W5R+FAP<#X-"@T*=7-I;F<@
M;F%M97-P86-E(&)O;W-T.CIU;FET<SL-"@T*+R\@9&5R:79E('-P96-I86P@
M=6YI=',@=&AA="!W92!U<V4@:6X@;W5R(&%P<&QI8V%T:6]N#0HO+R!D97)I
M=F5D(&1I;65N<VEO;B!F;W(@8V]N<W5M<'1I;VY?<F%T92 Z($T_at_5%XM,0T*
M='EP961E9B!B;V]S=#HZ=6YI=',Z.F1E<FEV961?9&EM96YS:6]N/ T*(" @
M(&)O;W-T.CIU;FET<SHZ;&5N9W1H7V)A<V5?9&EM96YS:6]N+#,L#0H@(" @
M8F]O<W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;&]N<RDN=F%L=64H*2 O("@Q+C @*B!H;W5R*2YV86QU92_at_I*2 \/" B("T@
M=6YE>'!E8W1E9"!V86QU92 A("AE>'!E8W1E9" Q+C I("(\/"!S=&0Z.F5N
M9&P_at_[hidden]*#0H@(" @9FQO870_at_9R ]("@Q+C @*B!G86QL;VYS*2YV86QU92_at_I
M.PT*(" @('-T9#HZ8V]U=" \/"!G(#P\('-T9#HZ96YD;#L-"B @("!F;&]A
M="!H(#T@*#$N," J(&AO=7(I+G9A;'5E*"D[#0H@(" @<W1D.CIC;W5T(#P\
M(&@@/#P@<W1D.CIE;F1L.PT*(" @(&9L;V%T('(@/2!#+G9A;'5E*"D@+R H
M9R O(&@I.PT*(" @('-T9#HZ8V]U=" \/"!R("H_at_9V%L;&]N<R O(&AO=7(@
M/#P@(B M(&9I;F%L;'DA('1H92!C;W)R96-T(')E<W5L="$B(#P\('-T9#HZ
M96YD;#L-"@T*(" @('-T9#HZ8V]U=" \/"!S=&0Z.F5N9&P[#0H@(" @#0H@
M(" @<75A;G1I='D\<VDZ.F%R96$^(" @(" @02_at_Q+C4J<VDZ.FUE=&5R*F-G
M<SHZ8V5N=&EM971E<BD[#0H@(" @#0H@(" @<W1D.CIC;W5T(#P\(#$N-2IS
M:3HZ;65T97(J8V=S.CIC96YT:6UE=&5R(#P\('-T9#HZ96YD; T*(" @(" @
M(" @(" @(" \/"!!(#P\('-T9#HZ96YD; T*(" @(" @(" @(" @(" \/"!S
A=&0Z.F5N9&P[#0H-"B @("!R971U<FX@,#L-"GT-"@T*
`
end


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net