diff --git a/doc/intrusive.qbk b/doc/intrusive.qbk
index 99a68f6..88dfc50 100644
--- a/doc/intrusive.qbk
+++ b/doc/intrusive.qbk
@@ -3869,6 +3869,7 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
* Fixed bugs:
* [@https://svn.boost.org/trac/boost/ticket/12745 Boost Trac #12745: ['key_nodeptr_comp broken if the key type is void*]]
+ * [@https://svn.boost.org/trac/boost/ticket/12761 Boost Trac #12761: ['intrusive::set::swap doesn't swap the comparison function*]]
[endsect]
diff --git a/include/boost/intrusive/bstree.hpp b/include/boost/intrusive/bstree.hpp
index f2cdb42..8c31582 100644
--- a/include/boost/intrusive/bstree.hpp
+++ b/include/boost/intrusive/bstree.hpp
@@ -967,7 +967,7 @@ class bstree_impl
void swap(bstree_impl& other)
{
//This can throw
- ::boost::adl_move_swap(this->comp(), this->comp());
+ ::boost::adl_move_swap(this->comp(), other->comp());
//These can't throw
node_algorithms::swap_tree(this->header_ptr(), node_ptr(other.header_ptr()));
this->sz_traits().swap(other.sz_traits());
diff --git a/include/boost/intrusive/treap.hpp b/include/boost/intrusive/treap.hpp
index 8567072..c6f63ff 100644
--- a/include/boost/intrusive/treap.hpp
+++ b/include/boost/intrusive/treap.hpp
@@ -354,9 +354,9 @@ class treap_impl
//! Throws: If the comparison functor's swap call throws.
void swap(treap_impl& other)
{
- tree_type::swap(other);
//This can throw
::boost::adl_move_swap(this->priv_pcomp(), other.priv_pcomp());
+ tree_type::swap(other);
}
//! Requires: Disposer::operator()(pointer) shouldn't throw.