annotate DEPENDENCIES/generic/include/boost/fusion/support/deduce.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
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@16 12 #include <boost/ref.hpp>
Chris@16 13
Chris@16 14 namespace boost { namespace fusion { namespace traits
Chris@16 15 {
Chris@16 16 template <typename T> struct deduce;
Chris@16 17
Chris@16 18 //----- ---- --- -- - - - -
Chris@16 19
Chris@16 20 // Non-references pass unchanged
Chris@16 21
Chris@16 22 template <typename T>
Chris@16 23 struct deduce
Chris@16 24 {
Chris@16 25 typedef T type;
Chris@16 26 };
Chris@16 27
Chris@16 28 template <typename T>
Chris@16 29 struct deduce<T const>
Chris@16 30 {
Chris@16 31 typedef T type;
Chris@16 32 };
Chris@16 33
Chris@16 34 template <typename T>
Chris@16 35 struct deduce<T volatile>
Chris@16 36 {
Chris@16 37 typedef T type;
Chris@16 38 };
Chris@16 39
Chris@16 40 template <typename T>
Chris@16 41 struct deduce<T const volatile>
Chris@16 42 {
Chris@16 43 typedef T type;
Chris@16 44 };
Chris@16 45
Chris@16 46 // Keep references on mutable LValues
Chris@16 47
Chris@16 48 template <typename T>
Chris@16 49 struct deduce<T &>
Chris@16 50 {
Chris@16 51 typedef T & type;
Chris@16 52 };
Chris@16 53
Chris@16 54 template <typename T>
Chris@16 55 struct deduce<T volatile&>
Chris@16 56 {
Chris@16 57 typedef T volatile& type;
Chris@16 58 };
Chris@16 59
Chris@16 60 // Store away potential RValues
Chris@16 61
Chris@16 62 template <typename T>
Chris@16 63 struct deduce<T const&>
Chris@16 64 {
Chris@16 65 typedef T type;
Chris@16 66 };
Chris@16 67
Chris@16 68 template <typename T>
Chris@16 69 struct deduce<T const volatile&>
Chris@16 70 {
Chris@16 71 typedef T type;
Chris@16 72 };
Chris@16 73
Chris@16 74 // Unwrap Boost.RefS (referencee cv is deduced)
Chris@16 75
Chris@16 76 template <typename T>
Chris@16 77 struct deduce<reference_wrapper<T> & >
Chris@16 78 {
Chris@16 79 typedef T& type;
Chris@16 80 };
Chris@16 81
Chris@16 82 template <typename T>
Chris@16 83 struct deduce<reference_wrapper<T> const & >
Chris@16 84 {
Chris@16 85 typedef T& type;
Chris@16 86 };
Chris@16 87
Chris@16 88 // Keep references on arrays, even if const
Chris@16 89
Chris@16 90 template <typename T, int N>
Chris@16 91 struct deduce<T(&)[N]>
Chris@16 92 {
Chris@16 93 typedef T(&type)[N];
Chris@16 94 };
Chris@16 95
Chris@16 96 template <typename T, int N>
Chris@16 97 struct deduce<volatile T(&)[N]>
Chris@16 98 {
Chris@16 99 typedef volatile T(&type)[N];
Chris@16 100 };
Chris@16 101
Chris@16 102 template <typename T, int N>
Chris@16 103 struct deduce<const T(&)[N]>
Chris@16 104 {
Chris@16 105 typedef const T(&type)[N];
Chris@16 106 };
Chris@16 107
Chris@16 108 template <typename T, int N>
Chris@16 109 struct deduce<const volatile T(&)[N]>
Chris@16 110 {
Chris@16 111 typedef const volatile T(&type)[N];
Chris@16 112 };
Chris@16 113
Chris@16 114 }}}
Chris@16 115
Chris@16 116 #endif
Chris@16 117