1 /*=============================================================================
2 Copyright (c) 2007 Tobias Schwinger
4 Use modification and distribution are subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
7 ==============================================================================*/
9 #if !defined(BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED)
10 #define BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED
12 #include <boost/fusion/support/config.hpp>
13 #include <boost/ref.hpp>
15 #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
19 namespace boost { namespace fusion { namespace traits
21 template <typename T> struct deduce;
23 //----- ---- --- -- - - - -
25 // Non-references pass unchanged
34 struct deduce<T const>
40 struct deduce<T volatile>
46 struct deduce<T const volatile>
51 // Keep references on mutable LValues
60 struct deduce<T volatile&>
62 typedef T volatile& type;
65 // Store away potential RValues
68 struct deduce<T const&>
74 struct deduce<T const volatile&>
79 // Unwrap Boost.RefS (referencee cv is deduced)
82 struct deduce<reference_wrapper<T> & >
88 struct deduce<reference_wrapper<T> const & >
93 // Also unwrap C++11 std::ref if available (referencee cv is deduced)
94 #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
96 struct deduce<std::reference_wrapper<T> &>
101 template <typename T>
102 struct deduce<std::reference_wrapper<T> const &>
108 // Keep references on arrays, even if const
110 template <typename T, int N>
111 struct deduce<T(&)[N]>
116 template <typename T, int N>
117 struct deduce<volatile T(&)[N]>
119 typedef volatile T(&type)[N];
122 template <typename T, int N>
123 struct deduce<const T(&)[N]>
125 typedef const T(&type)[N];
128 template <typename T, int N>
129 struct deduce<const volatile T(&)[N]>
131 typedef const volatile T(&type)[N];