1 // Copyright (c) 2008 Joseph Gauterin, Niels Dekker 2 // 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 // Tests swapping std::time_base::dateorder objects by means of boost::swap. 8 // std::time_base::dateorder is an enumerated type. It does not have an 9 // std::swap overload or template specialization. 10 11 #include <boost/utility/swap.hpp> 12 #include <boost/core/lightweight_test.hpp> 13 #define BOOST_CHECK BOOST_TEST 14 #define BOOST_CHECK_EQUAL BOOST_TEST_EQ 15 16 #include <locale> 17 main()18int main() 19 { 20 const std::time_base::dateorder initial_value1 = std::time_base::dmy; 21 const std::time_base::dateorder initial_value2 = std::time_base::mdy; 22 23 std::time_base::dateorder object1 = initial_value1; 24 std::time_base::dateorder object2 = initial_value2; 25 26 boost::swap(object1,object2); 27 28 BOOST_CHECK_EQUAL(object1,initial_value2); 29 BOOST_CHECK_EQUAL(object2,initial_value1); 30 31 return boost::report_errors(); 32 } 33 34