Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-10-12 13:58:37


Hi Andras,
  Your proxy stuff got me interested in how far I could take it. So I coded
your ideas up then added what I thought would be necessary to make easier to
work. I'd appreciate it if you could look it over and see if I'm on the
right track. I haven't tested all of it yet. I am including the test bench
so you can see where its going.

  In order to make operator*() work I had to create yet another proxy for
that! Otherwise the constraints on figuring out the type information get
bad.

  The results of the test are runs and compiles. (No tests for efficiency
yet.)

  Oh yeah, the compiler I'm using is gcc 2.95 with g++ main.cpp as the
command line.

  Yours,
 -gary-

gary.powell_at_[hidden]

 <<inc_proxy.h>> <<main.cpp>>
> -----Original Message-----
> From: "Erdei, András" [SMTP:ccg_at_[hidden]]
> Sent: Wednesday, October 11, 2000 8:45 AM
> To: 'boost_at_[hidden]'
> Subject: RE: [boost] operator++
>
>
> > > and & (i++) will not
> > > produce what you expect --
>
> > This could be fixed with yet another overload to forward the request.
> And
> we
> > could add operator*() and operator->()....of course this all requires
> the
> > usual gamut of type deduction templates....
>
> <earlier posting>
> > I suppose a member template converter would make a bigger mess of
> things
> > as well right? (ambiguous conversions etc.) (Or it won't be even called
> > because of rule #1?)
>
> > class proxy {
> > public:
> > template<class S>
> > operator S () { return S(real) ; } // makes the copy.
> > ...
> > };
>
> Can you explain these in more detail? (I'm interested
> in this proxy technique for other reasons (thread-safe
> containers).)
>
> TIA
> Andras
>
>
> P.S.
>
> > that either the return value was used or not and then do the smart
> thing...
>
> If you mean to optimize away the temporaries
> in the original ++, i guess it isn't allowed
> to -- the ctor & dtor may have side-effects
> (like the dtor of the proxy).
>
>
>





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