There is a problem with the Borland BCB6 compiler specializing std::swap for user defined types when using the STLport standard library. This may apply to other compilers using the library as well, but only have experience with Borland.
An example is the clearest demonstration: // ----- Begin example #include <boost/shared_ptr.hpp> class Swappable { public: Swappable() {} void Swap( Swappable & ) { } }; namespace std { template<> void swap( Swappable &lhs, Swappable &rhs ) { lhs.Swap( rhs ); } } int main(int argc, char* argv[]) { Swappable a, b; std::swap( a, b ); boost::shared_ptr<Swappable> pA( new Swappable() ); boost::shared_ptr<Swappable> pB( new Swappable() ); # if BOOST_WORKAROUND( __BORLANDC__, >= 0x0560 ) _STL::swap( pA, pB ); # else std::swap( pA, pB ); # endif return 0; } // ----- End example If the workaround is disabled, the compiler cannot find the specialization in namespace std as the swap algorithm is implemented in namespace _STL and introduced by a namespace alias. What does this mean for Boost? i/ There are no test cases for this in the test suite, or BCB would be failing more tests! ii/ Anywhere we use std::swap, we need a borland hack as above (although better tuned to STLport version as well) So far this bug has bitten us in the smart pointers, function and Spirit libraries but I doubt this is an exhaustive list! What is the best way forward with this? Should I submit separate patches (and test cases) for each library as I find them? Is it worth introducing a new config macro for the problem? Is there a neater fix I'm missing? Do we want to consider other algorithms that may be specialized on user defined types, such as std::less? I'd certainly like to have the 'right' boiler-plate version of the patch to apply before submitting patches. -- AlisdairM _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost