• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3     Copyright (c) 2006 Dan Marsden
4 
5     Distributed under the Boost Software License, Version 1.0. (See accompanying
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #include <boost/fusion/sequence/intrinsic/swap.hpp>
9 #include <boost/fusion/container/vector.hpp>
10 #include <boost/fusion/container/generation/make_vector.hpp>
11 #include <boost/fusion/sequence/comparison/equal_to.hpp>
12 #include <boost/detail/lightweight_test.hpp>
13 
14 #include <boost/mpl/assert.hpp>
15 
16 #include <boost/type_traits/is_same.hpp>
17 
18 #include <vector>
19 
main()20 int main()
21 {
22     namespace fusion = boost::fusion;
23     {
24         typedef fusion::vector<std::vector<int>, char> test_vector;
25         BOOST_MPL_ASSERT((boost::is_same<void, boost::fusion::result_of::swap<test_vector, test_vector>::type>));
26 
27         test_vector v1(std::vector<int>(1, 101), 'a'), v2(std::vector<int>(1, 202), 'b');
28 
29         fusion::swap(v1, v2);
30 
31         BOOST_TEST(v1 == fusion::make_vector(std::vector<int>(1, 202), 'b'));
32         BOOST_TEST(v2 == fusion::make_vector(std::vector<int>(1, 101), 'a'));
33     }
34     return boost::report_errors();
35 }
36