|
Boost : |
From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-07-15 23:08:23
Here is shared_ptr.h with little corrections...
Philippe
"Philippe A. Bouchard" <philippeb_at_[hidden]> wrote in message
news:ah005q$b1s$1_at_main.gmane.org...
> Greeting,
>
> After a usefull discussion under comp.lang.c++ newsgroup I've made
some
> modifications to pointers I've already suggested. I am proposing two
> different pointers that emphasize efficienty:
>
> mutable_ptr<>:
> - literally breaks some compiler assertions that prevents
> std::auto_ptr<> from being easily copied;
> - is really beneficial for STL container self destructions - believe
me;
> - copies are a lot easier to manage: work with secondary pure pointers
> assignments;
> - member declarations identical to std::auto_ptr<>;
> - as fast as std::auto_ptr<>.
>
> shared_ptr<>:
> - functionality is similar to boost::shared_ptr<> except:
> - reference counters are merged with instanciated objects:
> - operator new () is called once in the end (like
> boost::shared_ptr<>);
> - the pointer is same size as sizeof(void *);
> - reference counters are not copied when assignments are
called;
> - little drawback: assignments work only with other
> fdi::shared_ptr<>
> - the only change from std::auto_ptr<> interface was that release()
was
> renamed to share();
> - faster than boost::shared_ptr<>.
>
> A personnaly prefer using mptr<> and sptr<> because the code is easier to
> read in one line. I won't recommend macros but simply to rename classes.
> One other thing: the fdi:: namespace is volatile. I hope someone will
share
> the same vision of efficienty benefits I have.
>
>
>
> Thank you,
>
> Philippe A. Bouchard
>
>
>
>
----------------------------------------------------------------------------
---- > > > > _______________________________________________ > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost > begin 666 shared_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(%-(05)%1%]05%)?2 HC9&5F:6YE(%-(05)%1%]05%)? M2 H*"FYA;65S<&%C92!F9&D*>PH*=&5M<&QA=&4@/&-L87-S(%]4<#X*"7-T M<G5C="!S:&%R961?<'1R"@E["@D)<W1R=6-T(&5L96UE;G1?='EP90H)"7L* M"0D)9G)I96YD(&-L87-S('-H87)E9%]P='(["@H)"0ET>7!E9&5F(%]4<"!T M>7!E.PH*"0D)96QE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0E]"@D) M?0H*"0EE;&5M96YT7W1Y<&4Z.G1Y<&4@)B!O<&5R871O<B J("@I(&-O;G-T M"@D)>PH)"0ER971U<FX@;5]P='(M/FU?96QE;65N=#L*"0E]"@H)"65L96UE M;G1?='EP93HZ='EP92 J(&]P97)A=&]R("T^("@I(&-O;G-T"@D)>PH)"0ER M971U<FX@)B!M7W!T<BT^;5]E;&5M96YT.PH)"7T*"@D)96QE;65N=%]T>7!E M.CIT>7!E("H_at_9V5T*"D_at_8V]N<W0*"0E["@D)"7)E='5R;B F(&U?<'1R+3YM M7V5L96UE;G0["@D)?0H*"0EE;&5M96YT7W1Y<&4@*B!S:&%R92_at_I(&-O;G-T M"@D)>PH)"0EI9B H;5]P='(I"@D)"7L*"0D)"2LK(&U?<'1R+3YM7V-O=6YT M.PH)"0E]"@D)"7)E='5R;B!M7W!T<CL*"0E]"@H)"79O:60@<F5S970H96QE M;65N=%]T>7!E("H_at_85]P(#T@,"D*"0E["@D)"6EF("AM7W!T<B F)B A("TM M(&U?<'1R+3YM7V-O=6YT*0H)"0E["@D)"0ED96QE=&4@;5]P='(["@D)"7T* M"0D);5]P='(@/2!A7W ["@D)?0H*"7!R:79A=&4Z"@D)96QE;65N=%]T>7!E :("H@;5]P='(["@E].PH*?0H*"B-E;F1I9_at_H` ` end
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk