default_tagged.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Boost.Bimap
  2. //
  3. // Copyright (c) 2006-2007 Matias Capeletto
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. /// \file tags/support/default_tagged.hpp
  9. /// \brief Weak tagging
  10. #ifndef BOOST_BIMAP_TAGS_SUPPORT_DEFAULT_TAGGED_HPP
  11. #define BOOST_BIMAP_TAGS_SUPPORT_DEFAULT_TAGGED_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/tags/tagged.hpp>
  17. /** \struct boost::bimaps::tags::support::default_tagged
  18. \brief Weak tagging metafunction
  19. \code
  20. template< class Type, class Tag >
  21. struct default_tagged
  22. {
  23. typedef {TaggedType} type;
  24. };
  25. \endcode
  26. If the type is not tagged, this metafunction returns a tagged type with the
  27. default tag. If it is tagged, the returns the type unchanged.
  28. See also tagged, overwrite_tagged.
  29. **/
  30. #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  31. namespace boost {
  32. namespace bimaps {
  33. namespace tags {
  34. namespace support {
  35. // Default Tagging
  36. // A metafunction that create a tagged type with a default tag value.
  37. template< class Type, class DefaultTag >
  38. struct default_tagged
  39. {
  40. typedef tagged<Type,DefaultTag> type;
  41. };
  42. template< class Type, class OldTag, class NewTag >
  43. struct default_tagged< tagged< Type, OldTag >, NewTag >
  44. {
  45. typedef tagged<Type,OldTag> type;
  46. };
  47. } // namespace support
  48. } // namespace tags
  49. } // namespace bimaps
  50. } // namespace boost
  51. #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  52. #endif // BOOST_BIMAP_TAGS_SUPPORT_DEFAULT_TAGGED_HPP