|
Boost Users : |
From: bringiton bringiton (kneeride_at_[hidden])
Date: 2006-07-15 00:32:51
Thanks Roman and Dave. That is perfect.
I was hoping there was a way the compiler could deduct those parameters.
On 7/14/06, David Klein <d.klein_at_[hidden]> wrote:
> boost-users-bounces_at_[hidden] wrote:
> > Hi Dave. That code went over the top of my head. Do you mind
> > giving me an example of the usage?
> >
> > On 7/14/06, David Klein <d.klein_at_[hidden]> wrote:
> >> [snip]
> >>
> >>> I just have a problem with having the user manage the memory.
> >>> ie I'd rather do the following:
> >>>
> >>> shared_ptr<Test> p(1, 'a', "hello");
> >>> or:
> >>> shared_ptr<Test> p = newptr<Test>(1, 'a', "hello");
> >>>
> >>> instead of:
> >>>
> >>> shared_ptr<Test> p(new p(1, 'a', "hello"));
> >>>
> >>> but i guess that's a limitation of the language. to get
> >>
> >> hi,
> >>
> >> have a look at shared_new.zip in the vault.
> >>
> >> http://tinyurl.com/khd8v
> >>
> >> --
> >> HTH dave
>
> well, i just tried to compile the shared_new_test.cc,
> but it failed using vc71 and vc8 (boost 1.33.1).
> anyway, its quite similiar to the code Roman Perepelitsa posted.
>
> a short example using his newptr:
>
> struct X
> {
> X( int _x, double _y, const std::string & _z )
> {
> ...
> }
> }
>
> shared_ptr<X> x = newptr<X>(42, 42.0, "hello world");
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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