1 //-----------------------------------------------------------------------------
2 // boost detail/reference_content.hpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
9 // Permission to use, copy, modify, distribute and sell this software
10 // and its documentation for any purpose is hereby granted without fee,
11 // provided that the above copyright notice appears in all copies and
12 // that both the copyright notice and this permission notice appear in
13 // supporting documentation. No representations are made about the
14 // suitability of this software for any purpose. It is provided "as is"
15 // without express or implied warranty.
17 #ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
18 #define BOOST_DETAIL_REFERENCE_CONTENT_HPP
20 #include "boost/config.hpp"
22 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
23 # include "boost/mpl/bool.hpp"
24 # include "boost/type_traits/has_nothrow_copy.hpp"
26 # include "boost/mpl/if.hpp"
27 # include "boost/type_traits/is_reference.hpp"
30 #include "boost/mpl/void.hpp"
36 ///////////////////////////////////////////////////////////////////////////////
37 // (detail) class template reference_content
39 // Non-Assignable wrapper for references.
41 template <typename RefT>
42 class reference_content
44 private: // representation
54 reference_content(RefT r)
59 reference_content(const reference_content& operand)
60 : content_( operand.content_ )
64 private: // non-Assignable
66 reference_content& operator=(const reference_content&);
77 ///////////////////////////////////////////////////////////////////////////////
78 // (detail) metafunction make_reference_content
80 // Wraps with reference_content if specified type is reference.
83 template <typename T = mpl::void_> struct make_reference_content;
85 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
88 struct make_reference_content
94 struct make_reference_content< T& >
96 typedef reference_content<T&> type;
99 #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
101 template <typename T>
102 struct make_reference_content
105 , reference_content<T>
111 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
114 struct make_reference_content< mpl::void_ >
116 template <typename T>
118 : make_reference_content<T>
122 typedef mpl::void_ type;
125 } // namespace detail
127 ///////////////////////////////////////////////////////////////////////////////
128 // reference_content<T&> type traits specializations
131 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
133 template <typename T>
134 struct has_nothrow_copy<
135 ::boost::detail::reference_content< T& >
141 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
145 #endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP