overwrite_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/overwrite_tagged.hpp
  9. /// \brief Hard tagging
  10. #ifndef BOOST_BIMAP_TAGS_SUPPORT_OVERWRITE_TAGGED_HPP
  11. #define BOOST_BIMAP_TAGS_SUPPORT_OVERWRITE_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::overwrite_tagged
  18. \brief Hard tagging metafunction
  19. \code
  20. template< class Type, class Tag >
  21. struct overwrite_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. passed tag. If it is tagged it returns a new tagged type with the tag replaced
  28. by the one passed as a parameter.
  29. See also tagged, default_tagged.
  30. **/
  31. #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  32. namespace boost {
  33. namespace bimaps {
  34. namespace tags {
  35. namespace support {
  36. // Change the tag
  37. template< class Type, class NewTag >
  38. struct overwrite_tagged
  39. {
  40. typedef tagged<Type,NewTag> type;
  41. };
  42. template< class Type, class OldTag, class NewTag >
  43. struct overwrite_tagged< tagged< Type, OldTag >, NewTag >
  44. {
  45. typedef tagged<Type,NewTag> 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_OVERWRITE_TAGGED_HPP