access.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*=============================================================================
  2. Copyright (c) 2006-2007 Tobias Schwinger
  3. Use modification and distribution are subject to the Boost Software
  4. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ==============================================================================*/
  7. #if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_ACCESS_HPP_INCLUDED)
  8. #define BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_ACCESS_HPP_INCLUDED
  9. namespace boost { namespace fusion { namespace detail
  10. {
  11. // const reference deduction for function templates that accept T const &
  12. template <typename T> struct cref { typedef T const& type; };
  13. template <typename T> struct cref<T&> { typedef T const& type; };
  14. template <typename T> struct cref<T const> { typedef T const& type; };
  15. // mutable reference deduction for function templates that accept T &
  16. template <typename T> struct mref { typedef T & type; };
  17. template <typename T> struct mref<T&> { typedef T & type; };
  18. // generic reference deduction for function templates that are overloaded
  19. // to accept both T const & and T &
  20. template <typename T> struct gref { typedef T const& type; };
  21. template <typename T> struct gref<T&> { typedef T & type; };
  22. template <typename T> struct gref<T const> { typedef T const& type; };
  23. // appropriately qualified target function in const context
  24. template <typename T> struct qf_c { typedef T const type; };
  25. template <typename T> struct qf_c<T const> { typedef T const type; };
  26. template <typename T> struct qf_c<T &> { typedef T type; };
  27. // appropriately qualified target function in non-const context
  28. template <typename T> struct qf { typedef T type; };
  29. template <typename T> struct qf<T const> { typedef T const type; };
  30. template <typename T> struct qf<T &> { typedef T type; };
  31. }}}
  32. #endif