1 /* Copyright 2006-2011 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) 5 * 6 * See http://www.boost.org/libs/flyweight for library home page. 7 */ 8 9 #ifndef BOOST_FLYWEIGHT_INTERMODULE_HOLDER_HPP 10 #define BOOST_FLYWEIGHT_INTERMODULE_HOLDER_HPP 11 12 #if defined(_MSC_VER) 13 #pragma once 14 #endif 15 16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ 17 #include <boost/flyweight/holder_tag.hpp> 18 #include <boost/flyweight/intermodule_holder_fwd.hpp> 19 #include <boost/interprocess/detail/intermodule_singleton.hpp> 20 #include <boost/mpl/aux_/lambda_support.hpp> 21 22 /* intermodule_holder_class guarantees a unique instance across all dynamic 23 * modules of a program. 24 */ 25 26 namespace boost{ 27 28 namespace flyweights{ 29 30 template<typename C> 31 struct intermodule_holder_class: 32 interprocess::ipcdetail::intermodule_singleton<C,true>, 33 holder_marker 34 { 35 typedef intermodule_holder_class type; 36 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,intermodule_holder_class,(C)) 37 }; 38 39 /* intermodule_holder_class specifier */ 40 41 struct intermodule_holder:holder_marker 42 { 43 template<typename C> 44 struct apply 45 { 46 typedef intermodule_holder_class<C> type; 47 }; 48 }; 49 50 } /* namespace flyweights */ 51 52 } /* namespace boost */ 53 54 #endif 55