tag.hpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_TAG_HPP
  9. #define BOOST_FLYWEIGHT_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. /* A type T can be used as a tag in the specification of a flyweight
  17. * by passing it wrapped in the form tag<T>.
  18. */
  19. namespace boost{
  20. namespace flyweights{
  21. namespace detail{
  22. struct tag_marker{};
  23. template<typename T>
  24. struct is_tag:is_base_and_derived<tag_marker,T>
  25. {};
  26. } /* namespace flyweights::detail */
  27. template<typename T=parameter::void_>
  28. struct tag:parameter::template_keyword<tag<>,T>,detail::tag_marker
  29. {};
  30. } /* namespace flyweights */
  31. } /* namespace boost */
  32. #endif