intermodule_holder.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #ifndef BOOST_FLYWEIGHT_INTERMODULE_HOLDER_HPP
  9. #define BOOST_FLYWEIGHT_INTERMODULE_HOLDER_HPP
  10. #if defined(_MSC_VER)
  11. #pragma once
  12. #endif
  13. #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
  14. #include <boost/flyweight/holder_tag.hpp>
  15. #include <boost/flyweight/intermodule_holder_fwd.hpp>
  16. #include <boost/interprocess/detail/intermodule_singleton.hpp>
  17. #include <boost/mpl/aux_/lambda_support.hpp>
  18. /* intermodule_holder_class guarantees a unique instance across all dynamic
  19. * modules of a program.
  20. */
  21. namespace boost{
  22. namespace flyweights{
  23. template<typename C>
  24. struct intermodule_holder_class:
  25. interprocess::ipcdetail::intermodule_singleton<C,true>,
  26. holder_marker
  27. {
  28. typedef intermodule_holder_class type;
  29. BOOST_MPL_AUX_LAMBDA_SUPPORT(1,intermodule_holder_class,(C))
  30. };
  31. /* intermodule_holder_class specifier */
  32. struct intermodule_holder:holder_marker
  33. {
  34. template<typename C>
  35. struct apply
  36. {
  37. typedef intermodule_holder_class<C> type;
  38. };
  39. };
  40. } /* namespace flyweights */
  41. } /* namespace boost */
  42. #endif