| 
									
										
										
										
											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 <boost/config.hpp>
 | 
					
						
							|  |  |  | #include <iterator>
 | 
					
						
							|  |  |  | #include "./metafunctions.hpp"
 | 
					
						
							|  |  |  | #include "./equivalent.hpp"
 | 
					
						
							| 
									
										
											  
											
												Merge in support for equality operators for the unordered containers and
hopefully better cross-platform support.
Merged revisions 44778-44835,44837-44918 via svnmerge from 
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
  r44778 | danieljames | 2008-04-26 17:15:44 +0100 (Sat, 26 Apr 2008) | 2 lines
  
  Remove a trailing comma.
........
  r44779 | danieljames | 2008-04-26 17:23:51 +0100 (Sat, 26 Apr 2008) | 1 line
  
  Merge in support for equality operators.
........
  r44780 | danieljames | 2008-04-26 17:28:44 +0100 (Sat, 26 Apr 2008) | 1 line
  
  Use my own list container to avoid working around STL container bugs.
........
  r44833 | danieljames | 2008-04-28 08:03:43 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Better equality tests.
........
  r44834 | danieljames | 2008-04-28 08:04:03 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Remove a superfluous check.
........
  r44835 | danieljames | 2008-04-28 08:04:21 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Add equality reference documentation.
........
  r44916 | danieljames | 2008-04-30 08:16:52 +0100 (Wed, 30 Apr 2008) | 1 line
  
  New version of list.hpp
........
  r44917 | danieljames | 2008-04-30 08:18:31 +0100 (Wed, 30 Apr 2008) | 1 line
  
  Support compilers without ADL in the compile tests.
........
  r44918 | danieljames | 2008-04-30 08:25:20 +0100 (Wed, 30 Apr 2008) | 7 lines
  
  Change the typedef of buffered functions as it was confusing MSVC 6.5
  
  get_allocator wasn't compiling when the allocator workaround is used because it
  couldn't cast from the wrapped allocator to an allocator of another type. So
  use value_alloc_ when it's available (it's only unavailable on compilers with
  C++0x support, which don't require the workaround).
........
[SVN r44919]
											
										 
											2008-04-30 07:57:04 +00:00
										 |  |  | #include "./list.hpp"
 | 
					
						
							| 
									
										
										
										
											2008-05-20 15:24:20 +00:00
										 |  |  | #include "./exception_test.hpp"
 | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace test | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     template <class X> | 
					
						
							|  |  |  |     class strong | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
											  
											
												Merge in support for equality operators for the unordered containers and
hopefully better cross-platform support.
Merged revisions 44778-44835,44837-44918 via svnmerge from 
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
  r44778 | danieljames | 2008-04-26 17:15:44 +0100 (Sat, 26 Apr 2008) | 2 lines
  
  Remove a trailing comma.
........
  r44779 | danieljames | 2008-04-26 17:23:51 +0100 (Sat, 26 Apr 2008) | 1 line
  
  Merge in support for equality operators.
........
  r44780 | danieljames | 2008-04-26 17:28:44 +0100 (Sat, 26 Apr 2008) | 1 line
  
  Use my own list container to avoid working around STL container bugs.
........
  r44833 | danieljames | 2008-04-28 08:03:43 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Better equality tests.
........
  r44834 | danieljames | 2008-04-28 08:04:03 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Remove a superfluous check.
........
  r44835 | danieljames | 2008-04-28 08:04:21 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Add equality reference documentation.
........
  r44916 | danieljames | 2008-04-30 08:16:52 +0100 (Wed, 30 Apr 2008) | 1 line
  
  New version of list.hpp
........
  r44917 | danieljames | 2008-04-30 08:18:31 +0100 (Wed, 30 Apr 2008) | 1 line
  
  Support compilers without ADL in the compile tests.
........
  r44918 | danieljames | 2008-04-30 08:25:20 +0100 (Wed, 30 Apr 2008) | 7 lines
  
  Change the typedef of buffered functions as it was confusing MSVC 6.5
  
  get_allocator wasn't compiling when the allocator workaround is used because it
  couldn't cast from the wrapped allocator to an allocator of another type. So
  use value_alloc_ when it's available (it's only unavailable on compilers with
  C++0x support, which don't require the workaround).
........
[SVN r44919]
											
										 
											2008-04-30 07:57:04 +00:00
										 |  |  |         typedef test::list<BOOST_DEDUCED_TYPENAME X::value_type> values_type; | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |         values_type values_; | 
					
						
							| 
									
										
										
										
											2009-10-03 16:41:11 +00:00
										 |  |  |         unsigned int allocations_; | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |     public: | 
					
						
							| 
									
										
										
										
											2009-10-03 16:41:11 +00:00
										 |  |  |         void store(X const& x, unsigned int allocations = 0) { | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |             DISABLE_EXCEPTIONS; | 
					
						
							|  |  |  |             values_.clear(); | 
					
						
							| 
									
										
											  
											
												Merge in support for equality operators for the unordered containers and
hopefully better cross-platform support.
Merged revisions 44778-44835,44837-44918 via svnmerge from 
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
  r44778 | danieljames | 2008-04-26 17:15:44 +0100 (Sat, 26 Apr 2008) | 2 lines
  
  Remove a trailing comma.
........
  r44779 | danieljames | 2008-04-26 17:23:51 +0100 (Sat, 26 Apr 2008) | 1 line
  
  Merge in support for equality operators.
........
  r44780 | danieljames | 2008-04-26 17:28:44 +0100 (Sat, 26 Apr 2008) | 1 line
  
  Use my own list container to avoid working around STL container bugs.
........
  r44833 | danieljames | 2008-04-28 08:03:43 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Better equality tests.
........
  r44834 | danieljames | 2008-04-28 08:04:03 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Remove a superfluous check.
........
  r44835 | danieljames | 2008-04-28 08:04:21 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Add equality reference documentation.
........
  r44916 | danieljames | 2008-04-30 08:16:52 +0100 (Wed, 30 Apr 2008) | 1 line
  
  New version of list.hpp
........
  r44917 | danieljames | 2008-04-30 08:18:31 +0100 (Wed, 30 Apr 2008) | 1 line
  
  Support compilers without ADL in the compile tests.
........
  r44918 | danieljames | 2008-04-30 08:25:20 +0100 (Wed, 30 Apr 2008) | 7 lines
  
  Change the typedef of buffered functions as it was confusing MSVC 6.5
  
  get_allocator wasn't compiling when the allocator workaround is used because it
  couldn't cast from the wrapped allocator to an allocator of another type. So
  use value_alloc_ when it's available (it's only unavailable on compilers with
  C++0x support, which don't require the workaround).
........
[SVN r44919]
											
										 
											2008-04-30 07:57:04 +00:00
										 |  |  |             values_.insert(x.cbegin(), x.cend()); | 
					
						
							| 
									
										
										
										
											2009-10-03 16:41:11 +00:00
										 |  |  |             allocations_ = allocations; | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-03 16:41:11 +00:00
										 |  |  |         void test(X const& x, unsigned int allocations = 0) const { | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |             if(!(x.size() == values_.size() && | 
					
						
							| 
									
										
											  
											
												Merge in support for equality operators for the unordered containers and
hopefully better cross-platform support.
Merged revisions 44778-44835,44837-44918 via svnmerge from 
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
  r44778 | danieljames | 2008-04-26 17:15:44 +0100 (Sat, 26 Apr 2008) | 2 lines
  
  Remove a trailing comma.
........
  r44779 | danieljames | 2008-04-26 17:23:51 +0100 (Sat, 26 Apr 2008) | 1 line
  
  Merge in support for equality operators.
........
  r44780 | danieljames | 2008-04-26 17:28:44 +0100 (Sat, 26 Apr 2008) | 1 line
  
  Use my own list container to avoid working around STL container bugs.
........
  r44833 | danieljames | 2008-04-28 08:03:43 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Better equality tests.
........
  r44834 | danieljames | 2008-04-28 08:04:03 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Remove a superfluous check.
........
  r44835 | danieljames | 2008-04-28 08:04:21 +0100 (Mon, 28 Apr 2008) | 1 line
  
  Add equality reference documentation.
........
  r44916 | danieljames | 2008-04-30 08:16:52 +0100 (Wed, 30 Apr 2008) | 1 line
  
  New version of list.hpp
........
  r44917 | danieljames | 2008-04-30 08:18:31 +0100 (Wed, 30 Apr 2008) | 1 line
  
  Support compilers without ADL in the compile tests.
........
  r44918 | danieljames | 2008-04-30 08:25:20 +0100 (Wed, 30 Apr 2008) | 7 lines
  
  Change the typedef of buffered functions as it was confusing MSVC 6.5
  
  get_allocator wasn't compiling when the allocator workaround is used because it
  couldn't cast from the wrapped allocator to an allocator of another type. So
  use value_alloc_ when it's available (it's only unavailable on compilers with
  C++0x support, which don't require the workaround).
........
[SVN r44919]
											
										 
											2008-04-30 07:57:04 +00:00
										 |  |  |                     std::equal(x.cbegin(), x.cend(), values_.begin(), | 
					
						
							|  |  |  |                         test::equivalent))) | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |                 BOOST_ERROR("Strong exception safety failure."); | 
					
						
							| 
									
										
										
										
											2009-10-03 16:41:11 +00:00
										 |  |  |             if(allocations != allocations_) | 
					
						
							|  |  |  |                 BOOST_ERROR("Strong exception failure: extra allocations."); | 
					
						
							| 
									
										
										
										
											2006-05-21 17:14:11 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |