2 // Copyright 2005-2009 Daniel James.
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)
6 #if !defined(BOOST_UNORDERED_TEST_HELPERS_STRONG_HEADER)
7 #define BOOST_UNORDERED_TEST_HELPERS_STRONG_HEADER
9 #include "./equivalent.hpp"
10 #include "./exception_test.hpp"
12 #include <boost/config.hpp>
16 template <class X> class strong
18 typedef test::list<BOOST_DEDUCED_TYPENAME X::value_type> values_type;
20 unsigned int allocations_;
23 void store(X const& x, unsigned int allocations = 0)
27 values_.insert(x.cbegin(), x.cend());
28 allocations_ = allocations;
31 void test(X const& x, unsigned int allocations = 0) const
33 if (!(x.size() == values_.size() && test::equal(x.cbegin(), x.cend(),
34 values_.begin(), test::equivalent)))
35 BOOST_ERROR("Strong exception safety failure.");
36 if (allocations != allocations_)
37 BOOST_ERROR("Strong exception failure: extra allocations.");