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