tag.hpp 1023 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef BOOST_MPL_TAG_HPP_INCLUDED
  2. #define BOOST_MPL_TAG_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2004
  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. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/eval_if.hpp>
  14. #include <boost/mpl/void.hpp>
  15. #include <boost/mpl/aux_/has_tag.hpp>
  16. #include <boost/mpl/aux_/config/eti.hpp>
  17. namespace boost { namespace mpl {
  18. namespace aux {
  19. template< typename T > struct tag_impl
  20. {
  21. typedef typename T::tag type;
  22. };
  23. }
  24. template< typename T, typename Default = void_ > struct tag
  25. #if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
  26. : if_<
  27. aux::has_tag<T>
  28. , aux::tag_impl<T>
  29. , Default
  30. >::type
  31. {
  32. #else
  33. {
  34. typedef typename eval_if<
  35. aux::has_tag<T>
  36. , aux::tag_impl<T>
  37. , Default
  38. >::type type;
  39. #endif
  40. };
  41. }}
  42. #endif // BOOST_MPL_TAG_HPP_INCLUDED