annotate DEPENDENCIES/generic/include/boost/fusion/support/deduce.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 /*=============================================================================
Chris@16 2 Copyright (c) 2007 Tobias Schwinger
Chris@16 3
Chris@16 4 Use modification and distribution are subject to the Boost Software
Chris@16 5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 http://www.boost.org/LICENSE_1_0.txt).
Chris@16 7 ==============================================================================*/
Chris@16 8
Chris@16 9 #if !defined(BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED)
Chris@16 10 #define BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED
Chris@16 11
Chris@101 12 #include <boost/fusion/support/config.hpp>
Chris@16 13 #include <boost/ref.hpp>
Chris@16 14
Chris@101 15 #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
Chris@101 16 #include <functional>
Chris@101 17 #endif
Chris@101 18
Chris@16 19 namespace boost { namespace fusion { namespace traits
Chris@16 20 {
Chris@16 21 template <typename T> struct deduce;
Chris@16 22
Chris@16 23 //----- ---- --- -- - - - -
Chris@16 24
Chris@16 25 // Non-references pass unchanged
Chris@16 26
Chris@16 27 template <typename T>
Chris@16 28 struct deduce
Chris@16 29 {
Chris@16 30 typedef T type;
Chris@16 31 };
Chris@16 32
Chris@16 33 template <typename T>
Chris@16 34 struct deduce<T const>
Chris@16 35 {
Chris@16 36 typedef T type;
Chris@16 37 };
Chris@16 38
Chris@16 39 template <typename T>
Chris@16 40 struct deduce<T volatile>
Chris@16 41 {
Chris@16 42 typedef T type;
Chris@16 43 };
Chris@16 44
Chris@16 45 template <typename T>
Chris@16 46 struct deduce<T const volatile>
Chris@16 47 {
Chris@16 48 typedef T type;
Chris@16 49 };
Chris@16 50
Chris@16 51 // Keep references on mutable LValues
Chris@16 52
Chris@16 53 template <typename T>
Chris@16 54 struct deduce<T &>
Chris@16 55 {
Chris@16 56 typedef T & type;
Chris@16 57 };
Chris@16 58
Chris@16 59 template <typename T>
Chris@16 60 struct deduce<T volatile&>
Chris@16 61 {
Chris@16 62 typedef T volatile& type;
Chris@16 63 };
Chris@16 64
Chris@16 65 // Store away potential RValues
Chris@16 66
Chris@16 67 template <typename T>
Chris@16 68 struct deduce<T const&>
Chris@16 69 {
Chris@16 70 typedef T type;
Chris@16 71 };
Chris@16 72
Chris@16 73 template <typename T>
Chris@16 74 struct deduce<T const volatile&>
Chris@16 75 {
Chris@16 76 typedef T type;
Chris@16 77 };
Chris@16 78
Chris@16 79 // Unwrap Boost.RefS (referencee cv is deduced)
Chris@16 80
Chris@16 81 template <typename T>
Chris@16 82 struct deduce<reference_wrapper<T> & >
Chris@16 83 {
Chris@16 84 typedef T& type;
Chris@16 85 };
Chris@16 86
Chris@16 87 template <typename T>
Chris@16 88 struct deduce<reference_wrapper<T> const & >
Chris@16 89 {
Chris@16 90 typedef T& type;
Chris@16 91 };
Chris@16 92
Chris@101 93 // Also unwrap C++11 std::ref if available (referencee cv is deduced)
Chris@101 94 #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
Chris@101 95 template <typename T>
Chris@101 96 struct deduce<std::reference_wrapper<T> &>
Chris@101 97 {
Chris@101 98 typedef T& type;
Chris@101 99 };
Chris@101 100
Chris@101 101 template <typename T>
Chris@101 102 struct deduce<std::reference_wrapper<T> const &>
Chris@101 103 {
Chris@101 104 typedef T& type;
Chris@101 105 };
Chris@101 106 #endif
Chris@101 107
Chris@16 108 // Keep references on arrays, even if const
Chris@16 109
Chris@16 110 template <typename T, int N>
Chris@16 111 struct deduce<T(&)[N]>
Chris@16 112 {
Chris@16 113 typedef T(&type)[N];
Chris@16 114 };
Chris@16 115
Chris@16 116 template <typename T, int N>
Chris@16 117 struct deduce<volatile T(&)[N]>
Chris@16 118 {
Chris@16 119 typedef volatile T(&type)[N];
Chris@16 120 };
Chris@16 121
Chris@16 122 template <typename T, int N>
Chris@16 123 struct deduce<const T(&)[N]>
Chris@16 124 {
Chris@16 125 typedef const T(&type)[N];
Chris@16 126 };
Chris@16 127
Chris@16 128 template <typename T, int N>
Chris@16 129 struct deduce<const volatile T(&)[N]>
Chris@16 130 {
Chris@16 131 typedef const volatile T(&type)[N];
Chris@16 132 };
Chris@16 133
Chris@16 134 }}}
Chris@16 135
Chris@16 136 #endif
Chris@16 137