msvc_index_specifier.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Copyright 2003-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/multi_index for library home page.
  7. */
  8. #ifndef BOOST_MULTI_INDEX_DETAIL_MSVC_INDEX_SPECIFIER_HPP
  9. #define BOOST_MULTI_INDEX_DETAIL_MSVC_INDEX_SPECIFIER_HPP
  10. #if defined(_MSC_VER)&&(_MSC_VER>=1200)
  11. #pragma once
  12. #endif
  13. #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
  14. #include <boost/detail/workaround.hpp>
  15. #if BOOST_WORKAROUND(BOOST_MSVC,<1310)
  16. /* Workaround for a problem in MSVC with dependent template typedefs
  17. * when accesing index specifiers.
  18. * Modeled after <boost/mpl/aux_/msvc_dtw.hpp> (thanks, Aleksey!)
  19. */
  20. #include <boost/mpl/aux_/msvc_never_true.hpp>
  21. namespace boost{
  22. namespace multi_index{
  23. namespace detail{
  24. template<typename IndexSpecifier>
  25. struct msvc_index_specifier
  26. {
  27. template<bool> struct fake_index_type:IndexSpecifier{};
  28. template<> struct fake_index_type<true>
  29. {
  30. template<typename Super>
  31. struct node_class{};
  32. template<typename Super>
  33. struct index_class{};
  34. };
  35. template<typename Super>
  36. struct result_node_class:
  37. fake_index_type<mpl::aux::msvc_never_true<IndexSpecifier>::value>::
  38. template node_class<Super>
  39. {
  40. };
  41. template<typename Super>
  42. struct result_index_class:
  43. fake_index_type<mpl::aux::msvc_never_true<IndexSpecifier>::value>::
  44. template index_class<Super>
  45. {
  46. };
  47. };
  48. } /* namespace multi_index::detail */
  49. } /* namespace multi_index */
  50. } /* namespace boost */
  51. #endif /* workaround */
  52. #endif