]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/detail/reference_content.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
eae9f047d3de101bb746a6d52eeb18bfd6bfee4e
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / detail / reference_content.hpp
1 //-----------------------------------------------------------------------------\r
2 // boost detail/reference_content.hpp header file\r
3 // See http://www.boost.org for updates, documentation, and revision history.\r
4 //-----------------------------------------------------------------------------\r
5 //\r
6 // Copyright (c) 2003\r
7 // Eric Friedman\r
8 //\r
9 // Distributed under the Boost Software License, Version 1.0. (See\r
10 // accompanying file LICENSE_1_0.txt or copy at\r
11 // http://www.boost.org/LICENSE_1_0.txt)\r
12 \r
13 #ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP\r
14 #define BOOST_DETAIL_REFERENCE_CONTENT_HPP\r
15 \r
16 #include "boost/config.hpp"\r
17 \r
18 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
19 #   include "boost/mpl/bool.hpp"\r
20 #   include "boost/type_traits/has_nothrow_copy.hpp"\r
21 #else\r
22 #   include "boost/mpl/if.hpp"\r
23 #   include "boost/type_traits/is_reference.hpp"\r
24 #endif\r
25 \r
26 #include "boost/mpl/void.hpp"\r
27 \r
28 namespace boost {\r
29 \r
30 namespace detail {\r
31 \r
32 ///////////////////////////////////////////////////////////////////////////////\r
33 // (detail) class template reference_content\r
34 //\r
35 // Non-Assignable wrapper for references.\r
36 //\r
37 template <typename RefT>\r
38 class reference_content\r
39 {\r
40 private: // representation\r
41 \r
42     RefT content_;\r
43 \r
44 public: // structors\r
45 \r
46     ~reference_content()\r
47     {\r
48     }\r
49 \r
50     reference_content(RefT r)\r
51         : content_( r )\r
52     {\r
53     }\r
54 \r
55     reference_content(const reference_content& operand)\r
56         : content_( operand.content_ )\r
57     {\r
58     }\r
59 \r
60 private: // non-Assignable\r
61 \r
62     reference_content& operator=(const reference_content&);\r
63 \r
64 public: // queries\r
65 \r
66     RefT get() const\r
67     {\r
68         return content_;\r
69     }\r
70 \r
71 };\r
72 \r
73 ///////////////////////////////////////////////////////////////////////////////\r
74 // (detail) metafunction make_reference_content\r
75 //\r
76 // Wraps with reference_content if specified type is reference.\r
77 //\r
78 \r
79 template <typename T = mpl::void_> struct make_reference_content;\r
80 \r
81 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
82 \r
83 template <typename T>\r
84 struct make_reference_content\r
85 {\r
86     typedef T type;\r
87 };\r
88 \r
89 template <typename T>\r
90 struct make_reference_content< T& >\r
91 {\r
92     typedef reference_content<T&> type;\r
93 };\r
94 \r
95 #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
96 \r
97 template <typename T>\r
98 struct make_reference_content\r
99     : mpl::if_<\r
100           is_reference<T>\r
101         , reference_content<T>\r
102         , T\r
103         >\r
104 {\r
105 };\r
106 \r
107 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround\r
108 \r
109 template <>\r
110 struct make_reference_content< mpl::void_ >\r
111 {\r
112     template <typename T>\r
113     struct apply\r
114         : make_reference_content<T>\r
115     {\r
116     };\r
117 \r
118     typedef mpl::void_ type;\r
119 };\r
120 \r
121 } // namespace detail\r
122 \r
123 ///////////////////////////////////////////////////////////////////////////////\r
124 // reference_content<T&> type traits specializations\r
125 //\r
126 \r
127 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
128 \r
129 template <typename T>\r
130 struct has_nothrow_copy<\r
131       ::boost::detail::reference_content< T& >\r
132     >\r
133     : mpl::true_\r
134 {\r
135 };\r
136 \r
137 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
138 \r
139 } // namespace boost\r
140 \r
141 #endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP\r