Index: libs/variant/test/Jamfile.v2 =================================================================== --- libs/variant/test/Jamfile.v2 (revision 53528) +++ libs/variant/test/Jamfile.v2 (working copy) @@ -27,4 +27,5 @@ [ run variant_reference_test.cpp ] [ run variant_comparison_test.cpp ] [ run variant_visit_test.cpp ] + [ run test-swap.cpp ] ; Index: libs/variant/test/test-swap.cpp =================================================================== --- libs/variant/test/test-swap.cpp (revision 0) +++ libs/variant/test/test-swap.cpp (revision 0) @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// boost-libs variant/test/test-swap.cpp source file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2009 ArtVPS Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include "boost/test/minimal.hpp" +#include "boost/variant.hpp" + +#include + +void run() +{ + + using boost::apply_visitor; + using boost::variant; + using std::cout; + using std::endl; + + typedef variant< int, std::vector* > t_var; + + std::vector vec; + t_var v0(23), v1(&vec); + + BOOST_REQUIRE(v0.which() == 0); + BOOST_REQUIRE(v1.which() == 1); + + swap(v0, v1); + + BOOST_CHECK(v0.which() == 1); + BOOST_CHECK(v1.which() == 0); +} + + + +int test_main(int , char* []) +{ + run(); + return 0; +}