1 // Copyright (C) 2013 Vicente J. Botet Escriba
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // <boost/thread/synchronized_value.hpp>
7 
8 // class synchronized_value<T,M>
9 
10 // void swap(synchronized_value&,synchronized_value&);
11 
12 #define BOOST_THREAD_VERSION 4
13 
14 #include <boost/thread/synchronized_value.hpp>
15 
16 #include <boost/detail/lightweight_test.hpp>
17 
main()18 int main()
19 {
20 
21   {
22     boost::synchronized_value<int> v1(1);
23     int v2(2);
24     boost::swap(v1,v2);
25     BOOST_TEST(v1.value() == 2);
26     BOOST_TEST(v2 == 1);
27   }
28   {
29     boost::synchronized_value<int> v1(1);
30     int v2(2);
31     boost::swap(v2,v1);
32     BOOST_TEST(v1.value() == 2);
33     BOOST_TEST(v2 == 1);
34   }
35 
36   return boost::report_errors();
37 }
38 
39