Boost logo

Boost :

Subject: [boost] [swap] ruminations
From: Jeffrey Hellrung (jhellrung_at_[hidden])
Date: 2009-11-03 17:22:07

1) Would it be a good idea (aside from breaking backwards compatibility)
to insulate boost::swap from being found via ADL? Consider another
library, tsoob, which also has a swap intended to be used in the same
manner as boost::swap (i.e., it finds a free function swap via ADL,
falling back to std::swap or maybe some custom swap or whatever). Now
tsoob::swap and boost::swap cannot be used in the same program
(ambiguous call to overloaded function swap) if the associated
namespaces of the type being swapped includes both boost and tsoob
(certainly possible).

What I'm thinking about is the possibility of creating a namespace
boost::adl which contains (what would have previously been called)
boost::swap, as well as any other similar free functions. So the only
way to invoke boost::adl::swap is to make it explicit; it will never be
found via ADL. Plus it helps document the underlying mechanism (ADL) of

2) Is there some way for boost::swap and tsoob::swap to coexist
peacefully while retaining backwards compatibility for both?

- Jeff

Boost list run by bdawes at, gregod at, cpdaniel at, john at