1/* Boost.Flyweight test of set_factory.
2 *
3 * Copyright 2006-2013 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_set_factory.hpp"
12
13#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
14#include <boost/flyweight/flyweight.hpp>
15#include <boost/flyweight/refcounted.hpp>
16#include <boost/flyweight/set_factory.hpp>
17#include <boost/flyweight/simple_locking.hpp>
18#include <boost/flyweight/static_holder.hpp>
19#include <functional>
20#include "test_basic_template.hpp"
21
22using namespace boost::flyweights;
23
24struct set_factory_flyweight_specifier1
25{
26 template<typename T>
27 struct apply
28 {
29 typedef flyweight<T,set_factory<> > type;
30 };
31};
32
33struct set_factory_flyweight_specifier2
34{
35 template<typename T>
36 struct apply
37 {
38 typedef flyweight<
39 T,
40 static_holder_class<boost::mpl::_1>,
41 set_factory_class<
42 boost::mpl::_1,boost::mpl::_2,
43 std::greater<boost::mpl::_2>,
44 std::allocator<boost::mpl::_1>
45 >
46 > type;
47 };
48};
49
50struct set_factory_flyweight_specifier3
51{
52 template<typename T>
53 struct apply
54 {
55 typedef flyweight<
56 T,
57 set_factory<
58 std::greater<boost::mpl::_2>,
59 std::allocator<boost::mpl::_1>
60 >,
61 static_holder_class<boost::mpl::_1>,
62 tag<char>
63 > type;
64 };
65};
66
67void test_set_factory()
68{
69 test_basic_template<set_factory_flyweight_specifier1>();
70 test_basic_template<set_factory_flyweight_specifier2>();
71 test_basic_template<set_factory_flyweight_specifier3>();
72}
73

source code of boost/libs/flyweight/test/test_set_factory.cpp