Boost logo

Boost :

From: Bohdan (gejrlaug_at_[hidden])
Date: 2003-09-09 17:03:52


"John Maddock" <john_at_[hidden]> wrote in message
news:04bb01c376ca$3b1fff90$22c26b51_at_fuji...
> It seems to me that this may be of interest here as well:
>
> > To: C++ libraries mailing list
> > Message c++std-lib-11916
> >
> > Unless I've missed it, we seem to be no further forward in solving the
> "swap
> > problem" - namely is it permitted to provide user defined overloads of
> > std::swap in namespace std?
> >
> > I don't want to rehearse the old arguments again here, but instead ask a
> > different question: what would happen if std::swap were omnipotent and
> just
> > simply "knows" whether a type has a member function swap or not.
> std::swap
> > could now be implemented to call the member swap if it were available,
> > otherwise to fall back on the slow but safe copy based swap.
> >
> > The interesting thing is, this is actually implementable right now within
> > the current language - I've attached a sample implementation to the end of
> > this message, hopefully it really is legal code, although I admit that
> only
> > one of the three compilers I've tried (VC7.1) would compile it....

Wow. Before this message i was thinking that CT method detection
is impossible at all.

I've tried borland and looks like it will never compile it :)
But maybe there is somebody more enlighted than me
and knows how to fix this code for more compilers ?

regards,
bohdan


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