forked from boostorg/unordered
https://svn.boost.org/svn/boost/branches/unordered/trunk ........ r43840 | danieljames | 2008-03-24 17:25:07 +0000 (Mon, 24 Mar 2008) | 1 line Fix a g++ warning. ........ r43844 | danieljames | 2008-03-24 17:56:28 +0000 (Mon, 24 Mar 2008) | 1 line It's a new-ish year. ........ r43885 | danieljames | 2008-03-27 20:36:10 +0000 (Thu, 27 Mar 2008) | 1 line The release script doesn't need to copy images and css - because that's now done in the jamfiles. Also tweak the shell script a tad bit. ........ r43890 | danieljames | 2008-03-27 23:01:40 +0000 (Thu, 27 Mar 2008) | 1 line Starting to add a docbook bibliography. ........ r43894 | danieljames | 2008-03-27 23:24:18 +0000 (Thu, 27 Mar 2008) | 1 line Redeclare 'data' in iterator_base to help compilers which have trouble with accessing the nested typedef. ........ [SVN r43895]
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
|
|
// Copyright 2006-2008 Daniel James.
|
|
// 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)
|
|
|
|
#include <boost/unordered_set.hpp>
|
|
#include <boost/unordered_map.hpp>
|
|
#include "../helpers/test.hpp"
|
|
|
|
namespace unnecessary_copy_tests
|
|
{
|
|
struct count_copies
|
|
{
|
|
static int count;
|
|
count_copies() { ++count; }
|
|
count_copies(count_copies const&) { ++count; }
|
|
private:
|
|
count_copies& operator=(count_copies const&);
|
|
};
|
|
|
|
bool operator==(count_copies const&, count_copies const&) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
|
|
namespace boost
|
|
#else
|
|
namespace unnecessary_copy_tests
|
|
#endif
|
|
{
|
|
std::size_t hash_value(unnecessary_copy_tests::count_copies const&) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
namespace unnecessary_copy_tests
|
|
{
|
|
int count_copies::count;
|
|
|
|
template <class T>
|
|
void unnecessary_copy_test(T*)
|
|
{
|
|
count_copies::count = 0;
|
|
T x;
|
|
BOOST_DEDUCED_TYPENAME T::value_type a;
|
|
BOOST_TEST(count_copies::count == 1);
|
|
x.insert(a);
|
|
BOOST_TEST(count_copies::count == 2);
|
|
}
|
|
|
|
boost::unordered_set<count_copies>* set;
|
|
boost::unordered_multiset<count_copies>* multiset;
|
|
boost::unordered_map<int, count_copies>* map;
|
|
boost::unordered_multimap<int, count_copies>* multimap;
|
|
|
|
UNORDERED_TEST(unnecessary_copy_test, ((set)(multiset)(map)(multimap)))
|
|
}
|
|
|
|
RUN_TESTS()
|