
on Sat Jul 26 2008, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
AMDG
Niels Dekker - mail address until 2008-12-31 wrote:
Once the boost::swap utility would be used by other Boost libraries, end users might want to add a custom overload of swap for their classes to the boost namespace. Especially when users would have to deal with lacking ADL support of their compiler. Would it be okay for them to do so? Or are there some moral objections, or technical issues, regarding a user-provided overload within the boost namespace?
Adding overloads to namespace boost is not guaranteed to work either.
template<class T> void foo(T& t1, T&t2) { boost::swap(t1, t2); }
class X {};
namespace boost { void swap(X&, X&); // not found by foo. }
Well, not by a conforming compiler. Niels is talking about compilers with bugs, though. I don't know if this would be a possible workaround for any of those compilers or not, but several compilers do all name lookup in phase 2 so this stands a chance of working. -- Dave Abrahams BoostPro Computing http://www.boostpro.com