1 //-----------------------------------------------------------------------------
2 // boost detail/reference_content.hpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
9 // Distributed under the Boost Software License, Version 1.0. (See
10 // accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
13 #ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
14 #define BOOST_DETAIL_REFERENCE_CONTENT_HPP
16 #include "boost/config.hpp"
18 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
19 # include "boost/mpl/bool.hpp"
20 # include "boost/type_traits/has_nothrow_copy.hpp"
22 # include "boost/mpl/if.hpp"
23 # include "boost/type_traits/is_reference.hpp"
26 #include "boost/mpl/void.hpp"
32 ///////////////////////////////////////////////////////////////////////////////
33 // (detail) class template reference_content
35 // Non-Assignable wrapper for references.
37 template <typename RefT
>
38 class reference_content
40 private: // representation
50 reference_content(RefT r
)
55 reference_content(const reference_content
& operand
)
56 : content_( operand
.content_
)
60 private: // non-Assignable
62 reference_content
& operator=(const reference_content
&);
73 ///////////////////////////////////////////////////////////////////////////////
74 // (detail) metafunction make_reference_content
76 // Wraps with reference_content if specified type is reference.
79 template <typename T
= mpl::void_
> struct make_reference_content
;
81 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
84 struct make_reference_content
90 struct make_reference_content
< T
& >
92 typedef reference_content
<T
&> type
;
95 #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
98 struct make_reference_content
101 , reference_content
<T
>
107 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
110 struct make_reference_content
< mpl::void_
>
112 template <typename T
>
114 : make_reference_content
<T
>
118 typedef mpl::void_ type
;
121 } // namespace detail
123 ///////////////////////////////////////////////////////////////////////////////
124 // reference_content<T&> type traits specializations
127 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
129 template <typename T
>
130 struct has_nothrow_copy
<
131 ::boost::detail::reference_content
< T
& >
137 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
141 #endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP