A few tweaks for the unordered tests.

Merged revisions 44461-44462,44466 via svnmerge from 
https://svn.boost.org/svn/boost/branches/unordered/trunk

........
  r44461 | danieljames | 2008-04-16 18:34:48 +0100 (Wed, 16 Apr 2008) | 2 lines
  
  Try to get some more tests working on Borland.
........
  r44462 | danieljames | 2008-04-16 18:34:59 +0100 (Wed, 16 Apr 2008) | 2 lines
  
  Write out the number of copies when the unnecessary copy test fails.
........
  r44466 | danieljames | 2008-04-16 18:35:44 +0100 (Wed, 16 Apr 2008) | 2 lines
  
  Add compile test for get_allocator.
........


[SVN r44488]
This commit is contained in:
Daniel James
2008-04-17 07:42:47 +00:00
parent 9cfee57633
commit 07addb7030
3 changed files with 16 additions and 9 deletions

View File

@ -8,11 +8,7 @@
#include <boost/config.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
@ -82,7 +78,8 @@ namespace test
// Non Const Value Type
struct map_non_const_value_type
template <bool IsMap>
struct non_const_value_type_impl
{
template <class Container>
struct apply {
@ -92,7 +89,8 @@ namespace test
};
};
struct set_non_const_value_type
template<>
struct non_const_value_type_impl<false>
{
template <class Container>
struct apply {
@ -102,9 +100,8 @@ namespace test
template <class Container>
struct non_const_value_type
: boost::mpl::apply1<
BOOST_DEDUCED_TYPENAME boost::mpl::if_<is_map<Container>, map_non_const_value_type, set_non_const_value_type>::type,
Container>
: non_const_value_type_impl< ::test::is_map<Container>::value>::
BOOST_NESTED_TEMPLATE apply<Container>
{
};
}

View File

@ -127,6 +127,11 @@ void container_test(X& r, T&)
test::check_return_type<size_type>::equals(a.size());
test::check_return_type<size_type>::equals(a.max_size());
test::check_return_type<bool>::convertible(a.empty());
// Allocator
typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
test::check_return_type<allocator_type>::equals(a_const.get_allocator());
}
template <class X, class Key>

View File

@ -45,8 +45,13 @@ namespace unnecessary_copy_tests
T x;
BOOST_DEDUCED_TYPENAME T::value_type a;
BOOST_CHECK(count_copies::count == 1);
if(count_copies::count != 1)
std::cerr<<count_copies::count<<" copies.\n";
x.insert(a);
BOOST_CHECK(count_copies::count == 2);
if(count_copies::count != 1)
std::cerr<<count_copies::count<<" copies.\n";
}
boost::unordered_set<count_copies>* set;