Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:39:57

0001 /*=============================================================================
0002     Copyright (c) 2007 Tobias Schwinger
0003   
0004     Use modification and distribution are subject to the Boost Software 
0005     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006     http://www.boost.org/LICENSE_1_0.txt).
0007 ==============================================================================*/
0008 
0009 #if !defined(BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED)
0010 #define BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED
0011 
0012 #include <boost/fusion/support/config.hpp>
0013 #include <boost/core/ref.hpp>
0014 
0015 #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
0016 #include <functional>
0017 #endif
0018 
0019 namespace boost { namespace fusion { namespace traits
0020 {
0021     template <typename T> struct deduce;
0022 
0023     //----- ---- --- -- - -  -   -
0024 
0025     // Non-references pass unchanged
0026 
0027     template <typename T>
0028     struct deduce
0029     {
0030         typedef T type; 
0031     };
0032 
0033     template <typename T>
0034     struct deduce<T const>
0035     {
0036         typedef T type;
0037     };
0038 
0039     template <typename T>
0040     struct deduce<T volatile>
0041     {
0042         typedef T type;
0043     };
0044 
0045     template <typename T>
0046     struct deduce<T const volatile>
0047     {
0048         typedef T type;
0049     };
0050 
0051     // Keep references on mutable LValues
0052 
0053     template <typename T>
0054     struct deduce<T &>
0055     {
0056         typedef T & type;
0057     };
0058 
0059     template <typename T>
0060     struct deduce<T volatile&>
0061     {
0062         typedef T volatile& type;
0063     };
0064 
0065     // Store away potential RValues
0066 
0067     template <typename T>
0068     struct deduce<T const&>
0069     {
0070         typedef T type;
0071     };
0072 
0073     template <typename T>
0074     struct deduce<T const volatile&>
0075     {
0076         typedef T type;
0077     };
0078 
0079     // Unwrap Boost.RefS (referencee cv is deduced)
0080 
0081     template <typename T>
0082     struct deduce<reference_wrapper<T> & >
0083     {
0084         typedef T& type;
0085     };
0086 
0087     template <typename T>
0088     struct deduce<reference_wrapper<T> const & >
0089     {
0090         typedef T& type;
0091     };
0092 
0093     // Also unwrap C++11 std::ref if available (referencee cv is deduced)
0094 #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
0095     template <typename T>
0096     struct deduce<std::reference_wrapper<T> &>
0097     {
0098         typedef T& type;
0099     };
0100 
0101     template <typename T>
0102     struct deduce<std::reference_wrapper<T> const &>
0103     {
0104         typedef T& type;
0105     };
0106 #endif
0107 
0108     // Keep references on arrays, even if const
0109 
0110     template <typename T, int N>
0111     struct deduce<T(&)[N]>
0112     {
0113         typedef T(&type)[N];
0114     };
0115 
0116     template <typename T, int N>
0117     struct deduce<volatile T(&)[N]>
0118     {
0119         typedef volatile T(&type)[N]; 
0120     };
0121 
0122     template <typename T, int N>
0123     struct deduce<const T(&)[N]>
0124     {
0125         typedef const T(&type)[N];
0126     };
0127 
0128     template <typename T, int N>
0129     struct deduce<const volatile T(&)[N]>
0130     {
0131         typedef const volatile T(&type)[N];
0132     };
0133 
0134 }}}
0135 
0136 #endif
0137