Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-11-03 16:50:07


----- Original Message -----
From: "Gary Powell" <Gary.Powell_at_[hidden]>

> Suggestions:
> ============
> any.hpp should add the following bit of code.
>
> namespace std {
> void swap(boost::any & lhs, boost::any & rhs) { lhs.swap(rhs); }
> }
>
> Reasoning: If you are going to provide an optimized swap you should let
the
> namespace std know about it.
>
> I think this is a legal overload. (Feel free to cite chapter and verse for
> why not.)

I don't have chapter and verse, but it is a fact that NO user overloads in
std are currently legal.

this would be legal, though:

namespace std {
    template <>
    void swap<boost::any&>(boost::any & lhs, boost::any & rhs) {
lhs.swap(rhs); }
}

> ---------------
> As an addition I'd also prefer that "any" take a template parameter
> allocator instead of calling the global new. (That would make any a
> template, which would make the above swap addition illegal.)

Even more so ;-)
There is no legal recourse when any is a template.

-Dave


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