tracking_tag.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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)
  5. *
  6. * See http://www.boost.org/libs/flyweight for library home page.
  7. */
  8. #ifndef BOOST_FLYWEIGHT_TRACKING_TAG_HPP
  9. #define BOOST_FLYWEIGHT_TRACKING_TAG_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/parameter/parameters.hpp>
  15. #include <boost/type_traits/is_base_and_derived.hpp>
  16. namespace boost{
  17. namespace flyweights{
  18. /* Three ways to indicate that a given class T is a tracking policy:
  19. * 1. Make it derived from tracking_marker.
  20. * 2. Specialize is_tracking to evaluate to boost::mpl::true_.
  21. * 3. Pass it as tracking<T> when defining a flyweight type.
  22. */
  23. struct tracking_marker{};
  24. template<typename T>
  25. struct is_tracking:is_base_and_derived<tracking_marker,T>
  26. {};
  27. template<typename T=parameter::void_>
  28. struct tracking:parameter::template_keyword<tracking<>,T>
  29. {};
  30. } /* namespace flyweights */
  31. } /* namespace boost */
  32. #endif