fix doc example typo
[boost.git] / boost / flyweight / factory_tag.hpp
blobddb747304e82e86a2fd35091f8d705f843b226ae
1 /* Copyright 2006-2008 Joaquin M Lopez Munoz.
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
6 * See http://www.boost.org/libs/flyweight for library home page.
7 */
9 #ifndef BOOST_FLYWEIGHT_FACTORY_TAG_HPP
10 #define BOOST_FLYWEIGHT_FACTORY_TAG_HPP
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200)
13 #pragma once
14 #endif
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/parameter/parameters.hpp>
18 #include <boost/type_traits/is_base_and_derived.hpp>
20 namespace boost{
22 namespace flyweights{
24 /* Three ways to indicate that a given class T is a factory specifier:
25 * 1. Make it derived from factory_marker.
26 * 2. Specialize is_factory to evaluate to boost::mpl::true_.
27 * 3. Pass it as factory<T> when defining a flyweight type.
30 struct factory_marker{};
32 template<typename T>
33 struct is_factory:is_base_and_derived<factory_marker,T>
34 {};
36 template<typename T=parameter::void_>
37 struct factory:parameter::template_keyword<factory<>,T>
38 {};
40 } /* namespace flyweights */
42 } /* namespace boost */
44 #endif