| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-09 20:56:23 +00:00
										 |  |  | // Copyright 2005-2009 Daniel James.
 | 
					
						
							| 
									
										
										
										
											2006-07-01 22:31:26 +00:00
										 |  |  | // 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)
 | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if !defined(BOOST_UNORDERED_TEST_HELPERS_STRONG_HEADER)
 | 
					
						
							|  |  |  | #define BOOST_UNORDERED_TEST_HELPERS_STRONG_HEADER
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "./equivalent.hpp"
 | 
					
						
							| 
									
										
										
										
											2008-05-20 15:24:20 +00:00
										 |  |  | #include "./exception_test.hpp"
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  | #include "./list.hpp"
 | 
					
						
							|  |  |  | #include <boost/config.hpp>
 | 
					
						
							|  |  |  | #include <iterator>
 | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  | namespace test { | 
					
						
							| 
									
										
										
										
											2017-06-11 20:55:59 +01:00
										 |  |  |   template <class X> class strong | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2018-01-27 09:39:59 +00:00
										 |  |  |     typedef test::list<typename X::value_type> values_type; | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |     values_type values_; | 
					
						
							|  |  |  |     unsigned int allocations_; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public: | 
					
						
							|  |  |  |     void store(X const& x, unsigned int allocations = 0) | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-06-11 20:55:59 +01:00
										 |  |  |       DISABLE_EXCEPTIONS; | 
					
						
							|  |  |  |       values_.clear(); | 
					
						
							|  |  |  |       values_.insert(x.cbegin(), x.cend()); | 
					
						
							|  |  |  |       allocations_ = allocations; | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |     void test(X const& x, unsigned int allocations = 0) const | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-06-11 20:55:59 +01:00
										 |  |  |       if (!(x.size() == values_.size() && test::equal(x.cbegin(), x.cend(), | 
					
						
							|  |  |  |                                             values_.begin(), test::equivalent))) | 
					
						
							|  |  |  |         BOOST_ERROR("Strong exception safety failure."); | 
					
						
							|  |  |  |       if (allocations != allocations_) | 
					
						
							|  |  |  |         BOOST_ERROR("Strong exception failure: extra allocations."); | 
					
						
							| 
									
										
										
										
											2017-02-19 13:05:17 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-06-11 20:55:59 +01:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |