data_type_by.hpp 1.5 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 support/data_type_by.hpp
  9. /// \brief Metafunction to access the data types of a bimap
  10. #ifndef BOOST_BIMAP_SUPPORT_DATA_TYPE_BY_HPP
  11. #define BOOST_BIMAP_SUPPORT_DATA_TYPE_BY_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/bimap/relation/detail/metadata_access_builder.hpp>
  17. /** \struct boost::bimaps::support::data_type_by
  18. \brief Metafunction to obtain the data type of one of the sides in a bimap
  19. The tag parameter can be either a user defined tag or \c member_at::{side}.
  20. This is the actual data type stored in the bimap.
  21. \code
  22. template< class Tag, class Bimap >
  23. struct data_type_by
  24. {
  25. typedef typename Bimap::{side}_data_type type;
  26. };
  27. \endcode
  28. The following holds:
  29. \code
  30. BOOST_STATIC_ASSERT
  31. (
  32. is_same< data_type_by< member_at::left, bimap<A,B> >::type, A >::value
  33. )
  34. \endcode
  35. See also member_at.
  36. \ingroup bimap_group
  37. **/
  38. namespace boost {
  39. namespace bimaps {
  40. namespace support {
  41. // Implementation of data type of metafunction
  42. BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
  43. (
  44. data_type_by,
  45. left_data_type,
  46. right_data_type
  47. )
  48. } // namespace support
  49. } // namespace bimaps
  50. } // namespace boost
  51. #endif // BOOST_BIMAP_SUPPORT_DATA_TYPE_BY_HPP