as_fusion_element.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*=============================================================================
  2. Copyright (c) 1999-2003 Jaakko Jarvi
  3. Copyright (c) 2001-2011 Joel de Guzman
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(FUSION_AS_FUSION_ELEMENT_05052005_0338)
  8. #define FUSION_AS_FUSION_ELEMENT_05052005_0338
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/ref.hpp>
  11. #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
  12. #include <functional>
  13. #endif
  14. namespace boost { namespace fusion { namespace detail
  15. {
  16. template <typename T>
  17. struct as_fusion_element
  18. {
  19. typedef T type;
  20. };
  21. template <typename T>
  22. struct as_fusion_element<reference_wrapper<T> >
  23. {
  24. typedef T& type;
  25. };
  26. #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
  27. template <typename T>
  28. struct as_fusion_element<std::reference_wrapper<T> >
  29. {
  30. typedef T& type;
  31. };
  32. #endif
  33. template <typename T, int N>
  34. struct as_fusion_element<T[N]>
  35. {
  36. typedef const T(&type)[N];
  37. };
  38. template <typename T, int N>
  39. struct as_fusion_element<volatile T[N]>
  40. {
  41. typedef const volatile T(&type)[N];
  42. };
  43. template <typename T, int N>
  44. struct as_fusion_element<const volatile T[N]>
  45. {
  46. typedef const volatile T(&type)[N];
  47. };
  48. }}}
  49. #endif