Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-07-23 01:42:06


Hi,

    I know your priorities may be elsewhere right now but I made some
derived utilities that may interest some of you besides squad_ptr<>.

1) I've included a little function and I would like your opinion if
possible. It consist of a pointer to non-function member to integer
conversion. I find it really helpfull for my complex instanciation
demonstration (testptr2.cpp) which I know will never be needed in weird
situation like this one but I'm just extrapolating the possibilities.

2) prebuild<> is an object that disables every initial constructions of a
variable. Construction will be reported to the next operator new (size_t,
void *) call. It is usefull when you want to disable class members initial
constructions. This will allow you to construct nested members directly
without copying expensive temporaries. It is effective when applied to
every type of needed nodes pointed by smart pointers (or rewritten STL
lists, vectors, etc. eventually).

3) squad_ptr<> finally. I'm not asking to force this one to be used I'm
just demanding some thoughts; library extensions, integration, etc. in the
domain of the possible of course. Let's not forget it is using unused but
pure C++ syntax. testptr1.cpp shows how clean testptr2.cpp can be when
squad_target<> type is used.

I'm open to nonconstructive and preferably constructive opinions.

Thanks again,

Philippe A. Bouchard

begin 666 squad_ptr.h
M+RH*(" @5&AI<R!F:6QE(&ES('!A<G0@;V8@=&AE($9$22!L:6)R87)I97,*
M(" @0V]P>7)I9VAT("AC*2 R,# R(%!H:6QI<'!E($$N($)O=6-H87)D(#QP
M:&EL:7!P94!F;W)N=7_at_N8V]M/@H*(" @5&AI<R!L:6)R87)Y(&ES(&9R964@
M<V]F='=A<F4[('EO=2!C86X@<F5D:7-T<FEB=71E(&ET(&%N9"]O<@H@("!M
M;V1I9GD@:70@=6YD97(@=&AE('1E<FUS(&]F('1H92!'3E4_at_3&EB<F%R>2!'
M96YE<F%L(%!U8FQI8PH@("!,:6-E;G-E('9E<G-I;VX@,B!A<R!P=6)L:7-H
M960_at_8GD@=&AE($9R964_at_4V]F='=A<F4_at_1F]U;F1A=&EO;BX*"B @(%1H:7,@
M;&EB<F%R>2!I<R!D:7-T<FEB=71E9"!I;B!T:&4@:&]P92!T:&%T(&ET('=I
M;&P_at_8F4@=7-E9G5L+ H@("!B=70_at_5TE42$]55"!!3ED_at_5T%24D%.5%D[('=I
M=&AO=70_at_979E;B!T:&4@:6UP;&EE9"!W87)R86YT>2!O9_at_H@("!-15)#2$%.
M5$%"24Q)5%D@;W(@1DE43D534R!&3U(@02!005)424-53$%2(%!54E!/4T4N
M("!3964@=&AE($=.50H@("!,:6)R87)Y($=E;F5R86P_at_4'5B;&EC($QI8V5N
M<V4_at_9F]R(&UO<F4_at_9&5T86EL<RX*"B @(%EO=2!S:&]U;&0@:&%V92!R96-E
M:79E9"!A(&-O<'D@;V8@=&AE($=.52!,:6)R87)Y($=E;F5R86P_at_4'5B;&EC
M($QI8V5N<V4*(" @86QO;F<@=VET:"!T:&ES(&QI8G)A<GD[('-E92!T:&4@
M9FEL92!#3U!924Y'+DQ)0BX@($EF(&YO="P@=W)I=&4@=&\*(" @=&AE($9R
M964_at_4V]F='=A<F4_at_1F]U;F1A=&EO;BP_at_26YC+BP_at_-3D@5&5M<&QE(%!L86-E
M("T_at_4W5I=&4@,S,P+ H@("!";W-T;VXL($U!(# R,3$Q+3$S,#<L(%5302X*
M*B\*"@HC:69N9&5F(%-154%$7U!44E]("B-D969I;F4_at_4U%5041?4%127T@*
M"@HC:6YC;'5D92 B<')E8G5I;&0N:"(*"@IN86UE<W!A8V4_at_9F1I"GL*"@IT
M96UP;&%T92 \='EP96YA;64_at_7U1P/@H)<W1R=6-T('-Q=6%D7W!T<CL*"@HO
M*BH*"4]B:F5C="!P;VEN=&5D('1O(&)Y('-Q=6%D7W!T<CP^+@H*"4AA<R!T
M;R!B92!I;G-T86YC:6%T960@=7-I;F<@=6YC;VUM;VX_at_97AP<F5S<VEO;G,N
M(%-E92!B96QO=RX**B\*"G1E;7!L871E(#QT>7!E;F%M92!?5' ^"@ES=')U
M8W0@<W%U861?=&%R9V5T"@E["@D)9G)I96YD(&-L87-S('-Q=6%D7W!T<CQ?
M5' ^.PH*"@D)<W%U861?=&%R9V5T*"D_at_.B!M7V-O=6YT97(H,2D*"0E["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._at_H)"65L96UE;G1?='EP92 J(&U?<'1R.PH)?3L*"@HO*BH*"4%L:6%S(&9O
M<B!S<75A9%]T87)G970\/B!M96UO<GD_at_86QL;V-A=&EO;BX**B\*"G1E;7!L
M871E(#QT>7!E;F%M92!?5#X*"6EN;&EN92!V;VED("H@<W%U860H*0H)>PH)
M"7)E='5R;B!B=69F97(\('-Q=6%D7W1A<F=E=#Q?5#X@/B_at_[hidden])?0H*"GT*
)"@HC96YD:68*
`
end

begin 666 mutable_ptr.h
M+RH*(" @5&AI<R!F:6QE(&ES('!A<G0@;V8@=&AE($9$22!L:6)R87)I97,*
M(" @0V]P>7)I9VAT("AC*2 R,# R(%!H:6QI<'!E($$N($)O=6-H87)D(#QP
M:&EL:7!P94!F;W)N=7_at_N8V]M/@H*(" @5&AI<R!L:6)R87)Y(&ES(&9R964@
M<V]F='=A<F4[('EO=2!C86X@<F5D:7-T<FEB=71E(&ET(&%N9"]O<@H@("!M
M;V1I9GD@:70@=6YD97(@=&AE('1E<FUS(&]F('1H92!'3E4_at_3&EB<F%R>2!'
M96YE<F%L(%!U8FQI8PH@("!,:6-E;G-E('9E<G-I;VX@,B!A<R!P=6)L:7-H
M960_at_8GD@=&AE($9R964_at_4V]F='=A<F4_at_1F]U;F1A=&EO;BX*"B @(%1H:7,@
M;&EB<F%R>2!I<R!D:7-T<FEB=71E9"!I;B!T:&4@:&]P92!T:&%T(&ET('=I
M;&P_at_8F4@=7-E9G5L+ H@("!B=70_at_5TE42$]55"!!3ED_at_5T%24D%.5%D[('=I
M=&AO=70_at_979E;B!T:&4@:6UP;&EE9"!W87)R86YT>2!O9_at_H@("!-15)#2$%.
M5$%"24Q)5%D@;W(@1DE43D534R!&3U(@02!005)424-53$%2(%!54E!/4T4N
M("!3964@=&AE($=.50H@("!,:6)R87)Y($=E;F5R86P_at_4'5B;&EC($QI8V5N
M<V4_at_9F]R(&UO<F4_at_9&5T86EL<RX*"B @(%EO=2!S:&]U;&0@:&%V92!R96-E
M:79E9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F5W("AN97<@*&YE=R H8G5F9F5R/&YO9&4^*"DI(&EN="@X
M*2 K('!O<R_at_F(&YO9&4Z.FHI*2!D;W5B;&4H,BXV*2 M('!O<R_at_F(&YO9&4Z
M.FHI*2!N;V1E*")->2!N86UE(&ES($)O8BXB*3L*"@EC;W5T(#P\(',M/FDN
M9V5T*"D@/#P_at_96YD;#L*"6-O=70@/#P@<RT^:BYG970H*2 \/"!E;F1L.PH*
-"7)E='5R;B P.PI]"@``
`
end


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