1/* Boost.Flyweight basic test.
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_basic.hpp"
12
13#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
14#include <boost/flyweight.hpp>
15#include "test_basic_template.hpp"
16
17using namespace boost::flyweights;
18
19struct basic_flyweight_specifier1
20{
21 template<typename T>
22 struct apply
23 {
24 typedef flyweight<T> type;
25 };
26};
27
28struct basic_flyweight_specifier2
29{
30 template<typename T>
31 struct apply
32 {
33 typedef flyweight<
34 T,tag<int>,
35 static_holder_class<boost::mpl::_1>,
36 hashed_factory_class<
37 boost::mpl::_1,boost::mpl::_2,
38 boost::hash<boost::mpl::_2>,std::equal_to<boost::mpl::_2>,
39 std::allocator<boost::mpl::_1>
40 >,
41 simple_locking,
42 refcounted
43 > type;
44 };
45};
46
47struct basic_flyweight_specifier3
48{
49 template<typename T>
50 struct apply
51 {
52 typedef flyweight<
53 T,
54 hashed_factory<
55 boost::hash<boost::mpl::_2>,std::equal_to<boost::mpl::_2>,
56 std::allocator<boost::mpl::_1>
57 >,
58 tag<int>
59 > type;
60 };
61};
62
63void test_basic()
64{
65 test_basic_template<basic_flyweight_specifier1>();
66 test_basic_template<basic_flyweight_specifier2>();
67 test_basic_template<basic_flyweight_specifier3>();
68}
69

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