]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/flyweight/test/test_assoc_cont_factory.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / flyweight / test / test_assoc_cont_factory.cpp
1 /* Boost.Flyweight test of assoc_container_factory.
2 *
3 * Copyright 2006-2008 Joaquin M Lopez Munoz.
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
7 *
8 * See http://www.boost.org/libs/flyweight for library home page.
9 */
10
11 #include "test_assoc_cont_factory.hpp"
12
13 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
14 #include <boost/flyweight/assoc_container_factory.hpp>
15 #include <boost/flyweight/flyweight.hpp>
16 #include <boost/flyweight/refcounted.hpp>
17 #include <boost/flyweight/simple_locking.hpp>
18 #include <boost/flyweight/static_holder.hpp>
19 #include <functional>
20 #include <set>
21 #include "test_basic_template.hpp"
22
23 using namespace boost::flyweights;
24
25 struct reverse_set_specifier
26 {
27 template<typename Entry,typename Key>
28 struct apply
29 {
30 typedef std::set<Entry,std::greater<Key> > type;
31 };
32 };
33
34 struct assoc_container_factory_flyweight_specifier1
35 {
36 template<typename T>
37 struct apply
38 {
39 typedef flyweight<
40 T,
41 assoc_container_factory<reverse_set_specifier>
42 > type;
43 };
44 };
45
46 struct assoc_container_factory_flyweight_specifier2
47 {
48 template<typename T>
49 struct apply
50 {
51 typedef flyweight<
52 T,
53 assoc_container_factory_class<
54 std::set<
55 boost::mpl::_1,
56 std::greater<boost::mpl::_2>,
57 std::allocator<boost::mpl::_1>
58 >
59 >
60 > type;
61 };
62 };
63
64 void test_assoc_container_factory()
65 {
66 test_basic_template<assoc_container_factory_flyweight_specifier1>();
67 test_basic_template<assoc_container_factory_flyweight_specifier2>();
68 }