2009-11-20 08:03:26 +00:00
|
|
|
|
|
|
|
|
// Copyright 2009 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)
|
|
|
|
|
|
2009-11-26 23:15:30 +00:00
|
|
|
#include "../helpers/prefix.hpp"
|
|
|
|
|
|
2009-11-20 08:03:26 +00:00
|
|
|
#include <boost/unordered_map.hpp>
|
|
|
|
|
#include <boost/unordered_set.hpp>
|
|
|
|
|
|
|
|
|
|
namespace test
|
|
|
|
|
{
|
|
|
|
|
struct value;
|
|
|
|
|
struct hash;
|
|
|
|
|
struct equals;
|
|
|
|
|
template <class T>
|
|
|
|
|
struct malloc_allocator;
|
|
|
|
|
|
|
|
|
|
typedef boost::unordered_map<value, value, hash, equals, malloc_allocator<std::pair<value const, value> > > map;
|
|
|
|
|
typedef boost::unordered_multimap<value, value, hash, equals, malloc_allocator<std::pair<value const, value> > > multimap;
|
|
|
|
|
typedef boost::unordered_set<value, hash, equals, malloc_allocator<value> > set;
|
|
|
|
|
typedef boost::unordered_multiset<value, hash, equals, malloc_allocator<value> > multiset;
|
|
|
|
|
|
|
|
|
|
struct value {};
|
|
|
|
|
struct hash { std::size_t operator()(value const&) const { return 0; } };
|
|
|
|
|
struct equals { bool operator()(value const&, value const&) const { return true; } };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include "../helpers/allocator.hpp"
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
test::map m1;
|
|
|
|
|
test::multimap m2;
|
|
|
|
|
test::set s1;
|
|
|
|
|
test::multiset s2;
|
|
|
|
|
|
2009-11-25 09:09:25 +00:00
|
|
|
test::value x;
|
|
|
|
|
m1[x] = x;
|
|
|
|
|
m2.insert(std::make_pair(x, x));
|
|
|
|
|
s1.insert(x);
|
|
|
|
|
s2.insert(x);
|
2009-11-21 19:40:28 +00:00
|
|
|
}
|